Maker tech hub — AI · 3D print · Pi · ESP32 · plus the classic tech archive.

Free ESP32 kit · Books · Network Ninja · Archive

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.

Written by

Avery J. Parker

IT veteran, maker educator, and author of Network Ninja, 3D Printing Mastery, and AI Workflow Mastery. Business IT: Diversified Tech Solutions.

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

ESP32 reading a BME280/DHT sensor and driving an opto-isolated relay for a safe low-voltage load.
ESP32 reading a BME280/DHT sensor and driving an opto-isolated relay for a safe low-voltage load.
  • 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

  1. Read sensor every 10s; exponential moving average for display
  2. Relay state machine: manual override + simple threshold automation
  3. Lightweight HTTP endpoints: /status, /relay?on=1

Start offline (serial only), then add Wi‑Fi. Debug connectivity last, logic first.