Electronics
Build a capacitor timer that keeps an LED lit
A capacitor can run an LED for a while after its power is gone. Hold a button to charge a big capacitor through a small resistor, let go, and the capacitor empties through the LED and its own resistor. With 6800 µF and 1 kΩ, the time constant is τ = R × C = 6.8 s, and the LED glows for about 14 seconds before it fades out.
The circuit
- A 9 V battery and a push button
- R1, a charging resistor, from the button to the capacitor
- C1, an electrolytic capacitor, across the LED branch
- R2 and a red LED in series, also across C1
While you hold the button, the battery fills C1 and lights the LED. Let go, and C1 is the LED's only supply.
Live experiment
Find the keyhole
A dark front door. Hold the button and a 9 V battery fills a 6800 µF capacitor through 330 Ω while the lamp lights. Let go and the lamp runs on the capacitor through its 1 kΩ, fading as it empties. A quick tap barely fills it.
“Project: Keyhole Light Timer” is the project that ends Capacitor Caves, Electronics World 3. Free with an account. Lessons unlock in order, so you’ll do the 20 before it first.
Size the parts
R1 first. At the first instant the capacitor is empty, so R1 has the whole 9 V across it. Keep that under a 0.25 W rating:
The LED's current. While you hold the button, R1 and the LED branch form a divider, so C1 heads for about 7 V, not 9 V, and reaches about 6 V in a 3 s hold. From 6 V, a red LED (2 V) through R2 = 1 kΩ starts at (6 − 2) ÷ 1000 = 4 mA.
The glow time. The LED's current falls by 63% every τ. It's still visible until it drops to about 0.5 mA, an eighth of 4 mA, which takes about 2τ. For at least 10 seconds of light, aim for τ ≈ 6 s:
Round up to the next standard value, 6800 µF, for τ = 6.8 s and about 14 s of glow.
The charging time. 330 Ω × 6800 µF ≈ 2.2 s, so a 3 s hold fills it well. A quick tap barely starts it, and the light dies almost at once.
Why it fades
Each τ the capacitor loses 63% of the gap between its voltage and the LED's 2 V, so the current falls by the same fraction every few seconds: a smooth fade, not a clean cut-off. Add a transistor and a tap on the button is enough, because the capacitor then only has to hold the transistor's base, not feed the LED.
Free lesson
Now build it yourself
Each lesson comes in three short parts: see the idea, try it on a live board, then build it yourself, with quick checks as you go.
“Project: Keyhole Light Timer” is the project that ends Capacitor Caves, Electronics World 3. Free with an account. Lessons unlock in order, so you’ll do the 20 before it first.
Or start from the very first lesson, no account neededPractice questions
Three quick questions from the lessons. Pick an answer to check it.
Show the answer
Answer: 6 s. 2τ ≥ 10 s means τ ≥ 5 s, and 6 s leaves some margin. With 60 s it would glow for minutes and never fade out in time.
- Why not “0.5 s”? With τ = 0.5 s the glow lasts about 2τ, only a second, far short of 10 s.
- Why not “60 s”? With τ = 60 s it would glow for about two minutes, so it wouldn't fade out by itself in good time.
Show the answer
Answer: one τ. After one time constant, τ = R × C, it has closed 63% of the gap. After five τ it's at 99%, close enough to call full.
- Why not “five τ”? After five τ it's at about 99%, close enough to call full. 63% comes much sooner, after one τ.
- Why not “half a τ”? After half a τ it has reached only about 39% of the supply, not 63%.
Show the answer
Answer: 14%. 37% is left after 1τ, and 37% of that after 2τ, 0.37 × 0.37 ≈ 14%. 5% is after 3τ.
- Why not “5%”? 5% is what's left after three τ, 0.37 × 0.37 × 0.37. After two it's still about 14%.
- Why not “37%”? 37% is left after one τ. After a second τ only 37% of that remains, about 14%.
“Project: Keyhole Light Timer” is the project that ends Capacitor Caves, Electronics World 3. Free with an account. Lessons unlock in order, so you’ll do the 20 before it first.
Questions people ask
How long will a capacitor keep an LED lit?
Roughly two time constants of R × C, where R is the LED's resistor, if the LED starts at about 4 mA and you count it dark below 0.5 mA. With 1 kΩ and 6800 µF, τ = 6.8 s, so it glows for about 14 seconds and then fades out.
Why does the LED fade instead of switching off?
As the capacitor empties its voltage falls, so the LED's resistor has less to push with and the current drops a fixed fraction every second. The light dims smoothly. A comparator or transistor can turn that slow fade into a clean off.
Do I need a resistor between the button and the capacitor?
Yes. An empty capacitor looks like a short at the first instant, so without one the battery dumps a huge current through the button. 330 Ω limits that first rush to 9 ÷ 330 ≈ 27 mA and still fills 6800 µF in a few seconds.
Related topics
- RC time constant explainedτ = R × C: how long a capacitor takes to charge through a resistor, and the 63% rule.
- Capacitor discharge explainedFast at first, then slower: the 37% rule, the formula, and how long a capacitor takes to empty.
- Energy stored in a capacitorE = ½ × C × V²: how many joules a capacitor holds, why voltage counts double, and how much you can use.
- Transistor as a switch, explainedA trickle into the base switches a big current: cutoff, saturation and the base resistor.