8. Voltage regulator: a 12 V supply and a steady 5 V
Step 8 of the automatic light: The build outgrows a 9 V battery, so it moves to a 12 V adapter (D1 still guards it). U1 7805 gives 5 V for the light sensor, so the dusk level no longer drifts with the supply. R1 becomes 680 Ω for the higher voltage, and D1 becomes an SR560 Schottky (5 A, 150 A surge, about 0.4 V drop): the adapter can push tens of amps into C1 for an instant at switch-on, past a 1N4007’s 30 A surge rating, the lamp will draw 0.75 A later, and every volt lost in D1 is light lost in the lamp. Component 8 of 14: the voltage regulator. A linear regulator holds its output fixed whatever the input does (as long as the input stays about 2 V above it). The 7805 gives 5 V. The difference times the current is burnt as heat: (12 − 5) V × 10 mA = 70 mW here, nothing, but at 1 A it would be 7 W and need a heatsink.

Build it in the labGuided build, test sheet and fault finding, free in your browser.
Parts list
- DC adapter
- Schottky diode
- Toggle switch
- Electrolytic capacitor
- 3 × Resistor
- LED
- Potentiometer
- 7805 regulator
- 2 × Ceramic capacitor
- Photoresistor (LDR)
- NPN transistor
Test procedure
Each test has an expected value and a pass range, like a factory test sheet:
- 5 V rail
- Dark: LED on from the 12 V supply
- Daylight: LED off
How it works
The voltage regulator. A linear regulator holds its output fixed whatever the input does (as long as the input stays about 2 V above it). The 7805 gives 5 V. The difference times the current is burnt as heat: (12 − 5) V × 10 mA = 70 mW here, nothing, but at 1 A it would be 7 W and need a heatsink.
Reading it. 7805 in TO-220, pins IN-GND-OUT (facing the print, legs down). It wants a small capacitor on each side (0.33 µF in, 0.1 µF out) close to its legs, or it can oscillate. 78xx: last two digits = voltage (7812 = 12 V).
Testing it. Power it and measure OUT to GND: 4.8–5.2 V. Input below 7 V and the output sags: that is dropout, not a fault.
In the build. The build outgrows a 9 V battery, so it moves to a 12 V adapter (D1 still guards it). U1 7805 gives 5 V for the light sensor, so the dusk level no longer drifts with the supply. R1 becomes 680 Ω for the higher voltage, and D1 becomes an SR560 Schottky (5 A, 150 A surge, about 0.4 V drop): the adapter can push tens of amps into C1 for an instant at switch-on, past a 1N4007’s 30 A surge rating, the lamp will draw 0.75 A later, and every volt lost in D1 is light lost in the lamp.
Builds on lesson 7: everything from before is still there.
Next: lesson 9, comparator (lm339).
Things to try
- Measure IN, GND and OUT of U1.
- Set the adapter to 9 V: the 5 V rail does not move.
Background
One circuit, built up one part at a time: by lesson 14 it is a solar-powered, dusk-sensing, motion-triggered timed lamp with an alarm.