Sub topic 17
Charging and discharging a capacitor through a resistor
This chapter assumes you know Kirchhoff's loop rule, the capacitor relation Q = CV, and the energy stored in a capacitor. It also assumes you are comfortable with the exponential function.
The working model
When a capacitor C is connected to a cell of EMF E through a resistor R, current flows until the capacitor voltage equals E. At each instant, the loop rule gives:
E = IR + q/C
At the start the capacitor is empty, so the whole EMF drops across R and the initial current is E/R. As charge builds up, q/C grows, the voltage across R shrinks, and the current falls toward zero.
The product τ = RC is the time constant. It has units of seconds (ohm times farad). It sets the speed of every process in the circuit. A larger R or a larger C means slower charging.
Charging
Solving the loop equation with q = 0 at t = 0 gives:
- q(t) = CE(1 − e^(−t/RC))
- V_C(t) = E(1 − e^(−t/RC))
- I(t) = (E/R) e^(−t/RC)
After t = RC, the capacitor reaches 1 − 1/e, which is about 63% of its final voltage. The current has dropped to about 37% of its initial value.
Discharging
Now remove the cell and let a capacitor with initial voltage V₀ discharge through R. The loop rule gives q/C + IR = 0, so:
- V_C(t) = V₀ e^(−t/RC)
- I(t) = (V₀/R) e^(−t/RC), flowing in the direction opposite to the charging current
After t = RC the voltage has fallen to about 37% of V₀.
Computing it
The code below uses the circuit from the spine: E = 10 V, R = 1 kΩ, C = 100 µF, so RC = 0.1 s.
import math
def charging_voltage(E, R, C, t):
return E * (1 - math.exp(-t / (R * C)))
def discharging_voltage(V0, R, C, t):
return V0 * math.exp(-t / (R * C))
E, R, C = 10.0, 1e3, 100e-6 # time constant RC = 0.1 s
print(charging_voltage(E, R, C, 0.1)) # about 63.2 percent of E
print(discharging_voltage(E, R, C, 0.1)) # about 36.8 percent of EThe output is about 6.32 V and 3.68 V.
Common errors
- Treating the capacitor as fully charged after one time constant. It is only at 63%. Use about 5RC as the practical "fully charged" time.
- Assuming the final charge depends on R. The final charge is CE. R only affects how fast it gets there.
- Mixing up the current and the voltage. In charging, voltage rises while current falls.
- Forgetting the energy split. The cell supplies CE² in total. Half is stored in the capacitor and half is lost as heat in R, whatever the value of R.
- Using the wrong initial conditions. At t = 0 an uncharged capacitor acts like a wire. After a long time, it acts like a broken wire (open circuit) and carries no current.
Exercise
A 2 µF capacitor, initially uncharged, charges through a 500 kΩ resistor from a 12 V cell. Find the time constant, the capacitor voltage after 1 s, and the current at that moment.
Show answer
The time constant is RC = 500×10³ × 2×10⁻⁶ = 1 s. After t = 1 s, V = 12(1 − e^(−1)) ≈ 12 × 0.632 ≈ 7.58 V. The current is I = (E/R) e^(−1) = (12/500000) × 0.368 ≈ 8.8 µA.