Smooth LED Fade-Out
When you release the button the LED does not switch off at once: a 2200 µF capacitor keeps it lit and fades it out gently.
Bill of materials
Everything you need to build it, with the reference you will see on the schematic.
| Qty | Part | Ref. |
|---|---|---|
| 1 | Pushbutton | S1 |
| 1 | 470 Ω resistor (yellow-violet-brown) | R2 |
| 1 | 2.2 mF electrolytic capacitor | C1 |
| 1 | 1 kΩ resistor (brown-black-red) | R1 |
| 1 | red LED | D1 |
| 1 | 9 V battery with snap clip | BT1 |
| 1 | Breadboard (400 tie-points or more) | |
| 5 | 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.
Wire it step by step
-
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).
- 470 Ω resistor R2 (bands: yellow, violet, brown, gold): one leg in 4g and the other in 7g (either way round).
- 2.2 mF electrolytic capacitor C1: the leg marked with the stripe and the − sign in 9f and the other leg (+) in 8f. Reversed, it can be damaged.
- 1 kΩ resistor R1 (bands: brown, black, red, gold): one leg in 7i and the other in 10i (either way round).
- red LED D1: the long leg (+, anode) in 10f and the short leg (−, cathode, flat side) in 11f.
-
Add the jumper wires
- Red wire: from 3j to the + (red) rail.
- Orange wire: from 3d to 4j.
- Turquoise wire: from 7j to 8j.
- Black wire: from 9j to the − (blue) rail.
- Black wire: from 11j to the − (blue) rail.
-
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.
-
Test the circuit
- Hold S1 down for about 4 seconds and let go: the LED should stay lit and fade out gradually over several seconds. The longer you hold S1 the fuller the charge, although after about 4 seconds it is almost complete.
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?
- 1You hold S1 down
- 2The capacitor charges
- 3You release S1
- 4The capacitor feeds the LED, which fades out
While S1 is pressed the battery powers the LED and charges capacitor C1 through R2. When you let go the battery is disconnected, but C1 is still full of charge and gives it to the LED through R1. The capacitor voltage falls slowly and the current with it, so the LED loses brightness progressively over several seconds until it goes out. It is the same principle as a car’s courtesy light that dims after the door closes.
Testing & troubleshooting
What you should see
- Press S1 (0–4 s), then release
- LED current while S1 is pressed≈ 4.8 mA
- 1 s after release≈ 3.1 mA
- 4 s after release≈ 0.82 mA
Approximate values, calculated with typical parts. With real parts they can vary by 10 % or more.
If something does not work
The LED goes off as soon as I release S1?
The capacitor is not charging: check the polarity (− stripe towards the − rail) and that R2 connects S1 to the capacitor. With a smaller capacitor the effect lasts far less.
The LED takes a long time to go fully off?
That is normal: at the end a very faint glow remains for quite a while. To shorten it, replace R1 with a lower-value resistor.
Want to automate this circuit with code?
Learn how to program sensors and custom schedules in our e-book “Arduino from Scratch”.