This project demonstrates a simple home automation controller using an ESP32 microcontroller that responds to serial commands to toggle two separate devices. The build uses an ESP32, two LEDs with current-limiting resistors, and basic wiring to create a foundation for learning microcontroller-based device control.
The guide includes a complete parts list, wiring diagram showing LED connections to GPIO pins 18 and 19, step-by-step assembly instructions, and pre-written firmware that listens for serial commands to turn each light or device on and off. This hands-on project teaches GPIO control, serial communication, and the basics of building an extensible home automation system.
Wiring diagram

Gather all the parts
Assemble it in 1 step
1. Wire the two demo lights
With USB unplugged, put each LED on a breadboard. Connect each short leg to GND. Connect the red LED's long leg through its own resistor to GPIO18, and the green LED's long leg through its own resistor to GPIO19. Use a USB data cable for power and commands.
- Do not connect wall wiring or appliances to these pins.
Review all connections
1. Connections between "r1" and "ESP32"
2. Connections between "led1" and "ESP32"
3. Connections between "r2" and "ESP32"
4. Connections between "led2" and "ESP32"
Deploy the firmware
#include <Arduino.h>
constexpr int LIGHT_PIN = 18;
constexpr int DEVICE_PIN = 19;
void setup() {
pinMode(LIGHT_PIN, OUTPUT);
pinMode(DEVICE_PIN, OUTPUT);
digitalWrite(LIGHT_PIN, LOW);
digitalWrite(DEVICE_PIN, LOW);
Serial.begin(115200);
}
void loop() {
switch (Serial.read()) {
case 'A': digitalWrite(LIGHT_PIN, HIGH); Serial.println("Lights on"); break;
case 'a': digitalWrite(LIGHT_PIN, LOW); Serial.println("Lights off"); break;
case 'B': digitalWrite(DEVICE_PIN, HIGH); Serial.println("Device on"); break;
case 'b': digitalWrite(DEVICE_PIN, LOW); Serial.println("Device off"); break;
}
delay(2);
}Download project files
Remix this project
Make it yours in one click
Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.




