TExcelTAD
Home › Circuit Theory & Network Analysis › First-Order RC Circuits

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 4 V4\ \text{V} on a 5 V5\ \text{V} rail. How long does the reset last with 10 kΩ10\ \text{k}\Omega and 4.7 μF4.7\ \mu\text{F}? 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 τ=RC\tau = RC, appears in timers, filters, debouncers, sample-and-hold circuits and every interconnect delay.

Intuition

+ - Vs 5 V t = 0 R 10 kOhm C 4.7 uF out + - vC i 5 V 3.16 V tau 5 tau vC(t)

Before the switch closes the capacitor is empty. At t=0+t = 0^+ its voltage is still zero (it cannot jump, see Capacitors in Circuits), so the whole 5 V5\ \text{V} sits across RR and the current is at its largest, Vs/RV_s/R. As the capacitor charges, the voltage across RR shrinks, so the current shrinks, so the charging slows. The voltage approaches VsV_s ever more slowly and never quite gets there: an exponential.

The lab draws vC(t)v_C(t) and i(t)i(t) against time measured in time constants. Every RC circuit gives the same picture on that axis; only the seconds change.

+-R = 10.0 kOhmswitch closed at t = 0V = 5.0 V, C = 4.70 uFtau = RC = 47.0 mst47.0 mst/tau1.00vC3.16 Vi184 uAvR1.84 V0.01.32.53.85.001 tau2 tau3 tau4 tau5 tau6 tautv (V)0 A250 uA500 uAi63.2 %5 tau: 99.3 %vC(t), capacitor voltagei(t)

At t=τt = \tau the lab reads τ=47 ms\tau = 47\ \text{ms}, vC=3.16 Vv_C = 3.16\ \text{V} (63.2 % of 5 V5\ \text{V}) and i=184 μAi = 184\ \mu\text{A}. Switch to "switch off" to see the discharge: the capacitor falls to 36.8 % of its start voltage after one τ\tau.

The differential equation and its solution

KVL round the loop after the switch closes, with i=C dvC/dti = C\,dv_C/dt:

Vs=RCdvCdt+vC⟺τdvCdt+vC=Vs,τ=RCV_s = R C \frac{dv_C}{dt} + v_C \qquad\Longleftrightarrow\qquad \tau \frac{dv_C}{dt} + v_C = V_s, \quad \tau = RC

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:

vC(t)=Vs+(vC(0+)−Vs)e−t/τ,t≥0v_C(t) = V_s + \left( v_C(0^+) - V_s \right) e^{-t/\tau}, \qquad t \ge 0

For charging from zero, vC=Vs(1−e−t/τ)v_C = V_s(1 - e^{-t/\tau}) and i=(Vs/R) e−t/τi = (V_s/R)\,e^{-t/\tau}. For discharging from V0V_0 through RR, vC=V0e−t/τv_C = V_0 e^{-t/\tau}.

Useful landmarks:

tt τ\tau 2τ2\tau 3τ3\tau 5τ5\tau
fraction of the change done 63.2 % 86.5 % 95.0 % 99.3 %

The time to reach a threshold vthv_\text{th} comes from solving for tt:

tth=τln⁡Vs−vC(0+)Vs−vtht_\text{th} = \tau \ln \frac{V_s - v_C(0^+)}{V_s - v_\text{th}}

Units check: Ω⋅F=(V/A)⋅(C/V)=C/A=s\Omega \cdot \text{F} = (\text{V/A}) \cdot (\text{C/V}) = \text{C/A} = \text{s}.

Worked example: the reset delay

Given: Vs=5 VV_s = 5\ \text{V}, R=10 kΩR = 10\ \text{k}\Omega, C=4.7 μFC = 4.7\ \mu\text{F}, capacitor empty, threshold 4 V4\ \text{V}.

Find: τ\tau, vCv_C at 20 ms20\ \text{ms}, the reset time, the initial current and the energy story.

Solve:

τ=10 kΩ⋅4.7 μF=47 msvC(20 ms)=5 V(1−e−20/47)=1.73 Vtth=47 ms⋅ln⁡5−05−4=47 ms⋅1.609=75.6 msi(0+)=5 V/10 kΩ=0.5 mA\begin{aligned} \tau &= 10\ \text{k}\Omega \cdot 4.7\ \mu\text{F} = 47\ \text{ms} \\ v_C(20\ \text{ms}) &= 5\ \text{V} \left(1 - e^{-20/47}\right) = 1.73\ \text{V} \\ t_\text{th} &= 47\ \text{ms} \cdot \ln \frac{5 - 0}{5 - 4} = 47\ \text{ms} \cdot 1.609 = 75.6\ \text{ms} \\ i(0^+) &= 5\ \text{V} / 10\ \text{k}\Omega = 0.5\ \text{mA} \end{aligned}

The capacitor ends with 12CVs2=58.8 μJ\tfrac{1}{2} C V_s^2 = 58.8\ \mu\text{J}. The source delivered QVs=CVs2=117.5 μJQ V_s = C V_s^2 = 117.5\ \mu\text{J}, so the resistor dissipated the other half, whatever the value of RR.

