TExcelTAD
Home › Circuit Theory & Network Analysis › Capacitors in Circuits

Capacitors in Circuits

A microcontroller board resets every time a motor starts. The fix printed in every application note is "add a 100 μF100\ \mu\text{F} capacitor across the supply". Why does a part that passes no DC current help? Because a capacitor resists changes of voltage: to change its voltage quickly, a large current must flow, and the capacitor supplies that current itself for a short time. This lesson turns that sentence into the circuit law you need for transients. The physics of plates and dielectrics is in Capacitance and Dielectrics; the real parts (ceramic, electrolytic, film, ESR, voltage rating) are in Capacitors and Inductors as Components.

The element law

An ideal capacitor stores charge q=Cvq = Cv. Current is the rate of change of charge, so with the passive sign convention (current entering the + terminal, see Circuit Elements):

i(t)=Cdvdt,v(t)=v(t0)+1C∫t0ti(τ) dτi(t) = C \frac{dv}{dt}, \qquad v(t) = v(t_0) + \frac{1}{C} \int_{t_0}^{t} i(\tau)\, d\tau

Three consequences follow directly.

  1. Constant voltage, zero current. In a DC steady state, dv/dt=0dv/dt = 0, so a capacitor acts as an open circuit.
  2. Voltage cannot jump. A step in vv would need an infinite current. In any real circuit with finite currents, the capacitor voltage is continuous: v(0+)=v(0−)v(0^+) = v(0^-). The current can jump.
  3. Memory. The voltage now depends on all the current that has flowed before. The capacitor's state is its voltage.

The energy stored is the integral of power p=vi=Cv dv/dtp = vi = Cv\,dv/dt:

w(t)=12Cv2(t)w(t) = \frac{1}{2} C v^2(t)

It depends only on the present voltage, not on how the capacitor got there. An ideal capacitor dissipates nothing: what it absorbs while charging it returns while discharging.

Intuition: current follows the slope

The figure shows a voltage made of straight segments. The current is CC times the slope of each segment: positive and constant while the voltage rises, zero while it holds, negative while it falls. A steeper fall gives a larger current.

10 V 0 v(t) 0.5 A 0 -1 A i(t) = C dv/dt 2 ms 4 ms 5 ms t

Series and parallel

Capacitors in parallel share one voltage, and their charges add: Ceq=C1+C2+⋯C_\text{eq} = C_1 + C_2 + \cdots. In series they carry the same current, so the same charge, and their voltages add:

1Ceq=1C1+1C2+⋯\frac{1}{C_\text{eq}} = \frac{1}{C_1} + \frac{1}{C_2} + \cdots

These are the opposite of the resistor rules. Two equal capacitors in series give half the capacitance; their voltage rating doubles only if they share the voltage evenly, which for electrolytics needs balancing resistors.

Worked example 1: current from a voltage waveform

Given: C=100 μFC = 100\ \mu\text{F} with the voltage of the figure: 0→10 V0 \to 10\ \text{V} in 2 ms2\ \text{ms}, held to 4 ms4\ \text{ms}, back to 00 at 5 ms5\ \text{ms}.

Find: i(t)i(t) on each segment, the peak stored energy and the power at t=1 mst = 1\ \text{ms}.

Solve:

i0-2=100 μF⋅10 V2 ms=0.5 Ai2-4=0i4-5=100 μF⋅−10 V1 ms=−1.0 Awmax=12⋅100 μF⋅(10 V)2=5.0 mJp(1 ms)=vi=5 V⋅0.5 A=2.5 W\begin{aligned} i_{0\text{-}2} &= 100\ \mu\text{F} \cdot \frac{10\ \text{V}}{2\ \text{ms}} = 0.5\ \text{A} \\ i_{2\text{-}4} &= 0 \\ i_{4\text{-}5} &= 100\ \mu\text{F} \cdot \frac{-10\ \text{V}}{1\ \text{ms}} = -1.0\ \text{A} \\ w_\text{max} &= \tfrac{1}{2} \cdot 100\ \mu\text{F} \cdot (10\ \text{V})^2 = 5.0\ \text{mJ} \\ p(1\ \text{ms}) &= v i = 5\ \text{V} \cdot 0.5\ \text{A} = 2.5\ \text{W} \end{aligned}

Check: the charge delivered while rising, 0.5 A⋅2 ms=1 mC0.5\ \text{A} \cdot 2\ \text{ms} = 1\ \text{mC}, equals CΔv=100 μF⋅10 VC \Delta v = 100\ \mu\text{F} \cdot 10\ \text{V}; the falling segment removes the same 1 mC1\ \text{mC} in half the time, so twice the current.

Worked example 2: DC steady state

+ - V1 12 V R1 2 kOhm R2 4 kOhm C1 10 uF c + - vC

