Arduino Agriculture Projects: 15 Builds for Irrigation and Farms
15 Arduino and ESP32 farm projects: drip irrigation, greenhouse climate, soil moisture and pH, coop door, hive scale, LoRa field sensor; power and range table.
Arduino agriculture projects are small systems that measure values such as soil moisture, temperature, humidity, light and weight with cheap sensors and decide on their own when to water, ventilate or raise an alert. From a few pots on a balcony to a greenhouse, a chicken coop, a beehive or a field miles from home, the same logic applies: the sensor measures, the board decides, and a relay, pump or phone notification takes action.
In this guide we've collected 15 Arduino and ESP32 projects for gardening and farming in one table: for each one you'll see the value measured, the sensor used, how the device is powered (adapter, battery or solar panel) and how far its data can travel. Then we walk through three pieces of code: drip irrigation based on soil moisture, a greenhouse fan with the Raspberry Pi Pico, and a battery-powered field node that wakes every 15 minutes and sends its reading over ESP-NOW.

What are Arduino and ESP32 good for in agriculture?
The hard part of a farm project is usually not the code but the outdoors. The electronics must survive rain, dust, greenhouse heat of up to 50 °C and night frost, run for months away from a socket, and get the data back to the house through walls and trees. That's why the right board depends on where the job is. If you're controlling a single spot near the pump and a socket, an Arduino Uno or Nano is enough. For a greenhouse near your home Wi-Fi, phone monitoring or several sensor points, the ESP32 is the right choice. For a remote field that your router can't reach, you need a LoRa module or GSM. The Raspberry Pi Pico is a good alternative if you want to write a greenhouse controller quickly in MicroPython.
15 agriculture and garden projects: value, sensor, power and range
The power column shows the most sensible way to supply each device, and the range column the approximate distance its data can reach; range is for open ground and shrinks with walls and trees. Projects with a name in the last column are ready-made projects in the BlueGrays app; those marked Idea are projects you can build from the descriptions in this article and the linked guides.
| No | Project | Value measured | Sensor | Power | Range | In BlueGrays |
|---|---|---|---|---|---|---|
| 1 | Automatic watering for a pot | Soil moisture | Soil moisture sensor + pump | 5 V adapter | On site | Smart Irrigation Station |
| 2 | Plant watering with a Wi-Fi dashboard | Soil moisture | Soil moisture sensor + pump | 5 V adapter | Wi-Fi, 50-100 m | Idea |
| 3 | Timed drip irrigation | Time, tank level | RTC module, float switch | 12 V adapter or battery | On site | Idea |
| 4 | Skip watering when it rains | Rain | Rain sensor | Shared with the irrigation system | On site | Idea |
| 5 | Greenhouse climate control | Temperature, humidity | DHT22 or SHT31 | Adapter | Wi-Fi, 50-100 m | Idea |
| 6 | Frost alarm | Air and soil temperature | Waterproof DS18B20 | Battery or adapter | Wi-Fi or LoRa | Idea |
| 7 | Greenhouse and barn temperature logger | Temperature, humidity | DHT22 + RTC + microSD | Adapter or power bank | Stored on the card | ESP32 Temperature Logger |
| 8 | Soil pH meter | pH | pH module + glass probe | USB, while measuring | On site | Idea |
| 9 | Soil nutrient analysis | Nitrogen, phosphorus, potassium | RS485 NPK sensor | 12 V | RS485 cable, hundreds of metres | Idea |
| 10 | Hydroponic nutrient monitoring | TDS, temperature | TDS module + DS18B20 | 5 V adapter | Wi-Fi | Idea |
| 11 | Automatic chicken coop door | Light or time | LDR or RTC + motor | 12 V battery + solar panel | On site | Idea |
| 12 | Beehive scale | Hive weight | Load cells + HX711 | 18650 cell + solar panel | LoRa or GSM | Idea |
| 13 | Barn and coop motion alarm | Motion | PIR sensor | Adapter | Wi-Fi + Telegram | ESP32 Motion Alarm System |
| 14 | Solar-powered field node | Soil moisture and temperature | Capacitive sensor + DS18B20 | 18650 + 1-2 W panel | ESP-NOW, 100-200 m | Idea |
| 15 | LoRa field sensor | Soil moisture, weather | Capacitive sensor + LoRa | 18650 + solar panel | 5-10 km in open country | Idea |
Irrigation projects (1-4)
- 1. Automatic watering for a pot: When soil moisture drops below your threshold, a small pump runs for a few seconds. With a capacitive sensor the electrodes don't corrode; calibration is covered in the capacitive soil moisture sensor guide. The code is below.
- 2. Plant watering with a Wi-Fi dashboard: The ESP32 version of the same idea: you see the moisture on your phone, change the threshold in the browser and run the pump remotely. The detailed build is in the ESP32 automatic watering guide.
- 3. Timed drip irrigation (idea): An RTC module opens a 12 V normally closed solenoid valve at 06:00 and 19:00, and a float switch stops watering if the tank is empty. Watering when evaporation is lowest saves a good share of the water. To measure the tank level in litres, see the water tank level meter guide.
- 4. Skip watering when it rains (idea): When the rain sensor gets wet, watering is postponed for 24 hours. Put the sensor's board in a closed box and only the grid in the open air; wiring is in the rain sensor guide.
Drip irrigation code based on soil moisture
Connect the capacitive sensor's AOUT to A0, GND to GND, and VCC not straight to 5V but to D6: the code powers the sensor only while measuring, which reduces electrochemical effects between the sensor and the soil. The relay module's IN pin goes to D7. Power the pump or solenoid valve from its own adapter, not from the Arduino, and put the relay in that line. The code keeps the pump off at start-up, waters when the soil drops below 35 % and stops at 55 %.

