Arduino Anemometer: Wind Speed, Calibration and Beaufort Scale
Arduino anemometer guide: count reed or Hall sensor pulses, get km/h with interrupts, find the calibration factor, Beaufort table and an ESP32 weather station.
An Arduino anemometer measures wind speed with a few cheap parts. The most common type is the cup anemometer: the wind spins three cups, a magnet on the shaft triggers a reed switch or Hall sensor once per turn, and the Arduino counts those pulses. Multiply the number of pulses per second by a calibration factor and you get the wind speed in km/h or m/s.
In this guide you'll learn the physics of the cup rotor, the difference between a reed switch and a Hall sensor, how to count pulses with an interrupt without missing any, and how to calculate the 3-second gust and 10-minute mean used in meteorology. You'll do a step-by-step calibration to find your own rotor's factor, convert the result to the Beaufort scale, connect ready-made pulse and analog anemometers, and finally add the anemometer to an ESP32 weather station with a BME280.

What is an anemometer and how does it work?
In a cup anemometer, the concave side of each cup catches more wind than the convex side; that difference turns the rotor. The cups never spin as fast as the wind: the speed of the cup centres is roughly a third of the wind speed. That's why wind speed is found with the formula v = 2 × π × r × f × k. Here r is the distance from the cup centre to the shaft (in metres), f is the number of turns per second, and k is the anemometer factor, which comes out between 2.5 and 3.2 on most rotors. If you put more than one magnet on the shaft, you get more pulses per turn and measure low speeds more precisely; then you divide the pulse frequency by the number of magnets to get f. Because of friction, the cups don't turn at all in a very light breeze (usually below 1–3 km/h); this value is called the starting speed.
| Feature | Reed switch | Hall sensor (A3144) |
|---|---|---|
| Supply | Not needed (passive contact) | 4.5–24 V |
| Output | Contact closes, reads LOW with INPUT_PULLUP | Open collector, reads LOW with a pull-up |
| Contact bounce | Yes, needs a 2–5 ms software filter | None, gives a clean edge |
| Lifetime | Long, but the mechanical contact wears | No mechanical wear |
| Current draw | Only pull-up current while the contact is closed | About 4 mA continuously |
| In ready-made anemometers | The most common type | Some models and industrial types |
Building your own cup rotor
- Use three cups spaced 120° apart; a two-cup rotor doesn't turn evenly from every direction, and four cups only add weight without any real benefit.
- Ping-pong balls cut in half or 5–6 cm 3D-printed hemispheres make good cups. Light cups mean a low starting speed.
- Make the arms 6–8 cm long. Shorter arms make the rotor spin faster; longer arms measure more steadily in light wind.
- Support the shaft with a 608 bearing (skateboard bearing) or two small bearings. Don't use grease; it thickens in the cold and raises the starting speed.
- Glue the magnet to a small disc near the shaft and fix the reed switch or Hall sensor 2–5 mm away. Balance the rotor: extra weight on one side causes vibration at high speed.
- Mount the anemometer away from obstacles and, if possible, 10 metres above the ground; that's the standard measuring height at weather stations. On a roof, put it at least 1–2 metres above the roof edge.
Wiring the reed switch and Hall sensor
A reed switch has no polarity: connect one end to the counting pin and the other to GND, and set the pin to INPUT_PULLUP. As the magnet passes, the contact closes and the pin goes LOW. A Hall sensor such as the A3144 has three legs: VCC, GND and OUT. Its output is open collector, so it needs a pull-up resistor; the Arduino's internal pull-up works too, but with a long cable an external 10 kΩ resistor is more stable. On the Uno you can use D2, which is INT0; on the ESP32 any GPIO will do. You'll find interrupt pins and the FALLING edge in the Arduino interrupt article, and the different Hall sensors in the Hall sensor article.
| Connection | Arduino Uno | ESP32 |
|---|---|---|
| Reed switch (two leads) | D2 and GND (INPUT_PULLUP) | GPIO 27 and GND (INPUT_PULLUP) |
| Hall A3144: VCC and GND | 5V and GND | 5V (VIN) and GND |
| Hall A3144: OUT | D2, 10 kΩ pull-up to 5V | GPIO 27, 10 kΩ pull-up to 3.3V |
| Ready-made pulse anemometer (two middle wires of the RJ11) | D2 and GND | GPIO 27 and GND |
| Analog anemometer signal (0.4–2 V) | A0, sensor powered separately with 7–24 V | GPIO 34 (2 V, below the 3.3 V limit) |
| BME280 SDA and SCL | A4 and A5 | GPIO 21 and GPIO 22 |
Counting pulses with an interrupt and calculating km/h
If you try to catch pulses with digitalRead inside loop(), you'll miss the ones that arrive while the Arduino is busy with something else. An interrupt, on the other hand, pauses whatever is running at every falling edge, runs a short function and adds one to the counter. Reed switches bounce for a few milliseconds as they close and make a single pass look like several pulses; that's why the code ignores pulses that arrive closer than 5 ms apart. 5 ms allows up to 200 pulses per second; with a 2.4 km/h per Hz kit that's 480 km/h, so it's no real limit. Every 3 seconds the code reads and resets the counter. According to the World Meteorological Organization definition, the gust is the highest of the 3-second averages, and the mean wind is the 10-minute average. The code keeps the last 200 windows (200 × 3 s = 10 minutes) in a ring buffer and calculates both. This array takes up only 400 bytes of the Uno's 2 KB of RAM.
1// Arduino anemometre: reed ya da Hall sensörle darbe sayma, km/sa, 3 sn hamle, 10 dk ortalama, Beaufort
2// Arduino anemometer: pulse counting with a reed or Hall sensor, km/h, 3 s gust, 10 min mean, Beaufort
3const byte PIN_WIND = 2; // INT0, reed ya da A3144 çıkışı / reed or A3144 output
4const float KMH_PER_HZ = 2.4; // hazır set: 1 darbe/sn = 2,4 km/sa; kendi rotorunu kalibre et / calibrate your own rotor
5const unsigned long DEBOUNCE_US = 5000; // 5 ms'den sık darbeleri yok say / ignore pulses closer than 5 ms
6const unsigned long WINDOW_MS = 3000; // 3 sn ölçüm penceresi / 3 s measuring window
7const int SLOTS = 200; // 200 x 3 sn = 10 dk / 200 x 3 s = 10 min
8
9volatile unsigned int pulses = 0;
10volatile unsigned long lastPulseUs = 0;
11unsigned int history[SLOTS]; // her pencerenin darbe sayısı / pulse count of each window
12int slot = 0, filled = 0;
13unsigned long windowStart = 0;
14
15void onPulse() {
16 unsigned long now = micros();
17 if (now - lastPulseUs >= DEBOUNCE_US) { // reed sıçramasını süz / filter reed bounce
18 pulses++;
19 lastPulseUs = now;
20 }
21}
22
23int beaufort(float kmh) {
24 // Her Beaufort derecesinin alt sınırı (km/sa) / lower limit of each Beaufort number (km/h)
25 const float limits[12] = {1, 6, 12, 20, 29, 39, 50, 62, 75, 89, 103, 118};
26 int b = 0;
27 while (b < 12 && kmh >= limits[b]) b++;
28 return b;
29}
30
31void setup() {
32 Serial.begin(9600);
33 pinMode(PIN_WIND, INPUT_PULLUP);
34 attachInterrupt(digitalPinToInterrupt(PIN_WIND), onPulse, FALLING);
35 windowStart = millis();
36}
37
38void loop() {
39 if (millis() - windowStart < WINDOW_MS) return;
40 windowStart += WINDOW_MS;
41
42 noInterrupts(); // sayacı güvenle oku ve sıfırla / read and reset the counter safely
43 unsigned int n = pulses;
44 pulses = 0;
45 interrupts();
46
47 history[slot] = n;
48 slot = (slot + 1) % SLOTS;
49 if (filled < SLOTS) filled++;
50
51 const float seconds = WINDOW_MS / 1000.0;
52 float nowKmh = n / seconds * KMH_PER_HZ; // son 3 sn / last 3 s
53
54 unsigned long sum = 0;
55 unsigned int maxN = 0;
56 for (int i = 0; i < filled; i++) {
57 sum += history[i];
58 if (history[i] > maxN) maxN = history[i];
59 }
60 float meanKmh = sum / (filled * seconds) * KMH_PER_HZ; // 10 dk ortalama / 10 min mean
61 float gustKmh = maxN / seconds * KMH_PER_HZ; // en güçlü 3 sn / strongest 3 s
62
63 Serial.print(F("Anlik / now: ")); Serial.print(nowKmh, 1);
64 Serial.print(F(" km/h Ort / mean: ")); Serial.print(meanKmh, 1);
65 Serial.print(F(" km/h Hamle / gust: ")); Serial.print(gustKmh, 1);
66 Serial.print(F(" km/h ")); Serial.print(meanKmh / 3.6, 1);
67 Serial.print(F(" m/s Beaufort ")); Serial.println(beaufort(meanKmh));
68}
69Because the counter changes inside the interrupt function, it's declared volatile; loop() briefly turns interrupts off with noInterrupts() while reading it, so a pulse arriving mid-read can't corrupt half of the number. The speed calculation is a single line: 15 pulses in 3 seconds means 5 Hz, which with a 2.4 km/h per Hz factor gives 12 km/h. The beaufort() function converts the result into the numbers in the table below. Open the Serial Monitor at 9600 baud and every 3 seconds you'll see the current speed, the 10-minute mean, the gust and the Beaufort number. During the first 10 minutes, the mean is calculated from the windows collected so far.
How do you find the calibration factor?
For ready-made kits, the factor is the value the manufacturer gives; for a rotor you built yourself, you have to find it by measuring. The easiest way is a vehicle moving at a known speed. On a windless day, on an empty and safe road, a passenger holds the anemometer at least 50 cm above the car roof; the air just above the roof is sped up, so measuring lower gives wrong results. Drive at steady speeds according to GPS and note the pulse frequency at each speed. To cancel out a light breeze, drive the same stretch in both directions and take the average. The driver never takes the measurements. Another way, if you have a reliable handheld anemometer, is to hold the two side by side in front of a fan or in the open air and compare them.
- Measure the distance from the cup centre to the shaft (r) in metres and note how many magnets are on the shaft.
- Temporarily set KMH_PER_HZ in the code to 1; that way the Serial Monitor shows the pulse frequency (Hz) directly instead of km/h.
- Drive steadily at 20, 30 and 40 km/h for a minute each and note the frequency at each speed.
- For each measurement calculate k = v / (2 × π × r × f) (v in m/s, f in turns per second). Average the three results.
- Enter KMH_PER_HZ = 2 × π × r × k × 3.6 / number of magnets in the code, then repeat the measurement at the same speeds to check.
| Measurement | Example value |
|---|---|
| Distance from cup centre to shaft r | 7 cm (0.07 m) |
| Number of magnets (pulses per turn) | 1 |
| Reference speed (vehicle, GPS) | 30 km/h = 8.33 m/s |
| Measured pulse frequency | 6.3 Hz (6.3 turns per second) |
| Cup centre speed 2πrf | 2 × 3.14 × 0.07 × 6.3 ≈ 2.77 m/s |
| Anemometer factor k | 8.33 / 2.77 ≈ 3.0 |
| KMH_PER_HZ in the code | 2 × 3.14 × 0.07 × 3.0 × 3.6 / 1 ≈ 4.75 |
Beaufort scale table
The Beaufort scale describes wind with numbers from 0 to 12 and the effects you can see; it's still used in weather forecasts and at sea today. By converting your km/h reading with this table, you can show a result everyone understands, such as "force 4 wind". The limits in the table are the same values the beaufort() function in the code uses. The correct way is to calculate the Beaufort number from the 10-minute mean, not from the current speed; a single gust can be one or two numbers above the mean.
| Beaufort | km/h | m/s | Description and effect |
|---|---|---|---|
| 0 | Less than 1 | 0–0.2 | Calm: smoke rises vertically |
| 1 | 1–5 | 0.3–1.5 | Light air: smoke drift shows the wind direction |
| 2 | 6–11 | 1.6–3.3 | Light breeze: felt on the face, leaves rustle |
| 3 | 12–19 | 3.4–5.4 | Gentle breeze: leaves and small twigs constantly moving |
| 4 | 20–28 | 5.5–7.9 | Moderate breeze: dust and paper blow about, small branches move |
| 5 | 29–38 | 8.0–10.7 | Fresh breeze: small trees sway |
| 6 | 39–49 | 10.8–13.8 | Strong breeze: large branches move, umbrellas hard to hold |
| 7 | 50–61 | 13.9–17.1 | Near gale: whole trees sway, walking becomes difficult |
| 8 | 62–74 | 17.2–20.7 | Gale: twigs break off trees |
| 9 | 75–88 | 20.8–24.4 | Strong gale: roof tiles may blow off |
| 10 | 89–102 | 24.5–28.4 | Storm: trees uprooted |
| 11 | 103–117 | 28.5–32.6 | Violent storm: widespread damage |
| 12 | 118 and above | 32.7 and above | Hurricane force: severe devastation |
Connecting a ready-made anemometer
The cup anemometers in home weather station kits usually contain a reed switch and come with an RJ11 phone plug; the two middle wires of the plug are used for speed. The common value for these kits is that one closure per second equals 2.4 km/h of wind, which is why the code's default is KMH_PER_HZ = 2.4. Industrial anemometers, on the other hand, output the wind speed as a voltage or current and need their own power supply. With these you read an analog pin instead of counting pulses. Always enter the conversion values from your model's datasheet in the code; the table below only shows common examples.
| Output type | Supply | Conversion (example) | Connection to the Arduino |
|---|---|---|---|
| Pulse (reed), weather station kits | Not needed | 1 pulse/s = 2.4 km/h | Digital pin, INPUT_PULLUP |
| Voltage 0.4–2 V | 7–24 V | 0.4 V = 0 m/s, 2.0 V = 32.4 m/s | Directly to an analog pin |
| Voltage 0–5 V | 12–24 V | 0 V = 0, 5 V = 30 m/s | Directly to the Uno, via a voltage divider to the ESP32 |
| Current 4–20 mA | 12–24 V | 4 mA = 0, 20 mA = 30 m/s | Convert to 1–5 V with 250 Ω (150 Ω for the ESP32: 0.6–3 V) |
| RS485 Modbus | 12–24 V | Read from a register | With a MAX485 module |
1// Hazır analog anemometre: 0,4 V = 0 m/s, 2,0 V = 32,4 m/s, sinyal A0'a
2// Ready-made analog anemometer: 0.4 V = 0 m/s, 2.0 V = 32.4 m/s, signal to A0
3const int PIN_ANEMO = A0;
4const float VREF = 5.0; // Uno'nun gerçek 5V'unu ölçüp yaz / measure and enter the Uno's real 5V
5const float V_ZERO = 0.4; // durgun havada çıkış / output in still air
6const float V_FULL = 2.0; // en yüksek hızda çıkış / output at full scale
7const float SPEED_FULL = 32.4; // m/s
8
9void setup() {
10 Serial.begin(9600);
11}
12
13void loop() {
14 long sum = 0;
15 for (int i = 0; i < 20; i++) { // 20 örneğin ortalaması / average of 20 samples
16 sum += analogRead(PIN_ANEMO);
17 delay(5);
18 }
19 float volts = sum / 20.0 * VREF / 1023.0;
20 float ms = (volts - V_ZERO) / (V_FULL - V_ZERO) * SPEED_FULL;
21 if (ms < 0) ms = 0;
22
23 Serial.print(volts, 3); Serial.print(F(" V "));
24 Serial.print(ms, 1); Serial.print(F(" m/s "));
25 Serial.print(ms * 3.6, 1); Serial.println(F(" km/h"));
26 delay(1000);
27}
28The analog sketch averages 20 samples, because wind and ADC noise make a single reading jump around. The Uno's ADC uses the 5V pin as its reference; on a board powered from USB this can vary between 4.8 and 5.1 V, so enter the real value you measured with a multimeter in the VREF line. If you're connecting a 0–5 V sensor to an ESP32, pick suitable resistors with the voltage divider calculator; for RS485 models, see the MAX485 and Modbus article.
Adding it to an ESP32 weather station
The ESP32 version uses the same pulse counting logic and adds a BME280 that measures temperature, humidity and pressure. On the ESP32 the interrupt function is marked IRAM_ATTR so it runs quickly even while the flash memory is busy. The code has a portMUX lock so the counter can be read safely on the dual-core processor. The code joins your home network and offers two addresses: a page you open on your phone that refreshes every 5 seconds, and JSON at /data that other devices can read. Details and calibration of the BME280 are in the ESP32 BME280 weather station article; if you want to send the data to the cloud, you can add the method from the ESP32 ThingSpeak article to this code.

