Practical case: Visual Charge and Discharge with LED

Visual Charge and Discharge with LED prototype (Maker Style)

Level: Basic – Observe energy storage in an electrolytic capacitor via LED fading.

Objective and use case

You will build a simple circuit where a capacitor acts as a temporary energy reservoir, keeping an LED illuminated briefly after the power source is disconnected.

  • Why it is useful:

    • Demonstrates how capacitors store and release electrical energy.
    • Simulates the «smoothing» effect used in power supply adapters to maintain steady voltage.
    • Visualizes the RC time constant (the relationship between resistance, capacitance, and time).
    • Introduces the concept of «hold-up time» in power failures.
  • Expected outcome:

    • Switch ON: The LED lights up immediately.
    • Switch OFF: The LED does not turn off instantly; instead, it slowly fades out over several seconds.
    • Visual: A smooth transition from bright light to darkness.
    • Audience: Students and hobbyists interested in basic component behavior.

Materials

  • V1: 9 V DC battery or power supply, function: main energy source.
  • S1: SPST toggle switch or push-button, function: controls the connection to the power source.
  • C1: 2200 µF electrolytic capacitor (16 V or higher), function: energy storage reservoir.
  • R1: 470 Ω resistor, function: LED current limiting and discharge timing control.
  • D1: Red LED, function: visual indicator of current flow and stored charge.

Wiring guide

Use the following explicit node connections to build the circuit. The standard ground reference is node 0.

  • Power and Switch:

    • Connect the Positive terminal of V1 to node VCC.
    • Connect the Negative terminal of V1 to node 0 (GND).
    • Connect one side of switch S1 to node VCC.
    • Connect the other side of switch S1 to node V_CAP.
  • Capacitor (The Tank):

    • Connect the Positive (long leg) of C1 to node V_CAP.
    • Connect the Negative (short leg/stripe) of C1 to node 0.
  • LED and Resistor (The Load):

    • Connect resistor R1 between node V_CAP and node V_LED.
    • Connect the Anode (long leg) of D1 to node V_LED.
    • Connect the Cathode (short leg/flat spot) of D1 to node 0.

Conceptual block diagram

Conceptual block diagram — RC Charge/Discharge Circuit
Quick read: inputs → main block → output (actuator or measurement). This summarizes the ASCII schematic below.

Schematic

Title: Practical case: Visual Charge and Discharge with LED

      [ INPUT / CONTROL ]               [ STORAGE / BUFFER ]               [ OUTPUT / LOAD ]

                                            (Node V_CAP)
    [ 9 V Battery ] --(+)--> [ Switch S1 ] -------+-------> [ Resistor R1 ] --> [ LED D1 ] --> GND
                                                 |
                                                 |
                                                 v
                                          [ Capacitor C1 ]
                                          (   2200 uF    )
                                                 |
                                                GND
Schematic (ASCII)

Measurements and tests

  1. Initial State: Ensure S1 is Open (Off). The LED should be dark.
  2. Charge Phase: Close S1. Observe that the LED lights up instantly. The capacitor C1 charges to approximately 9 V almost immediately.
  3. Discharge Phase: Open S1.
    • Observe that the LED remains lit but begins to dim.
    • Use a stopwatch to measure the time from opening the switch until the LED is completely dark.
  4. Repeat: Swap C1 for a smaller value (e.g., 100 µF) and observe how the fade time becomes much shorter (almost instant).

SPICE netlist and simulation

Reference SPICE Netlist (ngspice) — excerptFull SPICE netlist (ngspice)

* Practical case: Visual Charge and Discharge with LED

* --- Power Supply (V1) ---
* 9V DC Battery connected to VCC and GND (0)
V1 VCC 0 DC 9

* --- Switch (S1) ---
* Modeled as a Voltage-Controlled Switch to simulate a physical push-button.
* Connections: VCC to V_CAP
* The switch is controlled by the voltage at node 'CTRL'.
S1 VCC V_CAP CTRL 0 SW_PUSH

