Electronic circuits · no code

Simple Light Timer

Press a button and the LED lights, then fades out by itself, slowly, over about 20 seconds. A capacitor stores the charge and a transistor turns it into light.

  • LevelBeginner
  • Time20 min
  • Power9 V DC
  • CategoryLights & LEDs

Bill of materials

Everything you need to build it, with the reference you will see on the schematic.

Bill of materials
Qty Part Ref.
1 Pushbutton S1
1 220 Ω resistor (red-red-brown) R1
1 1 mF electrolytic capacitor C1
1 4.7 kΩ resistor (yellow-violet-red) R2
1 100 kΩ resistor (brown-black-yellow) R4
1 BC547 NPN transistor Q1
1 470 Ω resistor (yellow-violet-brown) R3
1 yellow LED D1
1 9 V battery with snap clip BT1
1 Breadboard (400 tie-points or more)
8 Jumper wires

Missing parts? The kits recommended by Impeca Tech include almost all of them. See the kits

Schematic & wiring

On the left, the circuit diagram; on the right, the same circuit built on a breadboard. Both connect exactly the same things.

Circuit diagram of “Simple Light Timer”
Circuit diagram
Breadboard layout of “Simple Light Timer”
Breadboard layout

Wire it step by step

  1. Place the components
    • Pushbutton S1 straddling the centre channel of the breadboard: two legs on top (3f and 5f) and two below (3e and 5e).
    • 220 Ω resistor R1 (bands: red, red, brown, gold): one leg in 6f and the other in 9f (either way round).
    • 1 mF electrolytic capacitor C1: the leg marked with the stripe and the − sign in 10g and the other leg (+) in 9g. Reversed, it can be damaged.
    • 4.7 kΩ resistor R2 (bands: yellow, violet, red, gold): one leg in 4h and the other in 7h (either way round).
    • 100 kΩ resistor R4 (bands: brown, black, yellow, gold): one leg in 13f and the other in 10f (either way round).
    • BC547 transistor Q1 with the flat face (the one with the text) towards you, left to right: collector (C) in 15f, base (B) in 16f, emitter (E) in 17f.
    • 470 Ω resistor R3 (bands: yellow, violet, brown, gold): one leg in 11h and the other in 14h (either way round).
    • yellow LED D1: the long leg (+, anode) in 14i and the short leg (−, cathode, flat side) in 15i.
  2. Add the jumper wires
    • Red wire: from 3j to the + (red) rail.
    • Red wire: from 11j to the + (red) rail.
    • Orange wire: from 3d to 6j.
    • Turquoise wire: from 4j to 9j.
    • Black wire: from 10j to the − (blue) rail.
    • Black wire: from 17j to the − (blue) rail.
    • Purple wire: from 7j to 13j.
    • Pink wire: from 13i to 16j.
  3. Connect the battery
    • Connect the 9 V battery to its clip: the clip’s red lead to the + (red) rail and the black one to the − (blue) rail. Do this last, once everything else is in place.
  4. Test the circuit
    • Press S1 for one second and let go: the LED should stay on for about 15 seconds and then fade out gradually, fully off within a minute. Time it with a stopwatch. If you press again halfway, the timing starts over.

How to read the holes: the letter is the row and the number is the column of the breadboard (for example 7f). The red (+) and blue (−) rails are the two long lines along the edge.

How does it work?

  1. 1You press S1
  2. 2The capacitor charges to almost 9 V
  3. 3On release it discharges slowly into the transistor base
  4. 4The LED fades out gradually

When you press S1 the battery charges the 1000 µF capacitor C1 through R1 in about a second. On release the battery is cut off and C1 can only discharge through the base of transistor Q1 (via R2) and through R4. While C1 holds some voltage, current enters the base and Q1 amplifies it hundreds of times: it lets about 14 mA through the LED, so the LED stays at nearly full brightness for about 15 seconds. When C1 gets close to 0.7 V, Q1 starts to close and the LED fades out gently over a few more seconds. R4 (100 kΩ) makes sure the base ends at 0 V so the LED goes completely off. The time depends on C1, R2 and R4: with a different capacitor the duration changes.

Testing & troubleshooting

What you should see

Press S1 for 1 s, then release
LED current as S1 is released≈ 15 mA
After 10 s≈ 15 mA
After 30 s≈ 0.83 mA
After 60 sunder 0.1 mA

Approximate values, calculated with typical parts. With real parts they can vary by 10 % or more.

If something does not work

The LED does not light when I press?

Check the capacitor polarity: the long leg (+) goes towards R1 and the stripe marked − towards the GND rail. Reversed, it stores no charge and the LED barely blinks.

It lasts much less (or much more) than stated?

It is normal for it to vary with the capacitor tolerance (often ±20 %) and with the battery: a worn battery shortens the time. For a longer time use a bigger capacitor; for a shorter one, a smaller one.

Want to automate this circuit with code?

Learn how to program sensors and custom schedules in our e-book “Arduino from Scratch”.