This project shows you how to build a Wi-Fi-controlled smart light using an ESP32 microcontroller. It’s a great introduction to IoT and home automation — letting you control an LED (or even a full AC-powered lamp) using a web browser over your local Wi-Fi network.
No cloud service or app installation required. Just clean, lightweight code and a simple interface you host right on the ESP32.
Why did I decide to make it?I wanted a hands-on way to explore home automation without relying on proprietary devices or platforms. Building my own smart light controller with ESP32 gave me total control over the hardware, logic, and even power consumption — which is especially important for battery-powered setups.
Plus, it’s the kind of project that can scale easily. Today it’s a single light. Tomorrow, it could be part of a smart home system with MQTT, Home Assistant, or Alexa integration.
How does it work?The ESP32 connects to your Wi-Fi and runs a basic web server. When you access it from a phone or computer, you’ll see a simple interface with ON and OFF buttons. Pressing a button triggers a digital output on the ESP32, which powers the LED (or a relay module for AC loads).
The interface is served from the ESP32’s flash memory, and everything runs locally — meaning it’s fast, responsive, and doesn’t need internet access.
Hardware- ESP32 Dev Board (DOIT or similar)
- LED + 220Ω resistor (or a 5V relay module for AC control)
- Breadboard and jumper wires
- Micro USB cable for power
- Optional: 3.3V power supply or Li-Ion battery
Basic LED Setup:
- Connect the LED anode (long leg) to GPIO 2 through a 220Ω resistor
- Connect the cathode (short leg) to GND
- Use 3.3V or 5V power via USB
Relay Setup (optional):
- Connect IN pin of the relay module to GPIO 2
- VCC to 5V, GND to GND
- Plug in AC light control only if you're confident working with mains safely
Want to explore more builds like this one? Check out the full collection of IoT tutorials and hands-on guides on my blog:
Comments