How does a night light know it's dark?
A night light that switches two LEDs on when the room goes dark. A photoresistor, a trim knob and two transistors.

Free build sheet
The parts, every wire with its length and bend points, a bend guide, both sides of the board and checkboxes to track your progress. Print it or keep it open at the bench.
Open the build sheetWhat you need
11 parts on a perfboard 13 × 25 holes, plus hookup wire.
| Qty | Part | Where to buy |
|---|---|---|
| 1 | Electrolytic Cap10uF C1 | Buy Electrolytic Cap on Amazon |
| 1 | Power Input (2-pin) J1 | |
| 2 | LED LED1, LED2 | Buy LED on Amazon |
| 1 | Potentiometer Q1 | |
| 2 | NPN Transistor (TO-92) Q2, Q3 | Buy NPN Transistor (TO-92) on Amazon |
| 1 | Resistor (axial)10k R1 | Buy Resistor (axial) on Amazon |
| 2 | Resistor (axial)100 R2, R3 | Buy Resistor (axial) on Amazon |
| 1 | Photoresistor (LDR) U1 |
Check every pin against the datasheet of the exact part in your hands before wiring.
As an Amazon Associate I earn from qualifying purchases.
Cut list
8 wires, 190 mm (7.5 in) in total, in the order the build sheet cuts them. Wire numbers match the build sheet. Each length includes 5 mm per end to go through the hole.
| Wire | Colour and net | Length | ||
|---|---|---|---|---|
| 6 | BlackVCC D7 → D17 | D7 → D17 | 35mm | Straight |
| 5 | BlueSENSE I10 → I6 | I10 → I6 | 20mm | Straight |
| 4 | GreenSENSE F12 → E15 | F12 → E15 | 20mm | 8mm (90°) |
| 1 | RedDARL G14 → H15 | G14 → H15 | 14mm | Straight |
| 7 | RedGND D5 → K5 | D5 → K5 | 28mm | Straight |
| 3 | WhiteSWITCH E24 → H24 | E24 → H24 | 18mm | Straight |
| 8 | YellowGND K7 → J12 | K7 → J12 | 25mm | 18mm (90°) |
| 2 | YellowSWITCH G16 → F23 | G16 → F23 | 30mm | 23mm (90°) |
About this build
A night light knows it's dark because it has a light sensor. This one is a photoresistor in a voltage divider with a trim knob. When the room goes dark, the photoresistor's resistance shoots up and the sense voltage rises.
Past about 1.2V, two 2N3904 transistors wired as a Darlington pair switch on, and two LEDs light through their own 100 ohm resistors. A 10uF capacitor on the sense line smooths out flicker.
The parts library has no photoresistor, so the video draws one in the Footprint Editor first, two pins and a round body, then places it like any other part. The rest is a 100k trimmer, a 10k resistor and a 5V power input.
More builds
See all builds
VideoThe Clapper, recreated: lights that turn on when you clap
Clap once and an LED turns on, clap again and it turns off. A microphone, two transistors and one flip-flop chip.
14 parts · 24 wires
SensorsLights
Premieres Oct 11A lamp you turn on by touching it
Tap a metal pad and two white LEDs turn on, tap again and they turn off. One flip-flop chip and a MOSFET.
13 parts · 13 wires
LightsSensors
Premieres Oct 13This LED turns red when the room gets hot
An RGB LED that shows the room temperature: red when it's hot, blue when it's cold, green in between. Two knobs set the limits.
13 parts · 23 wires
SensorsLights