Given: V1=12 VV_1 = 12\ \text{V}, R1=2 kΩR_1 = 2\ \text{k}\Omega, R2=4 kΩR_2 = 4\ \text{k}\Omega, C1=10 μFC_1 = 10\ \mu\text{F} across R2R_2, switched on long ago.

Find: vCv_C and the stored energy.

Solve: in steady state C1C_1 is open, so R1R_1 and R2R_2 form a divider:

vC=12 V⋅4 kΩ2 kΩ+4 kΩ=8.0 V,w=12⋅10 μF⋅(8.0 V)2=0.32 mJv_C = 12\ \text{V} \cdot \frac{4\ \text{k}\Omega}{2\ \text{k}\Omega + 4\ \text{k}\Omega} = 8.0\ \text{V}, \qquad w = \tfrac{1}{2} \cdot 10\ \mu\text{F} \cdot (8.0\ \text{V})^2 = 0.32\ \text{mJ}

Check: no current flows in C1C_1, so the divider current 12 V/6 kΩ=2 mA12\ \text{V}/6\ \text{k}\Omega = 2\ \text{mA} flows in both resistors. How long "long ago" must be is the subject of First-Order RC Circuits: here the time constant is (R1∥R2) C=1.33 kΩ⋅10 μF=13.3 ms(R_1 \parallel R_2)\,C = 1.33\ \text{k}\Omega \cdot 10\ \mu\text{F} = 13.3\ \text{ms}.

In Python: the element law and the combinations

python · try it yourself
import numpy as np

C = 100e-6
segments = [(0.0, 2e-3, 0.0, 10.0), (2e-3, 4e-3, 10.0, 10.0), (4e-3, 5e-3, 10.0, 0.0)]
for t0, t1, v0, v1 in segments:
    i = C * (v1 - v0) / (t1 - t0)
    print(f"{t0*1e3:.0f}-{t1*1e3:.0f} ms: i = {i:+.2f} A, charge moved = {i*(t1-t0)*1e3:+.2f} mC")
print(f"peak energy = {0.5*C*10.0**2*1e3:.2f} mJ")

# numerical check of i = C dv/dt on a sampled waveform
t = np.linspace(0, 5e-3, 5001)
v = np.interp(t, [0, 2e-3, 4e-3, 5e-3], [0, 10, 10, 0])
i = C * np.gradient(v, t)
print(f"sampled i at 1, 3, 4.5 ms: {float(i[1000]):.3f} {float(i[3000]):.3f} {float(i[4500]):.3f} A")

caps_uF = [10, 22, 47]
print(f"parallel: {sum(caps_uF):.1f} uF, series: {1/sum(1/c for c in caps_uF):.3f} uF")

V1, R1, R2, C1 = 12.0, 2e3, 4e3, 10e-6
vC = V1 * R2 / (R1 + R2)
print(f"DC steady state: vC = {vC:.2f} V, energy = {0.5*C1*vC**2*1e3:.3f} mJ, tau = {R1*R2/(R1+R2)*C1*1e3:.2f} ms")
0-2 ms: i = +0.50 A, charge moved = +1.00 mC
2-4 ms: i = +0.00 A, charge moved = +0.00 mC
4-5 ms: i = -1.00 A, charge moved = -1.00 mC
peak energy = 5.00 mJ
sampled i at 1, 3, 4.5 ms: 0.500 0.000 -1.000 A
parallel: 79.0 uF, series: 5.998 uF
DC steady state: vC = 8.00 V, energy = 0.320 mJ, tau = 13.33 ms

The series value is below the smallest capacitor, as it must be: three capacitors in series behave like one with the plates further apart.

Interactive: watch the capacitor reach its steady state

The netlist lab runs a transient of worked example 2 from an uncharged capacitor. The voltage rises towards 8 V8\ \text{V} and the capacitor current dies away to zero: at the end the capacitor is the open circuit of the DC analysis.

05020406080t (ms)V0 A2.0 mA4.0 mA6.0 mAI (A)V(c)I(C1)at t = 80.00 msV(in)12.0 VV(c)7.98 VI(V1)-2.01 mAI(R1)2.01 mAI(R2)2.00 mAI(C1)14.9 uA

Drag the time slider to the end: vcv_c reads 8 V8\ \text{V} and I(C1)I(C1) is essentially zero. At t=0t = 0 the capacitor current is 12 V/2 kΩ=6 mA12\ \text{V}/2\ \text{k}\Omega = 6\ \text{mA}, because an uncharged capacitor starts as a short circuit.

Guided lab: see i = C dv/dt on a scope

Hand calculation. Drive a 1 μF1\ \mu\text{F} film capacitor in series with a 100 Ω100\ \Omega sense resistor from a function generator set to a triangle wave, 2 V2\ \text{V} peak-to-peak at 100 Hz100\ \text{Hz}. The voltage changes by 2 V2\ \text{V} every half period of 5 ms5\ \text{ms}, so dv/dt=±400 V/sdv/dt = \pm 400\ \text{V/s} and i=±0.4 mAi = \pm 0.4\ \text{mA}: a square wave. Across 100 Ω100\ \Omega that is ±40 mV\pm 40\ \text{mV}. (The resistor drop is small, so the capacitor voltage is almost the full triangle.)

