Circuits / Sensors
Night light with a photoresistor
In the dark the photoresistor's resistance is high, the divider's voltage rises and the transistor switches the LED on; with light it falls and the LED goes out. It switches at about 95 lx on 3 V, 190 lx on 5 V and 375 lx on 9 V in the model.

Tap a part to see its voltages and currents. It is a model, not a measurement.
What do you need?
- Resistor 10 kΩ × 2AliExpress Amazon
- Photoresistor (LDR) GL5528AliExpress Amazon
- Resistor 560 ΩAliExpress Amazon
- Bipolar transistor BC547AliExpress Amazon
- Red LEDAliExpress Amazon
- Jumper wires × 6AliExpress Amazon
- BreadboardAliExpress Amazon
The AliExpress links are affiliate links: if you buy through them ohmio.dev gets a commission, at no extra cost to you. Affiliate links
This page is a guide: the numbers come from a simulation, and real parts vary. Check your parts before you power the circuit. Safety and responsibility
How does a photoresistor turn on a night light?
A photoresistor is a resistor whose value falls as light rises. Here it sits under R1 (10 kΩ) in a divider, so the less light it gets, the larger its share of the 5 V. That voltage goes through R2 to the base of a BC547, which switches the LED. In the model the photoresistor is about 1.4 kΩ at 300 lx and about 3 kΩ at 100 lx. In the dark the divider gives 2.84 V, 0.21 mA flows into the base and the LED takes about 5.8 mA through R3 (560 Ω). At 100 lx the LED still has 5.7 mA, at 200 lx 2.3 mA, and at 300 lx only 0.1 mA, practically off. In this model the LED falls to half its dark current near 185 lx. A real photoresistor switches at a different light level, so if the LED comes on too early or too late, change R1.
Values from the Protoboard ISO simulation: a model, not a bench measurement.
Hear about the next circuit
One email when a new circuit is out, about twice a month. Nothing else.