AI Services Market › IoT Cases › Auto Night Light
Day 1 of 100
Auto Night Light
Lighting · Board: ESP32 · Day 1 of 100
An ESP32 reads ambient light through an LDR and switches an LED on automatically after dark. A gentle first project covering analog input and threshold logic in MicroPython.

How it works
A light-dependent resistor forms a voltage divider whose output falls as the room darkens. The ESP32 reads that voltage through its analog-to-digital converter and compares it against a threshold. When the reading drops below the threshold, the board switches the LED on; when daylight returns, it switches off again.
What you'll learn
- ADC analog input
- Voltage divider circuits
- Threshold-based switching
- Hysteresis to prevent flicker
Full project: code, wiring diagram & Wokwi simulation
The complete build guide lives in the original repo. Ours is a summary — the real thing is one click away.
Open full project on GitHub ↗Summary by AI Services Market. Project by Kritish Mohapatra — code and diagrams belong to the original repo.