* Switch Control Source (Simulates User Interaction)
* Simulates pressing the button at T=0.1s, holding for 1s, then releasing.
* PULSE(V1 V2 TD TR TF PW PER)
V_USER_S1 CTRL 0 PULSE(0 5 0.1 1m 1m 1 5)

* Switch Model Definition
* Ron=1 ohm represents wiring/contact resistance.
.model SW_PUSH SW(Vt=2.5 Ron=1 Roff=100Meg)
* ... (truncated in public view) ...

Copy this content into a .cir file and run with ngspice.

🔒 Part of this section is premium. With the 7-day pass or the monthly membership you can access the full content (materials, wiring, detailed build, validation, troubleshooting, variants and checklist) and download the complete print-ready PDF pack.

* Practical case: Visual Charge and Discharge with LED

* --- Power Supply (V1) ---
* 9V DC Battery connected to VCC and GND (0)
V1 VCC 0 DC 9

* --- Switch (S1) ---
* Modeled as a Voltage-Controlled Switch to simulate a physical push-button.
* Connections: VCC to V_CAP
* The switch is controlled by the voltage at node 'CTRL'.
S1 VCC V_CAP CTRL 0 SW_PUSH

* Switch Control Source (Simulates User Interaction)
* Simulates pressing the button at T=0.1s, holding for 1s, then releasing.
* PULSE(V1 V2 TD TR TF PW PER)
V_USER_S1 CTRL 0 PULSE(0 5 0.1 1m 1m 1 5)

* Switch Model Definition
* Ron=1 ohm represents wiring/contact resistance.
.model SW_PUSH SW(Vt=2.5 Ron=1 Roff=100Meg)

* --- Capacitor (C1) ---
* 2200uF Energy Storage
* Connections: V_CAP to GND (0)
C1 V_CAP 0 2200u

* --- Resistor (R1) ---
* 470 Ohm Current Limiting Resistor
* Connections: V_CAP to V_LED
R1 V_CAP V_LED 470

* --- LED (D1) ---
* Red LED Indicator
* Connections: Anode (V_LED) to Cathode (0)
D1 V_LED 0 D_LED_RED

* LED Model Definition
* Generic Red LED parameters
.model D_LED_RED D(IS=1e-14 N=2 RS=10 BV=5 IBV=10u)

* --- Analysis Commands ---
* The discharge time constant (Tau) = R * C = 470 * 2200e-6 approx 1.03 seconds.
* Simulation runs for 3 seconds to visualize the charge and discharge cycle.
.tran 10m 3s

* --- Output Directives ---
* Prints the capacitor voltage, LED anode voltage, and switch control signal.
.print tran V(V_CAP) V(V_LED) V(CTRL)

.op
.end

Simulation Results (Transient Analysis)

