Sub topic 10
Charging and Discharging Through a Resistor: The Time Constant
This chapter assumes you know Ohm's law, Kirchhoff's voltage and current laws, the exponential function, and the capacitor relations Q = CV and i = C dv/dt. It also assumes you know that a capacitor's voltage cannot jump and that a capacitor acts as an open circuit in DC steady state. Here those facts combine to give the first-order RC circuit.
The circuit and the question
Put a resistor R in series with a capacitor C and a DC source Vs. A switch closes at t = 0. The capacitor starts uncharged, so vC(0) = 0 V. The question is how vC and the current i change with time.
Two facts from earlier chapters set the answer:
- Voltage continuity: vC just after the switch closes equals vC just before, so vC(0⁺) = 0 V.
- DC steady state: after a long time the current stops, so the capacitor holds vC = Vs and acts like an open circuit.
The transient is the path between these two states.
Deriving the charging equation
Apply KVL around the loop for t > 0:
Vs = R·i + vC
The capacitor current is i = C dvC/dt. Substituting gives a first-order differential equation:
RC · dvC/dt + vC = Vs
Rearrange so the variables separate:
dvC / (Vs − vC) = dt / (RC)
Integrate both sides and apply vC(0) = 0:
−ln(Vs − vC) + ln(Vs) = t / (RC)
Solving for vC:
vC(t) = Vs (1 − e^(−t/RC))
Differentiate to get the current:
i(t) = C dvC/dt = (Vs / R) e^(−t/RC)
At t = 0⁺ the capacitor voltage is zero, so the resistor sees the full source voltage and i(0⁺) = Vs/R. The uncharged capacitor behaves like a short circuit at that instant. As vC rises, the voltage across R falls, and the current decays toward zero.
The time constant τ = RC
The product τ = RC has units of seconds: ohms times farads reduce to volts per ampere times coulombs per volt, which is coulombs per ampere, which is seconds. The time constant sets the speed of every change in the circuit. A larger R limits the current and slows charging. A larger C needs more charge for the same voltage and also slows charging.
Substituting τ gives the compact form:
vC(t) = Vs (1 − e^(−t/τ))
A useful property is that the initial slope of vC is Vs/τ. If the voltage kept rising at that initial rate, it would reach Vs exactly at t = τ. The exponential curve flattens before that, so at t = τ the voltage has reached only 63.2% of Vs.
| Time | Fraction of final value reached | vC for Vs = 5 V |
|---|---|---|
| 1τ | 63.2% | 3.16 V |
| 2τ | 86.5% | 4.32 V |
| 3τ | 95.0% | 4.75 V |
| 4τ | 98.2% | 4.91 V |
| 5τ | 99.3% | 4.97 V |
The exponential never reaches Vs in finite time. In practice, engineers treat the circuit as settled after about 5τ, when it is within 1% of the final value. Which tolerance is acceptable depends on the application. A 12-bit converter that must settle within half a least-significant bit (about 0.012%) needs roughly 9τ.
The following program prints the charging curve for R = 10 kΩ and C = 100 µF, so τ = 1 s:
import math
Vs = 5.0 # source voltage in volts
R = 10e3 # resistance in ohms
C = 100e-6 # capacitance in farads
tau = R * C # time constant in seconds (1.0 s here)
for k in range(0, 6):
t = k * tau
vc = Vs * (1 - math.exp(-t / tau))
print(f"t = {k} tau: vC = {vc:.3f} V")The output matches the table: 0.000, 3.160, 4.323, 4.752, 4.908, and 4.966 V.
Discharging
Now suppose the capacitor holds an initial voltage V0 and the source is replaced by a short circuit (or the capacitor is connected across R alone). KVL gives:
R·i + vC = 0, with i = C dvC/dt
So RC · dvC/dt + vC = 0, which separates into dvC/vC = −dt/(RC). With vC(0) = V0:
vC(t) = V0 e^(−t/τ)
The current is i = C dvC/dt = −(V0/R) e^(−t/τ). The negative sign only reflects the reference direction. If i is defined as flowing into the capacitor's positive plate, then during discharge the current flows out of that plate.
After one time constant, the voltage has fallen to 36.8% of V0. After 5τ it is below 1% of V0.
| Time | Fraction of V0 remaining | vC for V0 = 5 V |
|---|---|---|
| 1τ | 36.8% | 1.84 V |
| 2τ | 13.5% | 0.68 V |
| 3τ | 5.0% | 0.25 V |
| 5τ | 0.67% | 0.03 V |
The general first-order solution
Charging and discharging are special cases of one formula. Any first-order circuit with a constant source obeys:
v(t) = v(∞) + [v(0⁺) − v(∞)] e^(−t/τ)
You need three numbers:
- The initial value v(0⁺), found from voltage continuity.
- The final value v(∞), found by replacing the capacitor with an open circuit.
- The time constant τ = Rth · C, where Rth is the Thevenin resistance seen by the capacitor with independent sources turned off.
Check the formula against both cases. Charging has v(0⁺) = 0 and v(∞) = Vs, which gives Vs(1 − e^(−t/τ)). Discharging has v(0⁺) = V0 and v(∞) = 0, which gives V0 e^(−t/τ).
The same formula covers a capacitor that is only partly charged. If vC starts at 2 V and the source is 5 V, then vC(t) = 5 + (2 − 5)e^(−t/τ) = 5 − 3e^(−t/τ).
Worked example with a larger network
A 12 V source feeds a 4 kΩ resistor in series with a node. At that node, a 12 kΩ resistor connects to ground, and a 2 µF capacitor also connects to ground. The capacitor is initially uncharged, and the source is connected at t = 0.
- Initial value: vC(0⁺) = 0 V.
- Final value: the capacitor is open, so the 4 kΩ and 12 kΩ resistors form a divider. v(∞) = 12 × 12/(4 + 12) = 9 V.
- Time constant: with the source turned off (replaced by a short), the capacitor sees 4 kΩ in parallel with 12 kΩ, which is 3 kΩ. So τ = 3 kΩ × 2 µF = 6 ms.
The result is vC(t) = 9(1 − e^(−t/6 ms)) V. Note that the final voltage is 9 V and not 12 V, and that τ uses the 3 kΩ Thevenin resistance and not the 4 kΩ resistor alone.
Finding time from voltage
You can invert the charging equation to find how long it takes to reach a target voltage VT:
t = −τ ln(1 − VT/Vs)
For the 10 kΩ, 100 µF circuit with Vs = 5 V, reaching 4 V takes t = −1 × ln(0.2) = 1.61 s. This is the basis of simple timer circuits, where a comparator fires when vC crosses a threshold.
For discharge from V0 down to VT, the time is t = τ ln(V0/VT).
Two shortcuts are handy. The time to reach 50% is 0.693τ, and the 10%-to-90% rise time is about 2.2τ.
Common errors
- Using the wrong resistance. The τ is based on the resistance the capacitor actually sees, not the resistor nearest to it in the drawing. Turn sources off and find R_th.
- Forgetting v(∞). In circuits with dividers or several sources, the final voltage is not equal to the source voltage.
- Mixing units. Keep R in ohms and C in farads, or use kΩ with µF to get milliseconds. A 10 kΩ and 100 µF pair gives 1 s, not 1 ms.
- Confusing voltage and current shapes. In charging, vC rises and i falls. The current can jump at t = 0, but vC cannot.
- Treating 5τ as exact. It is a convention for roughly 99% settling, not a physical limit.
- Applying the formula to a circuit with a switch that changes again. Each switching event starts a new interval, and the new v(0⁺) is the voltage at the end of the previous interval.
Checking a result numerically
You can verify an analytic answer by stepping the differential equation forward in small time steps. This Euler simulation compares with the exact formula:
import math
Vs = 5.0
R = 10e3
C = 100e-6
tau = R * C
dt = 0.001
vc = 0.0
t = 0.0
while t < 3 * tau:
i = (Vs - vc) / R # KVL: current through the resistor
vc += (i / C) * dt # i = C dv/dt, so dv = (i / C) dt
t += dt
exact = Vs * (1 - math.exp(-t / tau))
print(f"t = {t:.3f} s, simulated = {vc:.4f} V, exact = {exact:.4f} V")The two values agree to about three decimal places because dt is much smaller than τ. If you raise dt to a value near τ, the simulation drifts from the exact curve, which shows why the step must be small relative to the time constant.
Exercise
A 22 kΩ resistor charges a 47 µF capacitor from a 9 V source. The capacitor starts at 0 V. (a) Find τ. (b) Find vC at t = 1.034 s. (c) How long does it take for vC to reach 6 V? (d) What is the current at t = 0⁺?
Show answer
(a) τ = RC = 22 000 × 47 × 10⁻⁶ = 1.034 s. (b) At t = τ, vC = 9 × (1 − e^(−1)) = 9 × 0.632 = 5.69 V. (c) t = −τ ln(1 − 6/9) = −1.034 × ln(0.3333) = 1.034 × 1.0986 = 1.136 s. (d) i(0⁺) = Vs/R = 9 / 22 000 = 0.409 mA, because the uncharged capacitor acts as a short circuit at that instant.
Exercise
A capacitor charged to 10 V discharges through a 2 kΩ resistor. After 6 ms the voltage is 3.68 V. Find C.
Show answer
For discharge, vC = V0 e^(−t/τ). So 3.68/10 = e^(−t/τ), which is 0.368 = e^(−1). This means t = τ, so τ = 6 ms. Then C = τ/R = 0.006 / 2000 = 3 µF.