1// ESP32 hava istasyonu: anemometre (GPIO 27) + BME280, telefondan sayfa ve JSON
2// ESP32 weather station: anemometer (GPIO 27) + BME280, web page and JSON for the phone
3#include <WiFi.h>
4#include <WebServer.h>
5#include <Wire.h>
6#include <Adafruit_BME280.h>
7
8const char* WIFI_SSID = "WIFI_ADIN";
9const char* WIFI_PASS = "WIFI_SIFREN";
10
11const int PIN_WIND = 27; // reed ya da Hall çıkışı (3,3 V'a pull-up) / reed or Hall output (pull-up to 3.3 V)
12const float KMH_PER_HZ = 2.4; // kendi katsayın / your own factor
13const uint32_t WINDOW_MS = 3000;
14const int SLOTS = 200; // 10 dk / 10 min
15
16volatile uint32_t pulses = 0;
17volatile uint32_t lastPulseUs = 0;
18portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;
19
20uint16_t history[SLOTS];
21int slot = 0, filled = 0;
22uint32_t windowStart = 0;
23float windNow = 0, windMean = 0, windGust = 0, tempC = NAN, humidity = NAN, pressure = NAN;
24
25Adafruit_BME280 bme;
26WebServer server(80);
27
28void IRAM_ATTR onPulse() {
29 uint32_t now = micros();
30 portENTER_CRITICAL_ISR(&mux);
31 if (now - lastPulseUs >= 5000) { pulses++; lastPulseUs = now; } // 5 ms sıçrama filtresi / 5 ms debounce
32 portEXIT_CRITICAL_ISR(&mux);
33}
34
35void handleData() {
36 char json[160];
37 snprintf(json, sizeof(json),
38 "{\"wind_kmh\":%.1f,\"mean_kmh\":%.1f,\"gust_kmh\":%.1f,\"temp_c\":%.1f,\"hum\":%.0f,\"hpa\":%.1f}",
39 windNow, windMean, windGust, tempC, humidity, pressure);
40 server.send(200, "application/json", json);
41}
42
43void handleRoot() {
44 String html = "<!DOCTYPE html><html><head><meta charset='utf-8'><meta http-equiv='refresh' content='5'>"
45 "<meta name='viewport' content='width=device-width'><title>Hava</title></head>"
46 "<body style='font-family:sans-serif'><h2>Hava istasyonu</h2>"
47 "<p>Rüzgar: " + String(windNow, 1) + " km/sa (ort. " + String(windMean, 1) +
48 ", hamle " + String(windGust, 1) + ")</p><p>Sıcaklık: " + String(tempC, 1) +
49 " °C, nem: %" + String(humidity, 0) + ", basınç: " + String(pressure, 1) + " hPa</p></body></html>";
50 server.send(200, "text/html", html);
51}
52
53void setup() {
54 Serial.begin(115200);
55 pinMode(PIN_WIND, INPUT_PULLUP);
56 attachInterrupt(digitalPinToInterrupt(PIN_WIND), onPulse, FALLING);
57
58 Wire.begin(21, 22); // SDA, SCL
59 if (!bme.begin(0x76)) Serial.println("BME280 yok (0x77 dene) / not found (try 0x77)");
60
61 WiFi.mode(WIFI_STA);
62 WiFi.begin(WIFI_SSID, WIFI_PASS);
63 while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print('.'); }
64 Serial.print("\nIP: "); Serial.println(WiFi.localIP());
65
66 server.on("/", handleRoot);
67 server.on("/data", handleData);
68 server.begin();
69 windowStart = millis();
70}
71
72void loop() {
73 server.handleClient();
74 if (millis() - windowStart < WINDOW_MS) return;
75 windowStart += WINDOW_MS;
76
77 portENTER_CRITICAL(&mux);
78 uint32_t n = pulses;
79 pulses = 0;
80 portEXIT_CRITICAL(&mux);
81
82 history[slot] = n;
83 slot = (slot + 1) % SLOTS;
84 if (filled < SLOTS) filled++;
85
86 const float seconds = WINDOW_MS / 1000.0;
87 uint32_t sum = 0, maxN = 0;
88 for (int i = 0; i < filled; i++) { sum += history[i]; if (history[i] > maxN) maxN = history[i]; }
89 windNow = n / seconds * KMH_PER_HZ;
90 windMean = sum / (filled * seconds) * KMH_PER_HZ;
91 windGust = maxN / seconds * KMH_PER_HZ;
92
93 tempC = bme.readTemperature();
94 humidity = bme.readHumidity();
95 pressure = bme.readPressure() / 100.0;
96}
97Common problems and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| Speed shows even in still air | Noise, or a floating pin on a long cable | Strengthen the pull-up with an external 10 kΩ resistor, add a 100 nF capacitor from pin to GND |
| Reading is twice the real speed | Triggers twice per turn, or bounce isn't filtered | Enter the number of magnets in the code, check DEBOUNCE_US |
| Rotor doesn't turn in light wind | Too much friction or heavy cups | Clean the bearing, use light cups, balance the rotor |
| Gust values far above the mean | A single bounce pulse spoils the 3 s window | Set the bounce filter to 5–10 ms, switch to a Hall sensor |
| ESP32 resets at random | Interrupt function not in IRAM, or uses Serial | Add IRAM_ATTR, only increment the counter in the interrupt |
| Analog anemometer always reads 0 | Sensor has no supply, or the GNDs are separate | Power the sensor with 7–24 V, connect the GNDs |
Project ideas
- Idea: A wind guard that rolls up an awning or blind when the wind goes above 50 km/h; for the motor side, see the stepper motor article.
- Idea: Add the anemometer to an Arduino weather station and show temperature, humidity and wind on one screen.
- Idea: Write the readings with date and time to an SD card and plot a month of wind data; very useful when choosing a site for a small wind turbine.
- Idea: An ESP32 that sends a notification to your phone when a gust exceeds a set value; combine it with the code from the Telegram bot article.
- Idea: Use the rotor for drone or model aircraft tests and measure a speed profile in a wind tunnel.
An anemometer is a great starting point because it teaches the core ideas of measurement, such as interrupts, time windows and calibration, in one project. Test the code first by triggering the reed switch by hand with a magnet, then build and calibrate the rotor. If you want to see how the sensor works step by step, you can look at the circuit diagram and code of the "Reed Switch Reading" project in the BlueGrays app, and the "Temperature and Humidity with DHT11" and "ESP32 DHT22 Temperature and Humidity (with LCD)" projects for the weather station side.
Frequently asked questions
How do you measure wind speed with an Arduino?
A magnet is fitted to the shaft of a cup rotor, and a reed switch or Hall sensor produces one pulse per turn. The Arduino counts these pulses with an interrupt, multiplies the pulses per second by a calibration factor and gives the wind speed in km/h or m/s. In ready-made kits the factor is usually 2.4 km/h per pulse per second.
Is a reed switch or Hall sensor better for an anemometer?
A reed switch needs no power and is found in most ready-made kits, but it bounces, so it needs a software filter. A Hall sensor gives a clean signal and doesn't wear mechanically, but it draws a few mA continuously. A reed switch suits a battery-powered station; a Hall sensor suits fast, long-life measurements.
How do you calculate an anemometer's calibration factor?
Run the rotor at a known speed (for example, in a car on a windless day, using GPS) and measure the pulse frequency. The factor is k = v / (2 × π × r × f), where r is the distance from the cup centre to the shaft and f is turns per second. For cup rotors, k usually comes out between 2.5 and 3.2.
What is the difference between wind gust and mean wind speed?
In meteorology, the mean wind is the 10-minute average and the gust is the highest 3-second average within that time. Gusts can easily be 30–50 percent above the mean. That's why the code calculates them separately and gives the Beaufort number from the mean.
How many km/h is force 6 on the Beaufort scale?
Beaufort 6, a strong breeze, is 39–49 km/h or 10.8–13.8 m/s. At this speed large branches move and umbrellas become hard to hold. Beaufort 8 (gale) starts at 62 km/h.
How do I connect a ready-made anemometer to an ESP32?
Connect the two wires of a pulse-output (reed) anemometer to a GPIO and GND, and set the pin to INPUT_PULLUP. Analog types with a 0.4–2 V output can go straight to an ADC1 pin; 0–5 V types need a voltage divider and 4–20 mA types a 150 Ω resistor. Industrial types need their own 7–24 V supply.
Projects to build after reading this
See all projects
Temperature and Humidity with DHT11
How warm is your room, and is the air humid or dry? The DHT11 sensor measures temperature and humidity, and the Arduino writes the values on a two-line LCD screen, refreshing every couple of seconds.

