ESP32 IoT Projects: 15 Ideas With MQTT, Home Assistant & Cloud
15 ESP32 IoT projects: MQTT, Home Assistant, ThingSpeak, Telegram, Google Sheets and Firebase compared, with the board, sensors, libraries and code for each.
ESP32 IoT projects use the ESP32's built-in Wi-Fi to move a sensor reading onto your home network or the internet, and to switch a relay on and off from your phone. The board is the same in every project; what really sets them apart is where the data goes: to Home Assistant, to a charting service, to a spreadsheet, or straight to your phone as a Telegram message? Picking the wrong platform means rewriting your code two weeks later. That is why this guide first compares which cloud or protocol fits which job, then lists 15 projects from easy to advanced, each with its board, sensors and libraries.
For every project you will find which sensor goes on which pin, which library to install and where people usually get stuck. There are also two complete sketches: a sensor that can run for months on a battery and sends its readings to ThingSpeak, and an MQTT skeleton that recovers by itself when Wi-Fi or the broker drops out. That skeleton works as a starting point for almost every smart home project on the list. If the ESP32 is new to you, read What is the ESP32 first.

Which cloud and which protocol for ESP32 IoT?
In IoT projects data takes one of four routes. With local solutions the ESP32 serves its own web page and everything stays on your home network; it keeps working when the internet is down, but reaching it from outside needs extra setup. With broker-based solutions (MQTT) the ESP32 drops small messages on a server in your home and Home Assistant turns them into automations. With cloud services (ThingSpeak, Google Sheets, Firebase) the data is stored on a server on the internet and the charts can be viewed from anywhere. With messaging solutions (Telegram) the goal is not to store data but to alert you the moment something happens. The table below sums up which one suits which project.
| Platform / protocol | Best for | Strength | Watch out | Library |
|---|---|---|---|---|
| Local web server (HTTP, WebSocket) | Phone control panel on the home network | No account or internet needed, very low latency | Remote access needs a VPN or port forwarding | ESPAsyncWebServer, WebServer |
| MQTT + Home Assistant | Smart home, automations, many devices | Lightweight, two-way, works without internet | Needs a broker (Mosquitto) and an always-on server | PubSubClient |
| ESPHome | Home Assistant device without writing code | Sensors and relays in minutes with YAML | Of little use outside Home Assistant | None (ESPHome compiles) |
| ThingSpeak | Sensor charts, long-term logging | Ready-made chart as soon as you create a channel | At least 15 s between updates on the entry-level account | HTTPClient |
| Google Sheets | Writing readings to a sheet, exporting to Excel | Familiar spreadsheet, easy to share and chart | Apps Script redirect; not meant for several writes per second | HTTPClient, WiFiClientSecure |
| Firebase Realtime Database | Your own mobile or web app | Changes reach every client instantly | Security rules and authentication are a must | Firebase ESP Client |
| Telegram bot | Alarms, notifications, control by command | Set up in 5 minutes, messages hit your phone instantly | Not meant for continuous data logging | UniversalTelegramBot |
| Blynk / Arduino IoT Cloud | Dashboard in a ready-made phone app | Drag-and-drop interface | Plan limits and dependence on the service | Blynk, ArduinoIoTCloud |
| Alexa / Google Home | Voice control of lights and plugs | Everyone in the house can use it | Google Home needs a bridge service | Espalexa, SinricPro |
| ESP-NOW | Sensor network without a router, remote spots | No access point needed, very fast and frugal | Needs a gateway ESP32 to reach the internet | esp_now (built into the core) |
What every ESP32 IoT project has in common
- Board: a classic ESP32 DevKit (WROOM-32) is enough for every project on this list. For a battery-powered sensor choose a board with a low-quiescent regulator; check the pinout tool for the pin layout.
- 2.4 GHz Wi-Fi only: the ESP32 cannot see 5 GHz networks. If your router broadcasts both bands under one name and the connection is flaky, give the 2.4 GHz band its own network name.
- Analog sensors on ADC1: with Wi-Fi on, the ADC2 pins (GPIO 0, 2, 4, 12–15, 25–27) cannot take analog readings. Wire soil moisture or gas sensors to a pin between GPIO 32 and 39.
- No 5 V signals: ESP32 pins run at 3.3 V. Bring down the output of 5 V sensors such as the HC-SR04 with a voltage divider.
- Secrets at the top: keep the Wi-Fi password, API key and bot token as constants at the top of the sketch and strip them before you share the code.
- millis() instead of delay(): in IoT code loop() must never block; long delay() calls make MQTT and web server connections drop (millis vs delay).
15 ESP32 IoT projects in one table
| # | Project | Sensors and parts | Platform | Library | Level |
|---|---|---|---|---|---|
| 1 | Temperature and humidity on a web page | DHT22 | Local web server | ESPAsyncWebServer, DHT | Easy |
| 2 | Relay panel on your phone | 2-channel relay module | WebSocket | ESPAsyncWebServer | Easy |
| 3 | Weather display from the internet | 0.96 inch OLED | HTTP API | HTTPClient, ArduinoJson | Medium |
| 4 | ThingSpeak weather station | DHT22 or BME280 | ThingSpeak | HTTPClient | Easy |
| 5 | Google Sheets data logger | DHT22, soil moisture sensor | Google Sheets | HTTPClient | Medium |
| 6 | Remote LED and button with Firebase | LED, push button | Firebase | Firebase ESP Client | Medium |
| 7 | Telegram motion alarm | HC-SR501 PIR, buzzer | Telegram | UniversalTelegramBot | Medium |
| 8 | Camera that sends photos to Telegram | ESP32-CAM, PIR | Telegram | esp_camera, WiFiClientSecure | Hard |
| 9 | Home Assistant temperature sensor and relay | DHT22, relay module | MQTT | PubSubClient | Medium |
| 10 | No-code presence sensor | LD2410 mmWave radar | ESPHome | ESPHome (YAML) | Easy |
| 11 | Energy monitoring | PZEM-004T v3 | MQTT, Home Assistant | PZEM004Tv30, PubSubClient | Hard |
| 12 | Voice-controlled lamp with Alexa | Relay or WS2812B strip | Alexa (local) | Espalexa | Medium |
| 13 | Automatic plant watering | Capacitive soil moisture sensor, relay, mini pump | MQTT or Blynk | PubSubClient | Medium |
| 14 | ESP-NOW sensor network with gateway | At least 2 ESP32 boards, DHT22 | ESP-NOW + MQTT | esp_now, PubSubClient | Hard |
| 15 | Battery-powered deep sleep sensor | DHT22, 18650 cell, TP4056 | ThingSpeak or MQTT | HTTPClient | Medium |
Projects that run on your home network (1–3)
Project 1 is the gentlest way into IoT: the ESP32 shows the temperature and humidity it reads from a DHT22 on a web page it serves itself, and any phone on the same network sees the values by typing the board's IP address into the browser. No account, cloud or app is needed; the page simply refreshes itself every few seconds. The full setup is in ESP32 DHT22 web server. Project 2 adds buttons to the same server: tap a button on the page and the relay clicks instantly, while its state updates at the same moment on every phone that has the page open. WebSocket makes this possible by opening two-way communication without reloading the page (ESP32 WebSocket). If the relay will switch mains voltage, read the safety rules in the relay module guide first.
In Project 3 the ESP32 pulls data from the internet for the first time: it sends an HTTP request to a weather service, parses the JSON reply with ArduinoJson and shows temperature, humidity and conditions on an OLED display. The steps you learn here, sending the request and parsing the JSON, are the same for any online data, from exchange rates to bus departure times. The details are in ESP32 weather API; to put the time on the screen as well, see the ESP32 NTP clock guide.
Charts and logging in the cloud: ThingSpeak, Google Sheets, Firebase (4–6)
For Project 4 all you need is a ThingSpeak account and a channel. Each channel has eight fields, and every field automatically becomes a time chart. The entry-level personal account gives you about 3 million messages a year and four channels, and you must wait at least 15 seconds between two updates. Send more often and ThingSpeak rejects the entry and answers with 0. The sketch below turns this project into a battery-powered sensor (Project 15): the ESP32 wakes up, joins Wi-Fi, sends the reading and goes back to deep sleep for ten minutes.
1// ESP32 + DHT22: ThingSpeak'e ölçüm gönder, sonra derin uykuya geç
2// ESP32 + DHT22: send a reading to ThingSpeak, then go to deep sleep
3#include <WiFi.h>
4#include <HTTPClient.h>
5#include <DHT.h>
6
7const char* WIFI_SSID = "WIFI_ADIN"; // Wi-Fi adı / Wi-Fi name
8const char* WIFI_PASS = "WIFI_SIFRESI"; // Wi-Fi şifresi / Wi-Fi password
9const char* TS_WRITE_KEY = "WRITE_API_KEY"; // kanalın Write API Key'i / channel Write API Key
10
11#define DHT_PIN 4 // DHT22 veri pini / DHT22 data pin
12#define SLEEP_MINUTES 10 // iki ölçüm arası süre / time between readings
13
14DHT dht(DHT_PIN, DHT22);
15RTC_DATA_ATTR uint32_t bootCount = 0; // RTC belleğinde, uykuda silinmez / kept in RTC memory during sleep
16
17void goToSleep() {
18 WiFi.disconnect(true);
19 WiFi.mode(WIFI_OFF);
20 esp_sleep_enable_timer_wakeup((uint64_t)SLEEP_MINUTES * 60ULL * 1000000ULL); // mikrosaniye / microseconds
21 esp_deep_sleep_start();
22}
23
24void setup() {
25 Serial.begin(115200);
26 bootCount++;
27 dht.begin();
28
29 WiFi.mode(WIFI_STA);
30 WiFi.begin(WIFI_SSID, WIFI_PASS);
31 unsigned long start = millis();
32 while (WiFi.status() != WL_CONNECTED) {
33 if (millis() - start > 15000) goToSleep(); // 15 s'de bağlanamazsa pili harcama / give up after 15 s
34 delay(250);
35 }
36
37 float t = dht.readTemperature();
38 float h = dht.readHumidity();
39 if (!isnan(t) && !isnan(h)) {
40 String url = String("http://api.thingspeak.com/update?api_key=") + TS_WRITE_KEY +
41 "&field1=" + String(t, 1) + "&field2=" + String(h, 0) +
42 "&field3=" + String(WiFi.RSSI()) + "&field4=" + String(bootCount);
43 HTTPClient http;
44 http.begin(url);
45 int code = http.GET(); // başarılıysa 200 / 200 on success
46 String reply = http.getString(); // kayıt numarası; "0" ise reddedildi / entry id, "0" = rejected
47 Serial.printf("HTTP %d, kayit / entry: %s\n", code, reply.c_str());
48 http.end();
49 }
50 goToSleep();
51}
52
53void loop() {
54 // buraya hiç gelinmez: her uyanış setup()'tan başlar / never reached: every wake-up restarts at setup()
55}The sketch does everything inside setup(), because an ESP32 waking from deep sleep starts from scratch and never reaches loop(). bootCount, marked with RTC_DATA_ATTR, lives in RTC memory, which is not erased during sleep. Since it goes into the fourth field, the chart shows how many times the board has woken up, while the third field shows the Wi-Fi signal strength (RSSI); a signal weaker than -75 dBm stretches the connection time and drains the battery faster. If Wi-Fi does not connect within 15 seconds, the board goes back to sleep without sending anything to save power. Copy the Write API Key from the channel's API Keys tab; the read key cannot write.
Project 5 writes readings row by row into a Google Sheets spreadsheet. An Apps Script web app sits in between: the ESP32 sends it an HTTPS request and the script appends the values with a timestamp in a new row. You can chart the data straight away, export it to Excel or share it with your teacher; the steps are in ESP32 Google Sheets. Project 6 uses Firebase Realtime Database: the ESP32 writes the state of a button to the database and reads the state of an LED from it. The moment a value changes, both the ESP32 and the connected mobile or web app see it, which makes Firebase the right choice when you want to build your own app (ESP32 Firebase).
Notifications on your phone: Telegram projects (7–8)
Project 7 is one of the most built projects on the list: when the HC-SR501 PIR detects motion, the buzzer sounds and a Telegram message lands on your phone. You create a bot with BotFather in Telegram, put the token you receive and your own chat ID in the code, and the ESP32 sends the message over a secure connection with the UniversalTelegramBot library. The same bot works the other way too: adding commands such as /status, which replies with the temperature, or /on, which switches the relay, takes just a few lines (ESP32 Telegram bot). For the PIR's sensitivity and time settings see the PIR motion sensor guide. Project 8 takes the alarm one step further: when motion is detected the ESP32-CAM takes a photo and sends it straight to the Telegram chat (ESP32-CAM photos to Telegram). The ESP32-CAM's most common problem is a weak power supply; use a 5 V source that can deliver at least 2 A.
Smart home: MQTT, Home Assistant and ESPHome (9–12)
With MQTT, devices do not connect to each other directly; they all connect to a server called a broker. The ESP32 publishes its readings to a topic, Home Assistant subscribes to that topic and receives the value, and the relay command travels the other way on a different topic. Once you install the Mosquitto add-on in Home Assistant, the broker is ready. Two settings matter most: a message sent with the retain flag is stored by the broker and delivered immediately to every client that connects later. The Last Will message, on the other hand, is left by the ESP32 when it connects; if the connection drops unexpectedly, the broker publishes it itself and Home Assistant knows the device is offline.
| Part | ESP32 pin | Note |
|---|---|---|
| DHT22 data (DATA) | GPIO 4 | If the module has no 10 kΩ pull-up, add one between DATA and 3V3 |
| DHT22 VCC / GND | 3V3 / GND | Works fine at 3.3 V |
| Relay module IN | GPIO 26 | For low-level trigger modules set RELAY_ON to LOW |
| Relay module VCC / GND | VIN (5 V) / GND | The relay coil needs 5 V; all grounds must be common |
1// ESP32 IoT iskeleti: Wi-Fi + MQTT, kopunca kendiliğinden bağlanır
2// ESP32 IoT skeleton: Wi-Fi + MQTT that reconnects on its own
3#include <WiFi.h>
4#include <PubSubClient.h>
5#include <DHT.h>
6
7const char* WIFI_SSID = "WIFI_ADIN";
8const char* WIFI_PASS = "WIFI_SIFRESI";
9const char* MQTT_HOST = "192.168.1.50"; // broker (Home Assistant / Mosquitto) IP'si / broker IP
10const char* MQTT_USER = "mqtt_kullanici"; // broker kullanıcı adı / broker user
11const char* MQTT_PASS = "mqtt_sifresi";
12
13#define DHT_PIN 4
14#define RELAY_PIN 26
15#define RELAY_ON HIGH // düşük tetiklemeli modülde LOW yap / use LOW for low-trigger modules
16
17const char* T_STATE = "bluegrays/salon/state"; // ölçümler (JSON) / readings (JSON)
18const char* T_SET = "bluegrays/salon/relay/set"; // gelen komut / incoming command
19const char* T_RELAY = "bluegrays/salon/relay"; // röle durumu / relay state
20const char* T_ONLINE = "bluegrays/salon/online"; // çevrim içi mi? / online?
21
22WiFiClient net;
23PubSubClient mqtt(net);
24DHT dht(DHT_PIN, DHT22);
25unsigned long lastTry = 0, lastSend = 0;
26
27void onMessage(char* topic, byte* payload, unsigned int len) {
28 String msg;
29 for (unsigned int i = 0; i < len; i++) msg += (char)payload[i];
30 if (strcmp(topic, T_SET) == 0) {
31 bool on = (msg == "ON");
32 digitalWrite(RELAY_PIN, on ? RELAY_ON : !RELAY_ON);
33 mqtt.publish(T_RELAY, on ? "ON" : "OFF", true); // retain: yeni gelen de son durumu görür / retained
34 }
35}
36
37bool connectMqtt() {
38 // son vasiyet (LWT): bağlantı koparsa broker "0" yayınlar / last will: broker publishes "0" if we drop
39 if (!mqtt.connect("bg-salon", MQTT_USER, MQTT_PASS, T_ONLINE, 1, true, "0")) return false;
40 mqtt.publish(T_ONLINE, "1", true);
41 mqtt.subscribe(T_SET);
42 return true;
43}
44
45void setup() {
46 Serial.begin(115200);
47 pinMode(RELAY_PIN, OUTPUT);
48 digitalWrite(RELAY_PIN, !RELAY_ON);
49 dht.begin();
50 WiFi.mode(WIFI_STA);
51 WiFi.setAutoReconnect(true); // Wi-Fi koparsa yeniden bağlan / reconnect Wi-Fi on drop
52 WiFi.begin(WIFI_SSID, WIFI_PASS);
53 mqtt.setServer(MQTT_HOST, 1883);
54 mqtt.setCallback(onMessage);
55 mqtt.setBufferSize(512); // varsayılan 256 bayt uzun JSON'a yetmez / 256 B default is too small
56}
57
58void loop() {
59 if (WiFi.status() != WL_CONNECTED) return; // Wi-Fi gelene kadar bekle / wait for Wi-Fi
60 if (!mqtt.connected()) {
61 if (millis() - lastTry > 5000) { // 5 s'de bir dene, loop'u kilitleme / retry every 5 s, never block
62 lastTry = millis();
63 Serial.println(connectMqtt() ? "MQTT tamam / ok" : "MQTT hata / error");
64 }
65 return;
66 }
67 mqtt.loop(); // gelen mesajları işler / handles incoming messages
68
69 if (millis() - lastSend > 30000) { // 30 s'de bir ölçüm / a reading every 30 s
70 lastSend = millis();
71 float t = dht.readTemperature();
72 float h = dht.readHumidity();
73 if (isnan(t) || isnan(h)) return;
74 char json[64];
75 snprintf(json, sizeof(json), "{\"t\":%.1f,\"h\":%.0f,\"rssi\":%d}", t, h, (int)WiFi.RSSI());
76 mqtt.publish(T_STATE, json);
77 }
78}The most important feature of this sketch is that it never waits. If it cannot reach the broker, it retries every five seconds instead of getting stuck in a while loop; meanwhile loop() keeps running, so buttons and other tasks still work. When Wi-Fi drops, setAutoReconnect restores the connection by itself. The setBufferSize(512) line is needed too: by default PubSubClient works with 256-byte packets, and when a long JSON such as a Home Assistant discovery message goes over that limit, publish() silently returns false. To test the relay, send ON or OFF to the bluegrays/salon/relay/set topic from Home Assistant's MQTT settings or from a client such as MQTT Explorer. The discovery messages that make the device appear in Home Assistant on its own, and the Mosquitto installation, are covered step by step in the ESP32 MQTT and Home Assistant guide.
In Project 10 you do not write a single line of C++: in ESPHome you describe the LD2410 mmWave radar in a few lines of YAML, ESPHome compiles the firmware and flashes the ESP32, and the sensor shows up in Home Assistant by itself. Unlike a PIR, the LD2410 also detects a person sitting still, so the lights do not switch off while you watch TV (ESPHome setup, LD2410 presence sensor). In Project 11 the PZEM-004T v3 module measures voltage, current, power and energy used; the ESP32 sends these values over MQTT to Home Assistant's Energy dashboard, and you can trigger an alert when consumption passes a set power. This project works with mains voltage, so follow the wiring and insulation warnings in the PZEM-004T energy meter guide to the letter. In Project 12 the Espalexa library introduces the ESP32 to Alexa as a Philips Hue bulb; say "Alexa, turn on the desk lamp" and the relay clicks. Doing the same with Google Home needs a bridge service such as SinricPro (ESP32 with Alexa and Google Home).
Garden, batteries and sensor networks (13–15)
Project 13 waters a plant pot or a small garden bed on its own: when the capacitive soil moisture sensor drops below the threshold you set, the relay runs the mini pump for a few seconds, while the moisture value and watering count go to Home Assistant over MQTT or to a phone dashboard with Blynk. Connect the sensor to an ADC1 pin (for example GPIO 34) and power the pump from a separate supply, not from the ESP32 (ESP32 automatic plant watering, ESP32 Blynk). In Project 14 sensors beyond the router's range talk over ESP-NOW: ESP32 boards in the garden or the attic send up to 250 bytes per packet straight to an ESP32 acting as a gateway, and the gateway forwards them to MQTT over Wi-Fi. The most common mistake here is a channel mismatch: the gateway runs on the router's channel, so the sensors must transmit on the same Wi-Fi channel (ESP-NOW).
Project 15 is the 18650-powered version of the ThingSpeak sketch above. The math is simple: if the ESP32 stays awake for about 5 seconds every ten minutes drawing 120 mA on average and uses 10 µA asleep, the average current is about 1 mA, and on paper a 2500 mAh cell lasts more than 100 days. An ordinary DevKit with an AMS1117 regulator and a USB-serial chip, however, draws around 5 mA even while asleep, and the same cell drops to about 17 days. Charge the cell with a TP4056 module; the details of the sleep modes are in the ESP32 deep sleep guide.
Which project should you start with?
| Your situation | Start with | Then move to |
|---|---|---|
| I am using Wi-Fi for the first time | Project 1 (temperature on a web page) | Projects 2 and 3 |
| I want to see charts of my data | Project 4 (ThingSpeak) | Projects 5 and 15 |
| I run Home Assistant at home | Project 10 (ESPHome) | Projects 9 and 11 |
| I want an alert when something happens | Project 7 (Telegram alarm) | Project 8 |
| I am building my own app | Project 6 (Firebase) | Project 9 |
| Some spots are out of router range | Project 14 (ESP-NOW) | Project 15 |
Common mistakes in ESP32 IoT projects and how to fix them
- The board will not join Wi-Fi: the network is 5 GHz, the password is wrong or the signal is weak. Broadcast the 2.4 GHz band under its own name and check the RSSI; every cause is covered in ESP32 not connecting to Wi-Fi.
- The board resets when Wi-Fi starts: while connecting, Wi-Fi draws short current spikes above 300 mA; a poor USB cable or supply causes the "Brownout detector" error (brownout and Guru Meditation).
- The analog sensor gives nonsense values: it is wired to an ADC2 pin; with Wi-Fi on, use GPIO 32–39.
- The MQTT connection keeps dropping: two devices share the same client ID, or there is a long delay() inside loop(). Give every device its own ID and call mqtt.loop() often.
- publish() returns false: the message is longer than PubSubClient's 256-byte buffer; enlarge it with setBufferSize().
- Some readings are missing in ThingSpeak: you are sending more often than every 15 seconds; in the Serial Monitor you can see that rejected requests answer 0.
- No data reaches Google Sheets: the Apps Script reply is a redirect (302); if you have not enabled redirect following with setFollowRedirects in HTTPClient, the request is lost. Also remember to redeploy the script as a new version every time you change it.
- I cannot reach it from outside my home: a local web server is only visible on the home network. Instead of opening ports on your router, prefer Home Assistant's remote access, a VPN or a method that goes through the cloud, such as Telegram.
You can use these 15 projects as a roadmap: first get to know Wi-Fi with a local web page, then move your data to the cloud with ThingSpeak or Google Sheets, and finally connect your home to automations with MQTT and Home Assistant. In the BlueGrays app you will find projects such as the ESP32 web server, the NTP clock, the weather display, the motion alarm with Telegram notifications and smart watering, step by step with circuit diagrams, parts lists and ready-to-use code.
Frequently asked questions
What IoT projects can you build with an ESP32?
The most popular ESP32 IoT projects are temperature and humidity logging, relay control from a phone, Telegram alerts when motion is detected, energy monitoring, automatic plant watering and smart home devices connected to Home Assistant. Thanks to built-in Wi-Fi and Bluetooth it joins a network without extra modules, and with deep sleep it can run for months on a battery.
Should I use MQTT or HTTP for an ESP32 IoT project?
MQTT is the better fit for devices that are always on and also receive commands: the connection stays open, messages are small and flow both ways. For a sensor that sends a reading now and then and goes back to sleep, or for services such as ThingSpeak and Google Sheets, HTTP is simpler.
How do I connect an ESP32 to Home Assistant?
The easiest way is ESPHome: you describe your sensors in a YAML file and the device appears in Home Assistant by itself. If you would rather write the Arduino code yourself, install the Mosquitto broker in Home Assistant, send MQTT messages from the ESP32 with PubSubClient and announce the device with discovery messages.
Is the ESP32 or the ESP8266 better for IoT?
For new projects the ESP32 is the better choice: it has two cores, more RAM, more analog inputs and Bluetooth. The ESP8266 is still fine for a single sensor or relay, but its memory struggles with HTTPS connections and large JSON responses.
How long does an ESP32 last on a battery?
An ESP32 that stays connected to Wi-Fi draws around 100 mA on average, so a 2500 mAh cell lasts roughly a day. A sensor that uses deep sleep and wakes for a few seconds every ten minutes can run for months on a low-power board, while the regulator on an ordinary DevKit cuts that down to a few weeks.
Can you build an ESP32 IoT project without internet?
Yes. The ESP32 can open its own access point and serve a web page your phone connects to directly, and with ESP-NOW it can talk to other ESP32 boards without a router. Because Home Assistant and Mosquitto run on your home network, automations keep working even when the internet goes down.
Projects to build after reading this
See all projects
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 Asynchronous Web Server (with IP Display on LCD)
In this project, we’re turning the ESP32 into an asynchronous web server that you can control from your phone or computer on the same Wi-Fi network. Thanks to the ESPAsyncWebServer library, the server can process multiple requests simultaneously (unlike the classic WebServer.h, which blocks on a single request). You’ll be able to open the ESP32’s IP address in a browser and click the ON/OFF buttons (the /on and /off routes) to turn the LED connected to GPIO 5 on and off.

ESP32 WebSocket Counter (2 Buttons + LCD + Real-Time Web)
In this project, two buttons wired to the ESP32 (GPIO 5 counts up, GPIO 4 counts down) change a counter. The value updates instantly both on a 16x2 I2C LCD and, through the WebSocket support of ESPAsyncWebServer, in every connected browser without reloading the page. Instead of HTTP polling a single persistent connection is used, and the ESP32 sends the new value to everyone with ws.textAll().

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 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.

Real-Time Clock from the Internet via ESP32 NTP
The ESP32 connects to Wi-Fi and fetches the real time from NTP (Network Time Protocol) servers with millisecond precision. configTzTime() applies the Turkey time zone (TRT, UTC+3) automatically, and in countries with daylight saving time the DST switch is handled by a POSIX TZ string. The time is printed both to the Serial Monitor and to an optional I2C LCD.

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.
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

