Capacitors in Circuits
A microcontroller board resets every time a motor starts. The fix printed in every application note is "add a 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 . Current is the rate of change of charge, so with the passive sign convention (current entering the + terminal, see Circuit Elements):
Three consequences follow directly.
- Constant voltage, zero current. In a DC steady state, , so a capacitor acts as an open circuit.
- Voltage cannot jump. A step in would need an infinite current. In any real circuit with finite currents, the capacitor voltage is continuous: . The current can jump.
- 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 :
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 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.
Series and parallel
Capacitors in parallel share one voltage, and their charges add: . In series they carry the same current, so the same charge, and their voltages add:
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: with the voltage of the figure: in , held to , back to at .
Find: on each segment, the peak stored energy and the power at .
Solve:
Check: the charge delivered while rising, , equals ; the falling segment removes the same in half the time, so twice the current.
Worked example 2: DC steady state
Given: , , , across , switched on long ago.
Find: and the stored energy.
Solve: in steady state is open, so and form a divider:
Check: no current flows in , so the divider current flows in both resistors. How long "long ago" must be is the subject of First-Order RC Circuits: here the time constant is .
In Python: the element law and the combinations
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 and the capacitor current dies away to zero: at the end the capacitor is the open circuit of the DC analysis.
Drag the time slider to the end: reads and is essentially zero. At the capacitor current is , because an uncharged capacitor starts as a short circuit.
Guided lab: see i = C dv/dt on a scope
Hand calculation. Drive a film capacitor in series with a sense resistor from a function generator set to a triangle wave, peak-to-peak at . The voltage changes by every half period of , so and : a square wave. Across that is . (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 .
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 within about 10 %: film capacitors are typically or 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, 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. holds when enters the terminal marked +; with the opposite reference, .
- 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
- A capacitor charged with a constant . How long until it reaches from zero?
- Two capacitors, and , in series across DC (both start uncharged). Find the voltage on each.
- The supply capacitor of the opening story is at . A motor starts and draws an extra for before the regulator responds. How far does the rail sag if the capacitor alone supplies it?
Answer
- .
- Same charge , , : , . The smaller capacitor takes the larger voltage.
- : from to , 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…
- a short circuit
- an open circuit
- a resistor of value
- a voltage source of zero volts
Which quantity of a capacitor cannot change instantaneously in a circuit with finite currents?
- its current
- its voltage
- its power
- neither
Capacitors of and in series give…
A capacitor charged to stores about…