PerfBoardSign in

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.

Component side layout of How does a night light know it's dark? on a perfboard 13 by 25 holes
13 × 25 holes · 11 parts · 8 wires

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 sheet

What you need

11 parts on a perfboard 13 × 25 holes, plus hookup wire.

QtyPartWhere 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.

WireColour and netLength
6
BlackVCC
D7 → D17
35mm
5
BlueSENSE
I10 → I6
20mm
4
GreenSENSE
F12 → E15
20mm
1
RedDARL
G14 → H15
14mm
7
RedGND
D5 → K5
28mm
3
WhiteSWITCH
E24 → H24
18mm
8
YellowGND
K7 → J12
25mm
2
YellowSWITCH
G16 → F23
30mm

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