Reading a Reed Switch
Ever wondered about the magnetic switch inside door and window alarms? When a magnet comes near the reed relay module, the tiny switch inside it closes; the Arduino reads it once a second and prints…

Reed Switch Door Sensor
Tell whether your door is open or closed just by looking at a light. You attach a small magnet to the door and a magnet-sensing switch to the frame; when the door is closed they sit side by side and…

ESP32 DHT22 Temperature and Humidity (with LCD Display)
This project measures ambient temperature and humidity using a DHT22 sensor and displays the data in real time on a 16x2 I2C LCD. Data is read from the sensor using the one-wire protocol via the Adafruit DHT library. This project serves as the foundation for IoT weather stations, smart home automation, or environmental monitoring systems in greenhouses. Communication with the DHT22 is established via the ESP32's GPIO 4 pin.

Dot Matrix Clock, Calendar and Weather Station (MAX7219, DS1307)
A scrolling-text board for your desk or wall that shows the time, the date and the room's weather in turn.

ESP32 HTTPClient + Weather API (with LCD Screen)
In this project the ESP32 makes a REST API call over the internet to a weather API (wttr.in) using HTTPClient.h. The JSON response is parsed with ArduinoJson v7, and the city, temperature, humidity, weather and wind are shown on an I2C LCD. wttr.in needs no API key; just type the name of any city.

ESP32 Temperature Data Logger (DHT22 + DS1307 RTC + microSD + OLED)
Build a timed temperature and humidity logger with the ESP32! A DHT22 sensor reads temperature and humidity once a minute, and each reading is saved to a microSD card in CSV format with a real-time stamp from the DS1307 RTC module. The OLED display shows the latest temperature, humidity, timestamp and total number of records live, in large text.

Temperature Measurement with NTC and 2x16 Lcd Display
Measure the temperature around you with a sensor that looks like a tiny bead. This part, called an NTC, lets electricity through more easily as it warms up; the Arduino reads that change, turns it…
More articles
BlueGrays app
Build this circuit step by step on your phone
Wiring diagram, code and parts list on one screen. 500+ Arduino, ESP32, ESP8266, Pico, mBot and micro:bit projects ready to build.
Scan with your phone
Point your camera at the code and your phone's app store opens.
or open the store

