Learn & build · Electronics · Chapter 2
Capacitors and time
In chapter 1 everything happened instantly: change a resistor and the current changes right away. Add a capacitor and circuits start to have memory and time. That's how a camera flash stores a jolt, how a button press gets cleaned up, and how the radio course's filters keep one station and drop the rest.
1. Filling the bucket
A battery charges a capacitor through a resistor. Press Charge and watch in real time; then Discharge to let it empty through the same resistor. The graph shows the capacitor's voltage.
The curve always has the same shape, just stretched. Multiply R by C and you get the time constant, τ ("tau"), in seconds: after one τ the capacitor is 63% full, after five it's practically full. A bigger bucket or a narrower pipe both make it slower. That one number, R × C, is the clock of every circuit in this chapter.
The math, step by step
A capacitor stores charge in proportion to its voltage, \(Q = C V\), so the current into it is \(I = C \, dV/dt\): how fast the voltage climbs. The resistor sets that current from the voltage still left across it, \(I = (V_s - V)/R\). Put them together:
\[ RC \frac{dV}{dt} = V_s - V \quad\Longrightarrow\quad V(t) = V_s \left(1 - e^{-t / RC}\right) \]
The speed of filling is proportional to how far it still has to go, the same law as coffee cooling down. With \(\tau = RC\): after \(\tau\), \(1 - e^{-1} = 63\%\); after \(2\tau\), 86%; \(3\tau\), 95%; \(5\tau\), 99.3%. Units work out by themselves: ohms × farads = seconds. 10 kΩ × 100 µF = 1 s.
10 kΩ and 100 µF. What is the time constant τ?
How full is the capacitor after 3 τ? (Percent, nearest whole number.)
🎯 Challenge: make the capacitor reach 63% in exactly 1 second (τ = 1 s, within 5%).
A capacitor fills like a bucket through a pipe: fast at first, slower as it fills, and \(R \times C\) seconds sets the pace.
Where it breaks: "full after 5τ" isn't full enough for a chip
After 5τ the capacitor is 99.3% full, still 0.67% short. For your eye that's full. For chapter 1's 12-bit ADC, which splits 3.3 V into 4,096 steps, 0.67% is about 27 steps of error. To get within one step, the gap \(e^{-t/\tau}\) has to shrink below \(1/4096\), which takes \(t = \tau \ln 4096 \approx 8.3\,\tau\). That's why ADC datasheets give a minimum sampling time, and why a sensor with a big resistance in front of an ADC reads wrong if the chip samples too quickly: it takes its reading before the ADC's own small capacitor has finished filling.
2. Running on stored charge
The battery fills a big capacitor, which also feeds an LED through a resistor. Now unplug the battery: the LED keeps glowing on the stored charge, then fades as the bucket empties.
🎯 Challenge: keep the LED visibly lit (above 1 mA) for at least 3 seconds after unplugging.
This is exactly what keeps an Arduino from resetting when a motor briefly pulls the supply down, and why a TV's power light fades after you unplug it.
The LED fades slowly at first and then seems to switch off fairly suddenly, even though the capacitor's voltage falls smoothly. Why?
3. The simplest filter
Now feed the resistor and capacitor a wave instead of a steady battery. A slow wave gives the capacitor time to fill and empty, so the output follows the input. A fast wave flips before the bucket can respond, so the output barely moves. That's a low-pass filter: low frequencies pass, high ones are squashed.
"Slow" and "fast" have a number. A wave that repeats \(f\) times a second has a frequency of \(f\) hertz (Hz); one repeat takes \(1/f\) seconds, its period. The mains hum is 60 Hz, one wiggle every 16.7 ms; a whistle is a few thousand hertz. The sine wave below is the smoothest repeating shape, the one a swinging pendulum traces out over time.
The dividing line is the cutoff frequency, fc = 1 / (2π·R·C): there the output is about 71% of the input. Each ten times higher in frequency, it drops ten times further. Try a square wave too: its sharp corners are made of high frequencies, so the filter rounds them off into curves. In the radio course this same idea, done with numbers instead of parts, is how one station gets picked out of the air (Radio ch. 6: averaging is filtering), and an FM radio's "75 µs de-emphasis" is exactly this circuit with R × C = 75 µs (Radio ch. 9).
The math, step by step
For a sine wave of frequency \(f\), a capacitor behaves like a resistance that shrinks as frequency rises, its reactance \(X_C = 1/(2\pi f C)\). The RC filter is then a voltage divider (chapter 1) between \(R\) and \(X_C\), except that the two are 90° out of step, so they add like the sides of a right triangle:
\[ \frac{V_{\text{out}}}{V_{\text{in}}} = \frac{X_C}{\sqrt{R^2 + X_C^2}} = \frac{1}{\sqrt{1 + (f / f_c)^2}}, \qquad f_c = \frac{1}{2 \pi R C} \]
At \(f = f_c\): \(1/\sqrt 2 = 0.707\), the 71%. Far above it, \(f / f_c\) dominates and the gain is about \(f_c / f\): ten times the frequency, a tenth of the output. In decibels (\(20 \log_{10}\)), that's −3 dB at the cutoff and −20 dB per decade beyond.
1 kΩ and 1 µF. What's the cutoff frequency? (Nearest hertz.)
Well above the cutoff, at \(f = 10 f_c\), roughly what fraction of the input gets through?
🎯 Challenge: build a filter that lets a 100 Hz hum through (at least 90%) but cuts a 10 kHz whine below 10%.
Build the capacitor circuits yourself, with a switch, in the circuit lab (try its "Charge a capacitor with a switch" example).
Next: coils and resonance, where a capacitor and an inductor pass energy back and forth and a circuit starts to ring at one frequency, which is how a radio tunes.
Previous: Voltage, current, resistance · All chapters: Learn & build. Simulated step by step by our own solver (learn/circuit.js, trapezoidal integration).
Last updated