LDR — Automatic Night Light
The room gets dark, the LED turns on
What you will learn
- What an LDR is and how its resistance changes with light
- How a voltage divider works (two resistors, one fixed + one variable)
- How to choose a threshold to decide "dark" vs "bright"
What you will need
| Component |
|---|
| 1× 9V battery |
| 1× slide switch |
| 1× LDR (light sensor) |
| 1× 10kΩ resistor |
| 1× 220Ω resistor |
| 1× yellow LED |
| Breadboard |
| 8× jumper wires |
Step by step
-
Step 1
Place the battery on the left, switch next, then the LDR + 10kΩ voltage divider, then the LED channel.
-
Step 2
Connect battery + → switch.
-
Step 3
Switch output → LED anode via the 220Ω resistor (LED cathode → battery −).
-
Step 4
Build the voltage divider separately: one leg of LDR → 5V, the other leg → both the 10kΩ resistor (→ GND) AND analog pin A0. (In the lesson code lab.)
-
Step 5
In the playground, right-click the LDR to cycle its light level (0–100%) — this is how you "cover it with your hand" in the virtual lab.
-
Step 6
Drop the LDR light level below 50% to simulate darkness — the LED should turn on.
Take it further
- Add a buzzer that beeps softly when the light is very low (a "find the stairs at night" aid).
- Print the light value to the Serial Monitor — what is the range in your room? In a closet?
- Adjust the threshold — what value works for your lighting?
Practise it before you build it
Wire this circuit in the ThinkEdge Learn simulator first. The simulator runs a real Arduino sketch against a modified-nodal-analysis solver, so the LED on screen actually lights when the current is right — no hardware, no burnt components, and a class can try it in a browser.
Related projects
Guides that use this project
4 guides on the site build this project as part of a longer explanation. The guide says why the circuit works; this page says how to wire it.
Where this project sits
It is also part of these lists, which is how a class usually finds it.
Try the full simulator with your class
103 guided circuit projects, 21 lessons and an in-browser Arduino simulator. The first 15 projects are free, no account needed. One licence covers a whole school.