Smart Light Control with ESP32
🔍 Project Overview
In this project, we’ll create a smart light system using an ESP32 board and a PIR motion sensor.
When motion is detected, the light turns on automatically!
▶️ Demo Video
🧠 How It Works
- The PIR sensor detects motion
- ESP32 sends a signal to switch the LED
- Can be expanded to real AC bulbs with a relay module
🧰 Materials Used
- ESP32 Dev Board
- PIR Motion Sensor
- Breadboard + Jumper Wires
- LED + Resistor
- USB Cable
💻 Arduino Code
```cpp #define PIR 12 #define LED 13
void setup() { pinMode(PIR, INPUT); pinMode(LED, OUTPUT); Serial.begin(9600); }
void loop() { if (digitalRead(PIR) == HIGH) { digitalWrite(LED, HIGH); Serial.println(“Motion Detected”); delay(5000); // keep light on for 5 seconds digitalWrite(LED, LOW); } }
Written on June 28, 2025