Simulation Results (Transient Analysis)
Show raw data table (352 rows)
Index   time            v(v_cap)        v(v_led)        v(ctrl)
0	0.000000e+00	8.234122e-01	8.233738e-01	0.000000e+00
1	1.000000e-04	8.234122e-01	8.233738e-01	0.000000e+00
2	2.000000e-04	8.234122e-01	8.233738e-01	0.000000e+00
3	4.000000e-04	8.234122e-01	8.233738e-01	0.000000e+00
4	8.000000e-04	8.234122e-01	8.233738e-01	0.000000e+00
5	1.600000e-03	8.234122e-01	8.233738e-01	0.000000e+00
6	3.200000e-03	8.234122e-01	8.233738e-01	0.000000e+00
7	6.400000e-03	8.234122e-01	8.233738e-01	0.000000e+00
8	1.280000e-02	8.234122e-01	8.233738e-01	0.000000e+00
9	2.280000e-02	8.234122e-01	8.233738e-01	0.000000e+00
10	3.280000e-02	8.234122e-01	8.233738e-01	0.000000e+00
11	4.280000e-02	8.234122e-01	8.233738e-01	0.000000e+00
12	5.280000e-02	8.234122e-01	8.233738e-01	0.000000e+00
13	6.280000e-02	8.234122e-01	8.233738e-01	0.000000e+00
14	7.280000e-02	8.234122e-01	8.233738e-01	0.000000e+00
15	8.280000e-02	8.234122e-01	8.233738e-01	0.000000e+00
16	9.280000e-02	8.234122e-01	8.233738e-01	0.000000e+00
17	1.000000e-01	8.234122e-01	8.233738e-01	0.000000e+00
18	1.001000e-01	8.234122e-01	8.233738e-01	5.000000e-01
19	1.002600e-01	8.234122e-01	8.233738e-01	1.300000e+00
20	1.003075e-01	8.234122e-01	8.233738e-01	1.537500e+00
21	1.003906e-01	8.234122e-01	8.233738e-01	1.953125e+00
22	1.004136e-01	8.234122e-01	8.233738e-01	2.068164e+00
23	1.004539e-01	8.234122e-01	8.233738e-01	2.269482e+00
... (328 more rows) ...

Common mistakes and how to avoid them

  1. Reversed Capacitor Polarity: Electrolytic capacitors are polarized. Connecting the negative leg to positive voltage can cause the component to overheat or pop. Solution: Always check the stripe on the side of the capacitor; it marks the negative pin.
  2. Omitting the Resistor: Connecting the LED directly to the 9 V source (or charged capacitor) without R1 will burn out the LED instantly. Solution: Ensure R1 is in series with D1.
  3. Using a very small Capacitor: If C1 is too small (e.g., 100 nF), the discharge will happen so fast the human eye cannot see the fade. Solution: Use values ≥ 1000 µF for visual tests.

Troubleshooting

  • LED never lights up:
    • Check if D1 is inserted backward (Anode/Cathode swapped).
    • Verify S1 is actually closing the circuit.
    • Check battery voltage.
  • LED turns off instantly (no fade):
    • C1 might be disconnected or open-circuit.
    • C1 value is too low.
    • R1 value is too high, making the LED too dim to see the tail end of the fade.
  • Capacitor gets hot:
    • Immediately disconnect power! The polarity of C1 is likely reversed.

Possible improvements and extensions

  1. Variable Timing: Replace R1 with a 1 kΩ potentiometer in series with a 100 Ω fixed resistor. Adjusting the pot will change the discharge time and LED brightness.
  2. Dual Switch Logic: Use a SPDT (Single Pole Double Throw) switch. Connect Node VCC to Position 1, Node 0 to Position 2, and the Common pin to the Capacitor/Resistor network. This allows you to actively «dump» the energy to ground or let it fade naturally.

More Practical Cases on Prometeo.blog

Find this product and/or books on this topic on Amazon

Go to Amazon

As an Amazon Associate, I earn from qualifying purchases. If you buy through this link, you help keep this project running.

Quick Quiz

Question 1: What is the primary function of the capacitor in this circuit?




Question 2: What visual effect is expected when the switch is turned OFF?




Question 3: Which component is responsible for limiting the current to the LED?




Question 4: What is the recommended value for the capacitor C1 in this experiment?




Question 5: Why is this circuit useful for understanding power supplies?




Question 6: What happens to the LED immediately after the switch is turned ON?




Question 7: What concept describes the relationship between resistance, capacitance, and time?




Question 8: What is the function of the component labeled V1?




Question 9: What real-world concept related to power failures does this circuit introduce?




Question 10: Who is the intended audience for this specific circuit experiment?




Carlos Núñez Zorrilla
Carlos Núñez Zorrilla
Electronics & Computer Engineer

Telecommunications Electronics Engineer and Computer Engineer (official degrees in Spain).

Follow me:
Scroll to Top