1// Toprak nemine göre damla sulama / Drip irrigation by soil moisture
2const int SOIL_PIN = A0; // kapasitif sensör AOUT / capacitive sensor AOUT
3const int SENSOR_POWER = 6; // sensörü yalnız ölçerken besle / power the sensor only while reading
4const int RELAY_PIN = 7; // pompa ya da valf rölesi / pump or valve relay
5const bool RELAY_ON = LOW; // çoğu röle modülü LOW ile çeker / most relay modules switch on LOW
6
7const int RAW_DRY = 520; // sensör havadayken okunan değer / reading with the sensor in air
8const int RAW_WET = 260; // sensör sudayken okunan değer / reading with the sensor in water
9const int START_BELOW = 35; // nem %35'in altına inince sula / water when moisture drops below 35 %
10const int STOP_ABOVE = 55; // %55'e çıkınca dur / stop at 55 %
11const unsigned long PUMP_MAX_MS = 20000UL; // tek seferde en fazla 20 s / at most 20 s per run
12const unsigned long SOAK_MS = 10UL * 60 * 1000; // suyun yayılması için 10 dk / 10 min for the water to spread
13const unsigned long READ_EVERY_MS = 5000UL; // 5 s'de bir ölç / measure every 5 s
14
15bool pumping = false;
16unsigned long pumpStart = 0;
17unsigned long lastStop = 0;
18unsigned long lastRead = 0;
19bool soakedOnce = false;
20
21int readMoisture() {
22 digitalWrite(SENSOR_POWER, HIGH);
23 delay(200); // sensörün oturmasını bekle / let the sensor settle
24 long sum = 0;
25 for (int i = 0; i < 10; i++) sum += analogRead(SOIL_PIN);
26 digitalWrite(SENSOR_POWER, LOW);
27 int raw = sum / 10;
28 return constrain(map(raw, RAW_DRY, RAW_WET, 0, 100), 0, 100); // % nem / % moisture
29}
30
31void setPump(bool on) {
32 digitalWrite(RELAY_PIN, on ? RELAY_ON : !RELAY_ON);
33 pumping = on;
34}
35
36void setup() {
37 Serial.begin(9600);
38 pinMode(SENSOR_POWER, OUTPUT);
39 pinMode(RELAY_PIN, OUTPUT);
40 setPump(false);
41}
42
43void loop() {
44 unsigned long now = millis();
45
46 // Güvenlik: pompa en fazla PUMP_MAX_MS çalışır / safety: the pump runs at most PUMP_MAX_MS
47 if (pumping && now - pumpStart >= PUMP_MAX_MS) {
48 setPump(false);
49 lastStop = now;
50 soakedOnce = true;
51 Serial.println(F("Sure doldu, bekleniyor / time limit, soaking"));
52 }
53
54 if (now - lastRead < READ_EVERY_MS) return;
55 lastRead = now;
56 int moisture = readMoisture();
57 Serial.print(F("Nem / moisture: "));
58 Serial.print(moisture);
59 Serial.println(F(" %"));
60
61 bool soaking = soakedOnce && (now - lastStop < SOAK_MS);
62 if (!pumping && !soaking && moisture < START_BELOW) {
63 setPump(true); // kurudu: sulamaya başla / dry: start watering
64 pumpStart = now;
65 } else if (pumping && moisture >= STOP_ABOVE) {
66 setPump(false); // yeterince ıslak: dur / wet enough: stop
67 lastStop = now;
68 soakedOnce = true;
69 }
70}| Code part | What it does |
|---|---|
| RAW_DRY, RAW_WET | The readings of the sensor in air and in water; read them from your own sensor in the Serial Monitor and enter them |
| START_BELOW, STOP_ABOVE | On and off thresholds; the 20-point gap between them stops the pump from switching on and off too often |
| PUMP_MAX_MS | Even if the sensor sits away from the roots or its cable breaks, the pump never runs longer than 20 seconds |
| SOAK_MS | Waits 10 minutes after watering; a second run can't start before the water spreads through the soil |
| SENSOR_POWER | Turns the sensor on only during a reading; extends battery and sensor life |
| RELAY_ON | If your relay module switches on HIGH, change this value to HIGH |
Greenhouse and climate projects (5-7)
- 5. Greenhouse climate control (idea): The fan turns on above 28 °C and off at 25 °C; if humidity tops 85 %, it also ventilates against mould. If the night drops below 10 °C, a small heater can kick in. Sensor choice, fan and watering code for a complete greenhouse are in the smart greenhouse project; below you'll also find a fan controller for the Pico.
- 6. Frost alarm (idea): A waterproof DS18B20 measures at plant height; when the temperature falls below 2 °C, a notification goes to your phone or a siren sounds. On clear, windless nights ground level can be several degrees colder than the air at 2 metres, so place the sensor close to the ground. How to use the sensor is in the DS18B20 temperature sensor guide.
- 7. Greenhouse and barn temperature logger: With a DHT22, an RTC and a microSD card it writes the temperature and humidity of every minute, with the date, to a CSV file. After a week you open the file in Excel and see the day-night difference and the effect of ventilation. Using the card is covered in the SD card module guide.
Greenhouse fan code with the Raspberry Pi Pico (MicroPython)
Connect the DHT22's data pin to GP15 and through a 10 kΩ resistor to 3V3, and the relay module's IN pin to GP14. If the fan runs on 12 V, the relay switches the 12 V line; the Pico only controls the relay module. The fan turns on at 28 °C and off at 25 °C: this 3-degree gap is called hysteresis and stops the relay clicking every second while the temperature hovers around the threshold. The dht module comes built into MicroPython for the Pico, no extra file needed.
1# Pico: sera fanı, DHT22 ve röle / greenhouse fan with DHT22 and a relay
2from machine import Pin
3import dht, time
4
5sensor = dht.DHT22(Pin(15)) # DHT22 DATA GP15 (10 kΩ pull-up 3V3'e) / to 3V3 via 10 kΩ
6fan = Pin(14, Pin.OUT, value=0) # röle modülü IN (HIGH = açık) / relay module IN (HIGH = on)
7FAN_ON_C, FAN_OFF_C = 28.0, 25.0 # 28 °C'de aç, 25 °C'de kapa / on at 28 °C, off at 25 °C
8HUMID_ON = 85.0 # nem %85'i geçerse de aç / also on above 85 % humidity
9
10while True:
11 try:
12 sensor.measure()
13 t, h = sensor.temperature(), sensor.humidity()
14 if t >= FAN_ON_C or h >= HUMID_ON:
15 fan.value(1)
16 elif t <= FAN_OFF_C and h < HUMID_ON - 5:
17 fan.value(0) # aradaki boşluk röleyi sık açıp kapatmaz / the gap stops relay chatter
18 print("{:.1f} C {:.0f} % fan={}".format(t, h, fan.value()))
19 except OSError:
20 print("DHT22 okunamadi / read failed")
21 time.sleep(5) # DHT22 en fazla 2 s'de bir okunur / read at most every 2 sSoil and plant analysis (8-10)
- 8. Soil pH meter (idea): A glass pH probe is never pushed straight into soil; it breaks and reads wrong. The right method is to mix one measure of soil with one or two measures of distilled water, let it stand for 30 minutes and measure the pH of the liquid. Most plants like 6.0-7.0; acid-loving plants such as blueberries want 4.5-5.5. Calibration and code are in the pH sensor guide.
- 9. Soil nutrient analysis (idea): NPK sensors with RS485 output give nitrogen, phosphorus and potassium in mg/kg. These sensors actually estimate from conductivity; they don't replace a lab analysis but are useful for tracking change in the same field. Wiring and Modbus code are in the NPK soil sensor guide.
- 10. Hydroponic nutrient monitoring (idea): The TDS of a nutrient solution falls as plants use up the nutrients and rises as water evaporates. For leafy greens such as lettuce a common range is about 0.8-1.2 mS/cm conductivity, roughly 400-600 ppm on 500-scale meters. For temperature-compensated measurement see the TDS sensor guide.
Livestock and beekeeping (11-13)
- 11. Automatic chicken coop door (idea): In the evening, when the light falls below a set level, the door closes, and in the morning it opens; the hens are safe from foxes and martens at night. Checking the motor current or an end-stop switch is a must in case the door jams on the way. Details are in the automatic chicken coop door guide.
- 12. Beehive scale (idea): Load cells under the hive and an HX711 measure the hive weight every hour. During a strong nectar flow a hive can gain several kilograms a day, while a sudden drop of 1-3 kg at once may signal a swarm. A slow decline over winter shows how much food the bees have left. Building the scale is covered in the HX711 load cell guide.
- 13. Barn and coop motion alarm: A PIR sensor sends a Telegram message to your phone when someone enters the coop or barn at night. So the animals themselves don't trigger it, mount the sensor at the door, out of their reach, with a narrow angle. Notification setup is in the ESP32 Telegram bot guide.
For remote fields: ESP-NOW and LoRa nodes (14-15)
- 14. Solar-powered field node (idea): The ESP32 wakes every 15 minutes, measures soil moisture and temperature, sends the reading over ESP-NOW to another ESP32 at home without needing a router, and goes back to sleep. It works up to 100-200 m in the open; the code is below.
- 15. LoRa field sensor (idea): If the field is miles from home, Wi-Fi and ESP-NOW won't do. LoRa modules with the SX1278 chip reach 5-10 km in open country and are ideal for small measurement packets of a few dozen bytes. Choosing a module and testing range are covered in the LoRa module guide.
ESP32 field node code: measure, send, sleep
The capacitive soil sensor's AOUT connects to GPIO 34 and the waterproof DS18B20's data wire to GPIO 4 (with 4.7 kΩ to 3V3). Connect the VCC of both sensors to GPIO 25; the code powers them only while measuring. To measure the battery voltage, divide the 18650 cell's positive terminal with two 100 kΩ resistors and connect the middle to GPIO 35. The packet structure uses the same types in the same order as the receiver code in the ESP-NOW guide; load that receiver onto the ESP32 at home and the readings land straight in the Serial Monitor.
1// ESP32 tarla düğümü: ölç, ESP-NOW ile gönder, 15 dk uyu / field node: measure, send over ESP-NOW, sleep 15 min
2#include <WiFi.h>
3#include <esp_now.h>
4#include <OneWire.h>
5#include <DallasTemperature.h>
6
7const int SOIL_PIN = 34; // kapasitif toprak sensörü (ADC1) / capacitive soil sensor (ADC1)
8const int SENSOR_POWER = 25; // sensörleri bu pinden besle / power the sensors from this pin
9const int DS_PIN = 4; // DS18B20 DATA, 4,7 kΩ pull-up ile 3V3'e / to 3V3 via 4.7 kΩ
10const int BAT_PIN = 35; // pil gerilimi, 100k/100k bölücü / battery voltage, 100k/100k divider
11const int RAW_DRY = 2900; // havada (12 bit) / in air (12-bit)
12const int RAW_WET = 1300; // suda (12 bit) / in water (12-bit)
13const uint64_t SLEEP_US = 15ULL * 60 * 1000000; // 15 dakika / 15 minutes
14
15// ESP-NOW yazısındaki alıcıyla aynı yerleşim / same layout as the receiver in the ESP-NOW post
16typedef struct __attribute__((packed)) {
17 uint8_t id; // düğüm numarası / node number
18 uint32_t counter; // uyanma sayacı / wake-up counter
19 float temperature; // toprak sıcaklığı °C / soil temperature °C
20 float moisture; // toprak nemi % / soil moisture %
21 bool frost; // don riski / frost risk
22 char text[16]; // pil gerilimi metni / battery voltage text
23} Packet;
24
25RTC_DATA_ATTR uint32_t wakeCount = 0; // derin uykuda silinmez / survives deep sleep
26uint8_t broadcastMac[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
27OneWire oneWire(DS_PIN);
28DallasTemperature ds(&oneWire);
29
30void setup() {
31 Serial.begin(115200);
32 wakeCount++;
33 pinMode(SENSOR_POWER, OUTPUT);
34 digitalWrite(SENSOR_POWER, HIGH);
35 delay(300); // sensörler otursun / let the sensors settle
36
37 ds.begin();
38 ds.requestTemperatures();
39 float temp = ds.getTempCByIndex(0);
40 long sum = 0;
41 for (int i = 0; i < 16; i++) sum += analogRead(SOIL_PIN);
42 int raw = sum / 16;
43 float bat = analogReadMilliVolts(BAT_PIN) * 2 / 1000.0; // bölücü yüzünden x2 / x2 for the divider
44 digitalWrite(SENSOR_POWER, LOW);
45
46 Packet p = {};
47 p.id = 1;
48 p.counter = wakeCount;
49 p.temperature = temp;
50 p.moisture = constrain(map(raw, RAW_DRY, RAW_WET, 0, 100), 0, 100);
51 p.frost = (temp != DEVICE_DISCONNECTED_C) && temp < 2.0; // 2 °C altı: uyarı / below 2 °C: warning
52 snprintf(p.text, sizeof(p.text), "bat %.2fV", bat);
53
54 WiFi.mode(WIFI_STA);
55 if (esp_now_init() == ESP_OK) {
56 esp_now_peer_info_t peer = {};
57 memcpy(peer.peer_addr, broadcastMac, 6);
58 peer.channel = 0; // geçerli kanal / current channel
59 peer.encrypt = false;
60 esp_now_add_peer(&peer);
61 esp_now_send(broadcastMac, (uint8_t *)&p, sizeof(p));
62 delay(50); // paketin çıkmasını bekle / let the packet go out
63 }
64 Serial.printf("#%u %.1f C %.0f %% %s\n", p.counter, p.temperature, p.moisture, p.text);
65
66 esp_sleep_enable_timer_wakeup(SLEEP_US);
67 esp_deep_sleep_start(); // loop() hiç çalışmaz / loop() never runs
68}
69
70void loop() {
71}The code doesn't use loop(): every wake-up is setup() running from the start. The wakeCount variable marked with RTC_DATA_ATTR lives in a small memory that survives deep sleep, so the receiver can spot missed packets from gaps in the counter. One wake-up, including the DS18B20's 12-bit conversion, takes about 1-1.5 seconds and draws around 100 mA on average. Waking every 15 minutes, that works out to an average current of about 0.17 mA. What really decides battery life, though, is the sleep current.
| Board | Sleep current | Average current | With a 2500 mAh 18650 |
|---|---|---|---|
| ESP32 DevKit (USB chip, AMS1117, power LED) | A few mA (usually 3-10 mA) | About 3-10 mA | About 10-30 days |
| Board with a low-quiescent regulator, or a bare ESP32 module | 10-150 µA | About 0.2-0.3 mA | Over a year in theory, a few months to a year in practice |
| Arduino Uno (even in sleep mode) | More than 20 mA | More than 20 mA | Only a few days |
The difference in the table shows that in battery projects the choice of board matters more than the code: the USB-serial chip, the AMS1117 regulator and the power LED on a DevKit draw milliamps even while the ESP32 sleeps. For a long-lived field node, choose a board with a low-quiescent regulator or put the module on your own board. If you want to add a solar panel, a 5-6 V, 1-2 W panel and a TP4056 charger module cover this consumption comfortably even in winter; the panel and battery calculation is detailed in the ESP32 solar panel guide, and you can work out battery life yourself with the battery life tool.
| Link | Approximate range in open country | Power use | When to choose it |
|---|---|---|---|
| Wi-Fi (ESP32) | 50-100 m to the router | High, connecting takes a few seconds | Greenhouse or garden close to the house, phone monitoring wanted |
| ESP-NOW (ESP32) | 100-200 m | Low, sending takes milliseconds | Battery sensors at the far end of the garden |
| nRF24L01+PA+LNA | A few hundred metres, about 1 km in good conditions | Medium | When an Arduino Uno needs a wireless link |
| LoRa (SX1278) | 5-10 km | Low | Fields, vineyards and pastures far from home |
| GSM (SIM800L) | As far as network coverage | High, peaks up to 2 A when transmitting | SMS from anywhere, in regions where the 2G network still works |
Common outdoor mistakes and fixes
| Symptom | Cause | Fix |
|---|---|---|
| The soil sensor corroded within weeks | Resistive (fork) sensor powered all the time | Use a capacitive sensor and power it only while measuring |
| Water droplets inside the box | Condensation from the day-night temperature swing | Drill a small vent hole at the bottom of the box, add silica gel, bring cables in from below |
| The pump runs non-stop | Sensor away from the root zone or cable broken | Bury the sensor at root depth 5-10 cm from the dripper, use the maximum run-time limit in the code |
| The board resets when the pump starts | Pump and board share one weak supply | Power the pump from a separate adapter, join the GNDs, add a 470-1000 µF capacitor to the board |
| Midday temperature shows 45 °C | DHT22 in direct sunlight | Put the sensor in the shade inside a ventilated white shield |
| ESP-NOW or LoRa range shorter than expected | Antenna near the ground or inside a metal box | Raise the antenna at least 1-2 m, use a plastic box instead of metal |
Some of these projects are ready-made in the BlueGrays app: you can build the Smart Irrigation Station, the ESP32 Temperature Logger, battery saving with Deep Sleep and the motion alarm with Telegram notifications step by step, each with a circuit diagram, parts list and commented code, and adapt them to your own garden.
Frequently asked questions
How do you build automatic irrigation with Arduino?
A soil moisture sensor is buried in the pot or root zone, the Arduino reads the moisture and, when it drops below your threshold, runs a pump or solenoid valve through a relay. Using two separate thresholds for on and off and giving the pump a maximum run time makes the system safe. If you choose a capacitive sensor, it won't corrode in the soil.
Is Arduino or ESP32 better for agriculture projects?
An Arduino is enough to control one spot close to a socket and a pump. If you want to monitor from your phone, set up several sensor points or run on batteries for months, the ESP32 is the better fit; it offers Wi-Fi, ESP-NOW and deep sleep. For remote fields a LoRa module can be added to either board.
How long does a soil moisture sensor last in the ground?
Fork-shaped resistive sensors that are powered all the time corrode within weeks to months because of electrolysis. Capacitive sensors last much longer because no metal touches the soil. Powering the sensor only while measuring and protecting its electronics from water extends the life of both types.
How long does a field sensor run on batteries?
An ESP32 node that wakes every 15 minutes and draws 10-150 µA in sleep can theoretically run for more than a year on a 2500 mAh 18650 cell. A standard ESP32 DevKit board, however, draws a few mA even in sleep and lasts only a few weeks on the same cell. Adding a small solar panel keeps the battery topped up.
How many kilometres does LoRa reach?
Cheap LoRa modules with the SX1278 chip and simple antennas usually reach 5-10 km in open country, 3-6 km in villages and suburbs and 1-3 km in dense cities. Raising the antennas and keeping a clear line of sight increases the range noticeably.
Can you measure soil pH with Arduino?
Yes, but a glass pH probe is never pushed straight into the soil. You mix the soil with distilled water, let it stand and then measure the pH of the liquid with a calibrated pH module. Cheap two-pronged pH meters pushed directly into soil don't give reliable results.
Projects to build after reading this
See all projects
Smart Irrigation Station
A gardener that waters your plants on its own, so they don't dry out while you're on vacation.

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.

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.

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.

ESP32 Deep Sleep — Battery Saving (OLED + RTC RAM Counter)
The ESP32's Deep Sleep mode shuts down the CPU and most peripherals, cutting current draw to about 10µA, which is vital for battery-powered IoT devices. This project uses three wake-up sources: a timer (15 s), an external pin (EXT0, the button on GPIO 33) and a touch pin (T0/GPIO 4). Counters marked with RTC_DATA_ATTR survive deep sleep.

ESP32 Motion Alarm System (PIR + Buzzer + LED + Telegram)
A smart security alarm: when the PIR sensor detects motion, it sounds the buzzer, lights the LED and sends the owner an instant Telegram notification. A 30-second cooldown limits how often the alarm repeats; it does not filter out the PIR sensor's false detections. Use it at home, in a garage, a storeroom or a study.

ESP32 HTTPClient + Weather API (with SSD1306 OLED Display)
In this project the ESP32 makes a REST API call over the internet to a weather API (wttr.in) using HTTPClient.h. Unlike the I2C LCD version, it uses an SSD1306 OLED (128×64) display, with large text and vector icons for a richer look. Seven weather icons (sunny, rainy, snowy and more) are drawn on the fly, with no bitmap files.
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