Check: 75.6 ms75.6\ \text{ms} is between τ\tau (63 %) and 2τ2\tau (86.5 %), and 4 V4\ \text{V} is 80 % of 5 V5\ \text{V}: 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

python · try it yourself
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 5 V5\ \text{V} step (a PULSE with 1 ns1\ \text{ns} edges), runs a transient and uses meas to find the time constant (where vCv_C crosses 63.2 %63.2\,\% of 5 V5\ \text{V}, 3.1606 V3.1606\ \text{V}), the 4 V4\ \text{V} crossing and the voltage at 20 ms20\ \text{ms}.

bash · try it yourself
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 1 ns1\ \text{ns} edge.

Guided lab: time an RC charge

Hand calculation. As above: τ=47 ms\tau = 47\ \text{ms}, vC(τ)=3.16 Vv_C(\tau) = 3.16\ \text{V}, 4 V4\ \text{V} at 75.6 ms75.6\ \text{ms}.

Simulation. The lab and the SPICE session above.

What you would measure. Build the circuit with a 10 kΩ10\ \text{k}\Omega 1 % resistor and a 4.7 μF4.7\ \mu\text{F} film capacitor (or an electrolytic, + to the resistor side). Drive it from a function generator set to a 00 to 5 V5\ \text{V} square wave at 2 Hz2\ \text{Hz} (half period 250 ms>5τ250\ \text{ms} > 5\tau). On the scope, trigger on the rising edge and use cursors: expect the 63 %63\,\% crossing at 47 ms47\ \text{ms} within about ±10 %\pm 10\,\%, dominated by the capacitor tolerance (±5 %\pm 5\,\% to ±20 %\pm 20\,\%). A 10× probe (10 MΩ10\ \text{M}\Omega) loads the node negligibly; a 1 MΩ1\ \text{M}\Omega 1× probe would shift τ\tau by about 1 %. Then compute C=τ/RC = \tau/R: this is how many people measure capacitance without a capacitance meter.

Hazards and safe setup. 5 V5\ \text{V} signals only. Electrolytic capacitors must not be reverse-biased: with a square wave going 00 to +5 V+5\ \text{V} they are fine, with a ±2.5 V\pm 2.5\ \text{V} wave they are not. Discharge large capacitors before handling.

Pitfalls

  • Forgetting the Thevenin resistance. In a bigger circuit, τ=RThC\tau = R_\text{Th} C where RThR_\text{Th} is the resistance the capacitor "sees" with sources zeroed (Thevenin and Norton Equivalents).
  • Using 5τ5\tau as "fully charged" in precision work. At 5τ5\tau the error is still 0.7 %0.7\,\%; a 12-bit ADC needs about 8.3τ8.3\tau (ln⁡212\ln 2^{12}) to settle within one LSB and 9τ9\tau (ln⁡213\ln 2^{13}) 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 vC(0+)=vC(0−)v_C(0^+) = v_C(0^-), not zero.

Practice

  1. A 3.3 V3.3\ \text{V} logic signal drives a 100 pF100\ \text{pF} load through a 1 kΩ1\ \text{k}\Omega series resistor. How long until the load reaches 2.0 V2.0\ \text{V}?
  2. A 100 μF100\ \mu\text{F} capacitor charged to 12 V12\ \text{V} discharges through 47 kΩ47\ \text{k}\Omega. When does it fall below 1 V1\ \text{V}?
  3. What fraction of its final value does an RC circuit reach after 0.1τ0.1\tau, and why is the start nearly a straight line?
Answer
  1. τ=100 ns\tau = 100\ \text{ns}; t=100 ns⋅ln⁡(3.3/1.3)=93 nst = 100\ \text{ns} \cdot \ln(3.3/1.3) = 93\ \text{ns}.
  2. τ=4.7 s\tau = 4.7\ \text{s}; t=4.7 s⋅ln⁡12=11.7 st = 4.7\ \text{s} \cdot \ln 12 = 11.7\ \text{s}. Bleed resistors on power supplies are sized with this formula.
  3. 1−e−0.1=9.5 %1 - e^{-0.1} = 9.5\,\%. For small tt, 1−e−t/τ≈t/τ1 - e^{-t/\tau} \approx t/\tau: the capacitor is charged by an almost constant current Vs/RV_s/R.

Test yourself

What is the time constant of 22 kΩ22\ \text{k}\Omega and 100 nF100\ \text{nF}?

  1. 2.2 ms2.2\ \text{ms}
  2. 22 μs22\ \mu\text{s}
  3. 0.22 s0.22\ \text{s}
  4. 220 μs220\ \mu\text{s}

After one time constant, a charging capacitor (from zero) is at about…

  1. 37 % of the final voltage
  2. 50 %
  3. 63 %
  4. 99 %

At t=0+t = 0^+, right after a step is applied to an uncharged RC circuit, the current is…

  1. zero
  2. Vs/RV_s/R
  3. VsCV_s C
  4. Vs/(RC)V_s/(RC)

Charging a capacitor to VsV_s from a voltage source through RR, the energy lost in RR is…

  1. zero if RR is small
  2. equal to the energy stored in CC
  3. twice the stored energy
  4. proportional to RR