Weekend build: an ESP32 temperature and humidity monitor with a web dashboard
For about the price of a couple of coffees you can build a little sensor that lives in a room, measures temperature and humidity, and serves a live web page any phone or laptop on your Wi-Fi can open. No soldering, no C code — a two-part parts list and a config file you can copy. This is the whole build, start to finish, including the parts most tutorials skip: which sensor is actually worth buying, and the honest limits of a $10 monitor.
What you're building
The finished device is a matchbox-sized board plugged into a USB charger, sitting wherever you want a reading: a nursery, a greenhouse, a wine cupboard, a home office that gets stuffy by mid-afternoon. It joins your Wi-Fi and hosts a small web dashboard. Type its address into a browser and you see the current temperature and humidity, updating live, from any device in the house.
There's no cloud account, no app to install, and no subscription — the readings never leave your network unless you decide to send them somewhere. The board is an ESP32; the brains are a free, open-source firmware called ESPHome that turns "read a sensor and put it on a web page" from a weekend of coding into a dozen lines of configuration. If you later want history graphs, phone alerts, or automations ("turn on the fan when the office passes 26 °C"), the same device drops straight into Home Assistant with no rewiring. But you don't need any of that to start — the standalone web dashboard is step one, and it's genuinely useful on its own.
The parts: a board and a sensor
You need exactly two things plus a USB cable, and the total lands around $20.
The board — an ESP32. "ESP32" is a family of cheap Wi-Fi microcontrollers from Espressif. Any of them works here; a good default in 2026 is an ESP32-C3 dev board, a single-core RISC-V chip running at up to 160 MHz with Wi-Fi and Bluetooth LE built in and around 22 usable GPIO pins[1]. Adafruit's ESP32-C3 dev board is $9.95 and has a USB port you plug straight into your computer to flash it[2]. Any similarly-priced ESP32 board from a reputable seller is fine — the exact model barely matters for this project.
The sensor. This is the one real decision, and it's worth thirty seconds of thought because it sets the accuracy of everything downstream.
- DHT22 (also sold as AM2302) — the classic beginner sensor. It's cheap, everywhere, and communicates over a single wire. Adafruit sells the bare sensor for $9.95, rated for 0–100% humidity at 2–5% accuracy and −40 to 80 °C at ±0.5 °C[3]. Its catch: it only produces a fresh reading about once every two seconds[3], and it needs a pull-up resistor on the data line (about 4.7 kΩ, though 1–10 kΩ is fine) unless you buy a module with one already fitted[4].
- SHT41 (Sensirion SHT4x family) — a noticeably better sensor for a couple of dollars more. Sensirion quotes a typical accuracy of ±0.2 °C and ±1.8% RH, it runs from 1.08–3.6 V, and it talks over I²C — the same two-wire bus most hobby sensors use[5]. It comes factory-calibrated, so readings are trustworthy out of the box.
Our recommendation: buy the SHT41 on a small breakout board. The accuracy gap is real — ±0.2 °C versus ±0.5 °C is the difference between "I trust this number" and "roughly" — and the I²C wiring is cleaner. If you already have a DHT22 in a drawer, use it; this project works fine with either, and we'll cover both.
Wiring it up
Both sensors need three connections plus, for I²C, one more. Most breakout boards have labelled pins, and you can use pre-crimped jumper wires — no soldering if you buy a board with header sockets.
For the SHT41 (I²C): connect the sensor's VIN/VCC to the board's 3.3 V pin, GND to GND, SDA to the board's SDA pin, and SCL to SCL. On a classic ESP32 those default to GPIO21 (SDA) and GPIO22 (SCL); on the C3 and other boards the pins are usually silk-screened, and you can assign any spare GPIOs in the config[6]. I²C breakout boards almost always include the required pull-up resistors already, so there's nothing extra to add.
For the DHT22 (one-wire): connect +/VCC to 3.3 V, −/GND to GND, and the DATA/OUT pin to any spare GPIO — GPIO4 is a common choice[4]. Add the ~4.7 kΩ pull-up resistor between DATA and 3.3 V if your sensor is the bare three-pin kind; skip it on modules that already have one[7].
That's the entire hardware build. Plug the board into your computer with a USB cable and move to the software.
The software: ESPHome, not C code
You could write Arduino C++ to read the sensor and run a web server, and plenty of tutorials do. We're going to skip that entirely and use ESPHome, which lets you describe the device in a short YAML config file and generates the firmware for you. It runs on Windows, macOS and Linux, and the first flash happens over USB; every update after that can happen wirelessly over your network[8].
Install it (the command-line route is pip install esphome), then create a config. Here's a complete, working example for the SHT41 — this is the whole program:
esphome:
name: room-monitor
esp32:
board: esp32-c3-devkitm-1
wifi:
ssid: "YourNetwork"
password: "YourWiFiPassword"
# Two-wire I2C bus for the SHT41
i2c:
sda: GPIO8
scl: GPIO9
sensor:
- platform: sht4x
temperature:
name: "Room Temperature"
humidity:
name: "Room Humidity"
update_interval: 30s
# The live web dashboard
web_server:
port: 80
version: 3
A few notes on what those blocks do. The sht4x platform speaks to the sensor over I²C at its fixed address (0x44), defaults to high precision, and reports every 60 seconds unless you change update_interval — we set 30 seconds above[9]. Swapping in a DHT22 means replacing the i2c and sensor blocks with the dht platform, pointing pin: at the GPIO you used[7]. Flash it with a single command over USB — esphome run room-monitor.yaml — and ESPHome validates the config, compiles the firmware, and uploads it[8].
Try it hands-on: ESPHome's web server also exposes a small REST API that returns readings as JSON. If you log those to a file and want to eyeball them as a spreadsheet, paste them into our CSV ⇄ JSON converter — it turns the JSON array into a table you can open in any spreadsheet app, entirely in your browser.
The dashboard, and locking it down
That web_server block is the payoff. It starts a small HTTP server on the device that any browser on your network can open — no app, no account. After flashing, find the device's address (ESPHome prints it, or look in your router's device list) and visit it. Version 3, used above, renders a clean Home Assistant-style interface with your two readings updating live[10].
One thing to be deliberate about: this web server is designed for a trusted home network. Its own documentation is blunt that it "has no cross-site protections, by design," and warns against exposing it to the internet[10]. So don't forward a port to it. If other people share your Wi-Fi, add the optional auth: block with a username and password to require a login[10]. For a sensor that only reports the temperature of a room, the stakes are low — but "don't put it on the public internet" is a rule worth keeping for every device like this.
Going further: history, alerts, and battery power
The standalone dashboard shows now. The moment you want yesterday — graphs, trends, "alert me if the freezer warms up" — point the same device at Home Assistant, the open-source home hub. ESPHome devices connect to it over a lightweight encrypted API (secured with a pre-shared key, on port 6053) and are usually auto-discovered the moment they come online[11]. Home Assistant then records history, draws charts, and runs automations off your readings. Nothing about the hardware changes; you add a couple of lines to the same config.
The other common upgrade is cutting the cord. To run on batteries, ESPHome's deep_sleep component wakes the board, takes a reading, reports it, and powers most of the chip down between measurements — the difference between hours and months on a charge. The catch is a real one worth planning around: a sleeping device "will not do any work and not respond to any network traffic, even Over The Air updates"[12]. So a battery sensor can't host a live always-on dashboard the way a plugged-in one does — it phones its readings home to Home Assistant on a schedule instead. Pick your mode: mains power for the instant web dashboard, or deep sleep plus a hub for a battery node.
The honest limits
This is a genuinely capable little device, but keep expectations calibrated. A cheap sensor measures the air at the sensor — put it in direct sun, near a heat vent, or against the board's own warmth and it will read high; give it a bit of airflow and shade. Consumer sensors also drift slowly over years, so this is a "is the room comfortable / is the greenhouse too dry" instrument, not a laboratory reference. Wi-Fi coverage has to reach wherever you place it. And the standalone web page is exactly that — a live readout with no memory; the history-and-alerts story really does need Home Assistant or another logger behind it. Within those limits, though, a $20 build that tells you the truth about a room, updates in real time, and answers only to your own network is hard to beat — and it's the gateway drug to a whole shelf of them.
Sources
- Espressif — ESP32-C3 product page, accessed July 2026
- Adafruit — ESP32-C3 DevKitM-01 dev board, accessed July 2026
- Adafruit — DHT22 / AM2302 temperature-humidity sensor, accessed July 2026
- Random Nerd Tutorials — ESP32 with DHT22 wiring and notes, accessed July 2026
- Sensirion — SHT41 product page (accuracy, voltage, interface), accessed July 2026
- ESPHome — I²C Bus component (default ESP32 pins), accessed July 2026
- ESPHome — DHT sensor component (pin, model, pull-up), accessed July 2026
- ESPHome — Getting started from the command line (install, run, OTA), accessed July 2026
- ESPHome — SHT4x sensor component (address, precision, update interval), accessed July 2026
- ESPHome — Web Server component (versions, auth, security note), accessed July 2026
- Home Assistant — ESPHome integration (native API, encryption, discovery), accessed July 2026
- ESPHome — Deep Sleep component (run/sleep duration, OTA limitation), accessed July 2026
Related: Weekend project: block ads on your whole network with a Raspberry Pi · Self-hosting 101: what's worth running on your own hardware in 2026 · All posts