7. Transistor: the light switches itself
Step 7 of the automatic light: LED1 now goes to Q1’s collector instead of ground; SENSE drives the base through R3 10 k. Daylight: SENSE is low, Q1 is off, the LED is dark. Dusk: SENSE rises, Q1 conducts, the LED comes on by itself. Note how it fades in gradually at dusk: the transistor is half on. Lesson 9 fixes that. Component 7 of 14: the npn transistor. A bipolar transistor lets a small base current control a much larger collector current (gain β, about 100–300). As a switch it sits on the low side: the load between + and the collector, the emitter to ground. About 0.7 V on the base starts it conducting.

Build it in the labGuided build, test sheet and fault finding, free in your browser.
Parts list
- 9 V battery
- Rectifier diode
- Toggle switch
- Electrolytic capacitor
- 3 × Resistor
- LED
- Potentiometer
- Photoresistor (LDR)
- NPN transistor
Test procedure
Each test has an expected value and a pass range, like a factory test sheet:
- Daylight: LED off
- Dark: LED on
How it works
The npn transistor. A bipolar transistor lets a small base current control a much larger collector current (gain β, about 100–300). As a switch it sits on the low side: the load between + and the collector, the emitter to ground. About 0.7 V on the base starts it conducting.
Reading it. 2N2222 / PN2222 in TO-92: pins E-B-C, but check the datasheet of your exact part, makers differ. 40 V, 600 mA, about 0.6 W. Always put a resistor in the base lead.
Testing it. Diode range: base to emitter and base to collector each read like a diode (0.6–0.7 V, red on the base for NPN), all other pairs OL.
In the build. LED1 now goes to Q1’s collector instead of ground; SENSE drives the base through R3 10 k. Daylight: SENSE is low, Q1 is off, the LED is dark. Dusk: SENSE rises, Q1 conducts, the LED comes on by itself. Note how it fades in gradually at dusk: the transistor is half on. Lesson 9 fixes that.
Builds on lesson 6: everything from before is still there.
Next: lesson 8, voltage regulator.
Things to try
- Slide the LDR light level slowly through 30 → 3 lux: the LED fades in rather than switching. That in-between region is the transistor working as an amplifier.
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.