GET /api → {"t":26,"h":52}Tap a part to see what it does.
Tap the parts to see what each one does. A teaching simulation, not a circuit simulator.
Build it step by step
0 of 5 donePlace the ESP32 and DHT22
ESP32 across the centre gap, DHT22 with its grille facing you.
Power the sensor
VCC to 3V3, GND to GND.
Data and pull-up
DATA to GPIO4 and a 10 kΩ resistor from DATA to 3V3 (skip it on a 3-pin module that has one).
Add your Wi-Fi
Put your 2.4 GHz network name and password in the code.
Upload and open the page
Upload, read the address in the serial monitor at 115200 baud, open it on your phone.
How do you build an ESP32 web dashboard?
An ESP32 reads a DHT22 and serves a live temperature and humidity page to any phone on your Wi-Fi. You need ESP32 DevKit V1, DHT22 Sensor, Resistor 10 kΩ and Breadboard 830 Tie Points. It takes 5 steps and about 60 minutes.
- Level
- Intermediate
- Time
- About 60 min
- Parts
- 4
Parts list
- Development BoardsBuyESP32 DevKit V1 × 1
- SensorsBuyDHT22 Sensor × 1
- PassivesBuyResistor 10 kΩ × 1
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| DHT22 VCC | ESP32 3V3 | Power |
| DHT22 GND | ESP32 GND | Ground |
| DHT22 DATA | ESP32 GPIO4 | Data |
| 10 kΩ resistor | Between DATA and 3V3 | Pull-up (skip if your module has one) |
Code
Arduino IDE with the ESP32 board package. Install "DHT sensor library" by Adafruit (and "Adafruit Unified Sensor"). The ESP32 needs a 2.4 GHz network. The page is only reachable on your own network.
Runs on a virtual ESP32 Dev Module in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
#include <WiFi.h>
#include <WebServer.h>
#include <DHT.h>
const char* SSID = "your-wifi";
const char* PASS = "your-password";
DHT dht(4, DHT22);
WebServer server(80);
float t = NAN, h = NAN;
unsigned long last = 0;
void page() {
String s = "<!doctype html><meta name=viewport content='width=device-width'><meta http-equiv=refresh content=5>";
s += "<h1>Room</h1><p style='font-size:2em'>" + String(t, 1) + " °C<br>" + String(h, 0) + " %RH</p>";
server.send(200, "text/html", s);
}
void json() {
server.send(200, "application/json", "{\"t\":" + String(t, 1) + ",\"h\":" + String(h, 0) + "}");
}
void setup() {
Serial.begin(115200);
dht.begin();
WiFi.begin(SSID, PASS);
while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print('.'); }
Serial.print("\nOpen http://"); Serial.println(WiFi.localIP());
server.on("/", page);
server.on("/api", json);
server.begin();
}
void loop() {
server.handleClient();
if (millis() - last > 2500) { // DHT22 needs 2 s between reads
last = millis();
float nt = dht.readTemperature(), nh = dht.readHumidity();
if (!isnan(nt) && !isnan(nh)) { t = nt; h = nh; }
}
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual ESP32 Dev Module with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
.... Open http://192.168.1.42
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Serial after boot | Dots, then "Open http://192.168.x.x" |
| Page on phone | Temperature and humidity, refreshing every 5 s |
| /api | JSON like {"t":24.6,"h":52} |
If it does not work
Stuck printing dots
Wrong password or a 5 GHz-only network.
Values show nan
Check DATA is on GPIO4 and the pull-up is fitted, and wait 2 s between reads.
Phone cannot open the page
Phone and ESP32 must be on the same Wi-Fi; guest networks often block devices.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the ESP32 web dashboard?
ESP32 DevKit V1, DHT22 Sensor, Resistor 10 kΩ and Breadboard 830 Tie Points.
How long does the ESP32 web dashboard take to build?
About 60 minutes for a intermediate maker, in 5 steps.
How do I know the ESP32 web dashboard works?
Serial after boot: Dots, then "Open http://192.168.x.x". Page on phone: Temperature and humidity, refreshing every 5 s. /api: JSON like {"t":24.6,"h":52}.
Stuck printing dots: what should I check?
Wrong password or a 5 GHz-only network.
Values show nan: what should I check?
Check DATA is on GPIO4 and the pull-up is fitted, and wait 2 s between reads.
Phone cannot open the page: what should I check?
Phone and ESP32 must be on the same Wi-Fi; guest networks often block devices.
