First-Order RC Circuits
A reset pin on a microcontroller is held low by a capacitor for a moment after power-up, then released when the capacitor has charged through a resistor. The datasheet says the pin reads "high" above on a rail. How long does the reset last with and ? This is the simplest transient: a circuit with one energy-storage element moving from one steady state to another. Its answer, an exponential with a time constant , appears in timers, filters, debouncers, sample-and-hold circuits and every interconnect delay.
Intuition
Before the switch closes the capacitor is empty. At its voltage is still zero (it cannot jump, see Capacitors in Circuits), so the whole sits across and the current is at its largest, . As the capacitor charges, the voltage across shrinks, so the current shrinks, so the charging slows. The voltage approaches ever more slowly and never quite gets there: an exponential.
The lab draws and against time measured in time constants. Every RC circuit gives the same picture on that axis; only the seconds change.
At the lab reads , (63.2 % of ) and . Switch to "switch off" to see the discharge: the capacitor falls to 36.8 % of its start voltage after one .
The differential equation and its solution
KVL round the loop after the switch closes, with :
A first-order linear ODE with constant input (Differential Equations in Circuits and, for the theory, Linear First-Order Equations). Its solution is the final value plus a decaying difference:
For charging from zero, and . For discharging from through , .
Useful landmarks:
| fraction of the change done | 63.2 % | 86.5 % | 95.0 % | 99.3 % |
The time to reach a threshold comes from solving for :
Units check: .
Worked example: the reset delay
Given: , , , capacitor empty, threshold .
Find: , at , the reset time, the initial current and the energy story.
Solve:
The capacitor ends with . The source delivered , so the resistor dissipated the other half, whatever the value of .
Check: is between (63 %) and (86.5 %), and is 80 % of : consistent. Real reset pins add a Schmitt-trigger hysteresis and a tolerance on the threshold, so a designer quotes a range, not one number.
In Python: closed form against a numerical ODE solver
import numpy as np
from scipy.integrate import solve_ivp
Vs, R, C = 5.0, 10e3, 4.7e-6
tau = R * C
vC = lambda t: Vs * (1 - np.exp(-t / tau))
print(f"tau = {tau*1e3:.1f} ms")
for t in [20e-3, tau, 2*tau, 5*tau]:
print(f"t = {t*1e3:6.1f} ms: vC = {float(vC(t)):.4f} V, i = {Vs/R*np.exp(-t/tau)*1e6:7.2f} uA")
print(f"time to 4 V: {tau*np.log(Vs/(Vs - 4.0))*1e3:.2f} ms")
sol = solve_ivp(lambda t, v: (Vs - v) / (R * C), (0, 0.3), [0.0], rtol=1e-9, atol=1e-12,
dense_output=True)
ts = np.linspace(0, 0.3, 301)
err = np.max(np.abs(sol.sol(ts)[0] - vC(ts)))
print(f"numerical and closed form agree within 1e-8 V: {bool(err < 1e-8)}")
print(f"energy in C = {0.5*C*Vs**2*1e6:.2f} uJ, from source = {C*Vs**2*1e6:.2f} uJ")tau = 47.0 ms
t = 20.0 ms: vC = 1.7329 V, i = 326.71 uA
t = 47.0 ms: vC = 3.1606 V, i = 183.94 uA
t = 94.0 ms: vC = 4.3233 V, i = 67.67 uA
t = 235.0 ms: vC = 4.9663 V, i = 3.37 uA
time to 4 V: 75.64 ms
numerical and closed form agree within 1e-8 V: True
energy in C = 58.75 uJ, from source = 117.50 uJ
Cross-check with SPICE
The deck applies a step (a PULSE with edges), runs a transient and uses meas to find the time constant (where crosses of , ), the crossing and the voltage at .
cat > rc.cir <<'EOF'
* RC charging: 5 V step into 10k and 4.7u
V1 in 0 PULSE(0 5 0 1n 1n 1 2)
R1 in out 10k
C1 out 0 4.7u
.control
tran 0.05m 300m
meas tran t63 when v(out)=3.1606 rise=1
meas tran t4v when v(out)=4 rise=1
meas tran v20m find v(out) at=20m
.endc
.end
EOF
ngspice -b rc.cir 2>&1 | grep -E '^(t63|t4v|v20m)' | awk '{print $1, $2, $3}'t63 = 4.699993e-02
t4v = 7.564358e-02
v20m = 1.732889e+00
SPICE agrees with the hand calculation to four or five significant figures; the small differences come from the time step and the edge.
Guided lab: time an RC charge
Hand calculation. As above: , , at .
Simulation. The lab and the SPICE session above.
What you would measure. Build the circuit with a 1 % resistor and a film capacitor (or an electrolytic, + to the resistor side). Drive it from a function generator set to a to square wave at (half period ). On the scope, trigger on the rising edge and use cursors: expect the crossing at within about , dominated by the capacitor tolerance ( to ). A 10× probe () loads the node negligibly; a 1× probe would shift by about 1 %. Then compute : this is how many people measure capacitance without a capacitance meter.
Hazards and safe setup. signals only. Electrolytic capacitors must not be reverse-biased: with a square wave going to they are fine, with a wave they are not. Discharge large capacitors before handling.
Pitfalls
- Forgetting the Thevenin resistance. In a bigger circuit, where is the resistance the capacitor "sees" with sources zeroed (Thevenin and Norton Equivalents).
- Using as "fully charged" in precision work. At the error is still ; a 12-bit ADC needs about () to settle within one LSB and () within half an LSB.
- The 50 % efficiency surprise. Charging a capacitor from a voltage source through any resistor wastes as much energy as it stores.
- Wrong initial value. If the capacitor starts charged, use , not zero.
Practice
- A logic signal drives a load through a series resistor. How long until the load reaches ?
- A capacitor charged to discharges through . When does it fall below ?
- What fraction of its final value does an RC circuit reach after , and why is the start nearly a straight line?
Answer
- ; .
- ; . Bleed resistors on power supplies are sized with this formula.
- . For small , : the capacitor is charged by an almost constant current .
Test yourself
What is the time constant of and ?
After one time constant, a charging capacitor (from zero) is at about…
- 37 % of the final voltage
- 50 %
- 63 %
- 99 %
At , right after a step is applied to an uncharged RC circuit, the current is…
- zero
Charging a capacitor to from a voltage source through , the energy lost in is…
- zero if is small
- equal to the energy stored in
- twice the stored energy
- proportional to