Simulation. Put the same circuit in the netlist lab or a SPICE deck with V1 in 0 PULSE(-1 1 0 5m 5m 0 10m): the current is a square wave of ±0.4 mA\pm 0.4\ \text{mA}.

What you would measure. Channel 1 on the generator output, channel 2 across the sense resistor (the scope grounds must both sit on the circuit ground, so put the resistor at the grounded end). Expect a square wave of ±40 mV\pm 40\ \text{mV} within about 10 %: film capacitors are typically ±5 %\pm 5\,\% or ±10 %\pm 10\,\% and the scope's vertical accuracy is a few percent. Double the frequency and the square wave doubles. Switch the generator to a sine wave and the current becomes a cosine, 90∘90^\circ ahead of the voltage: the start of Impedance and Admittance.

Hazards and safe setup. Signal-level voltages only. Electrolytic capacitors are polarised: reversed, they heat and can vent, so use a film or ceramic part here. A large charged capacitor is a hazard even after the supply is off (ESD, Stored Energy and Battery Hazards): discharge it through a resistor before handling, never with a screwdriver.

Pitfalls

  • Treating the capacitor current as continuous. Only the voltage is continuous; the current can jump at a switching instant.
  • Using the resistor rules. Series capacitors combine like parallel resistors, and vice versa.
  • Forgetting the sign convention. i=C dv/dti = C\,dv/dt holds when ii enters the terminal marked +; with the opposite reference, i=−C dv/dti = -C\,dv/dt.
  • Ideal versus real. Real capacitors have series resistance (ESR), leakage and a capacitance that can fall a lot with DC bias (class II ceramics). The ideal law is the first model, not the last.

Practice

  1. A 47 μF47\ \mu\text{F} capacitor charged with a constant 2 mA2\ \text{mA}. How long until it reaches 5 V5\ \text{V} from zero?
  2. Two capacitors, 4.7 μF4.7\ \mu\text{F} and 2.2 μF2.2\ \mu\text{F}, in series across 10 V10\ \text{V} DC (both start uncharged). Find the voltage on each.
  3. The supply capacitor of the opening story is 100 μF100\ \mu\text{F} at 5 V5\ \text{V}. A motor starts and draws an extra 0.5 A0.5\ \text{A} for 200 μs200\ \mu\text{s} before the regulator responds. How far does the rail sag if the capacitor alone supplies it?
Answer
  1. t=C Δv/i=47 μF⋅5 V/2 mA=0.1175 s≈118 mst = C\,\Delta v / i = 47\ \mu\text{F} \cdot 5\ \text{V} / 2\ \text{mA} = 0.1175\ \text{s} \approx 118\ \text{ms}.
  2. Same charge Q=CeqVQ = C_\text{eq} V, Ceq=4.7⋅2.2/6.9=1.499 μFC_\text{eq} = 4.7 \cdot 2.2/6.9 = 1.499\ \mu\text{F}, Q=14.99 μCQ = 14.99\ \mu\text{C}: v4.7=3.19 Vv_{4.7} = 3.19\ \text{V}, v2.2=6.81 Vv_{2.2} = 6.81\ \text{V}. The smaller capacitor takes the larger voltage.
  3. Δv=i Δt/C=0.5 A⋅200 μs/100 μF=1.0 V\Delta v = i\,\Delta t / C = 0.5\ \text{A} \cdot 200\ \mu\text{s} / 100\ \mu\text{F} = 1.0\ \text{V}: from 5 V5\ \text{V} to 4 V4\ \text{V}, enough to reset many boards. A bigger capacitor or a faster regulator is needed.

Test yourself

In a DC steady state, an ideal capacitor behaves like…

  1. a short circuit
  2. an open circuit
  3. a resistor of value 1/C1/C
  4. a voltage source of zero volts

Which quantity of a capacitor cannot change instantaneously in a circuit with finite currents?

  1. its current
  2. its voltage
  3. its power
  4. neither

Capacitors of 10 μF10\ \mu\text{F} and 10 μF10\ \mu\text{F} in series give…

  1. 20 μF20\ \mu\text{F}
  2. 10 μF10\ \mu\text{F}
  3. 5 μF5\ \mu\text{F}
  4. 100 μF100\ \mu\text{F}

A 220 μF220\ \mu\text{F} capacitor charged to 12 V12\ \text{V} stores about…

  1. 2.6 mJ2.6\ \text{mJ}
  2. 15.8 mJ15.8\ \text{mJ}
  3. 31.7 mJ31.7\ \text{mJ}
  4. 1.3 mJ1.3\ \text{mJ}