Project · Intermediate · ESP32
ESP32 Home Automation Project with Sensors and Relays
Safe low-voltage relay control, sensor reads, and a simple web UI — without setting your garage on fire.
Project template
- Goal & materials
- Steps / firmware
- Troubleshooting
- AI assist notes
- Related gear & books
Goal: read temperature/humidity, expose a tiny status page, and drive a relay module for a fan or light.
Depth checklist: materials → steps → troubleshooting → AI assist → related gear/books.
See also the gear shortlist and free ESP32 kit.
Safety first
- Prefer low-voltage DC loads while learning
- Mains wiring belongs behind proper enclosures and local electrical code
- Use opto-isolated relay boards; never drive a coil directly from a GPIO without a transistor + diode
Parts
- ESP32 DevKit
- BME280 or DHT22
- 5V relay module (active-low common)
- Separate 5V supply if the relay + sensors brown out USB power
Architecture
- Read sensor every 10s; exponential moving average for display
- Relay state machine: manual override + simple threshold automation
- Lightweight HTTP endpoints:
/status,/relay?on=1
Start offline (serial only), then add Wi‑Fi. Debug connectivity last, logic first.