Transient and the RC time constant

Run a transient analysis of an RC circuit, read the time constant off the curve, and work out when a following gate actually switches.

Lesson
E1.3
Time
25 min
Runs on
ngspice
Check
5 questions

A power-on reset holds a chip in reset while its supply and clocks come up. One design charged a 10 nF capacitor through 100 kΩ, so R·C = 1 ms, chosen "so reset lasts 1 ms". The buffer after it switched at half the 1.8 V supply, so reset ended after 0.69 ms, before a slow oscillator had started.

TransientThe reset input, sized for R·C = 1 msThe supply ramps to 1.8 V in 1 µs and v(por) charges through 100 kΩ into 10 nF. The buffer leaves reset when v(por) crosses 0.9 V.
  • v(vdd)
  • v(por)
00.5 V1.0 V1.5 V2.0 VVoltage00.5 ms1.0 ms1.5 ms2.0 ms2.5 ms3.0 msTimebuffer switches at 0.9 Vreset endsR·C = 1 ms00.5 V1.0 V1.5 V2.0 VVoltage01 ms2 ms3 msTimebuffer switches at 0.9 Vreset endsR·C = 1 ms
  1. Time 693.6 µsv(vdd) = 1.8 V · v(por) = 900 mV

    v(por) crosses 0.9 V at 0.694 ms. The buffer flips and the chip leaves reset, 0.31 ms early.

  2. Time 1 msv(vdd) = 1.8 V · v(por) = 1.137 V

    At 1 ms, where the design expected reset to end, v(por) is already 1.137 V, well past the threshold.

Read the plot as a table
Timev(vdd)v(por)
0 s0 V0 V
500 µs1.8 V707.7 mV
693.6 µs1.8 V900 mV
1 ms1.8 V1.137 V
1.5 ms1.8 V1.398 V
2 ms1.8 V1.556 V
2.5 ms1.8 V1.652 V
3 ms1.8 V1.71 V

Measured on ngspice 42 (500 of the run's 3014 time points).

R·C says how fast a capacitor charges; the threshold of the next gate says when anything happens.

The curve a capacitor follows

A 1 V step into an RC low-passR1 = 1 kΩ feeds C1 = 1 nF, so τ = R1C1 = 1 µs.
A 1 V step into an RC low-pass+−V1step 0 → 1 VR11 kΩC11 nFoutin
  1. The step arrives

    At t = 0 the source jumps to 1 V. The capacitor holds 0 V, so all of the 1 V sits across R1 and 1 mA flows into C1.

    i = 1 mA

  2. The charge slows down

    Each bit of charge raises vout, which leaves less voltage across R1 and so less current. At one time constant the current has fallen to 0.37 mA.

    i = 0.37 mA

  3. Settled

    After about five time constants vout is within 1 % of 1 V and the current is almost zero. The capacitor now acts as an open circuit.

Read the circuit as text
  • V1 voltage source (step 0 → 1 V): + → in, − → 0
  • R1 resistor (1 kΩ): pin 1 → in, pin 2 → n1
  • C1 capacitor (1 nF): pin 1 → n1, pin 2 → 0
  • out port: terminal → n1

Node 0 is ground. The source, R1 and C1 are the netlist lines of the lab below.

A capacitor stores charge, and its current is i = C·dv/dt, so a fast change of voltage needs a large current. A resistor in series limits that current, so the capacitor voltage cannot jump; it moves along a curve.

Watch the curve first: the plot below is the transient run of the lab netlist, where the input steps from 0 to 1 V and vout follows. The lower panel is the current of the source, i(v1). Step through it and read the values at each stop.

That current is negative. SPICE counts a voltage source's current as positive when it flows into the + terminal, so a source that delivers charge reads below zero. The schematic shows the real direction: 1 mA out of the + terminal, which SPICE prints as −1 mA.

Transientv(out) after a 1 V step, measuredThe run of the lab netlist on ngspice 42: the voltages above, the source current below. Drag across the plot to read all three curves.
  • v(in)
  • v(out)
  • i(v1)
00.2 V0.4 V0.6 V0.8 V1.0 V1.2 VVoltage-1.2 mA-1.0 mA-0.8 mA-0.6 mA-0.4 mA-0.2 mA0Source current02 µs4 µs6 µs8 µs10 µsTime50 %63.2 %t = τt = 5τ00.5 V1.0 V1.5 VVoltage-1.5 mA-1.0 mA-0.5 mA0Source current05 µs10 µsTime50 %63.2 %t = τt = 5τ
  1. Time 1 nsv(in) = 1 V · v(out) = 499.9 µV · i(v1) = -999.5 µA

    The input reaches 1 V after its 1 ns edge. vout is still almost 0 V: the capacitor has no charge yet. All of the 1 V is across R1, so 1 mA flows and i(v1) reads −1 mA.

  2. Time 693.7 nsv(in) = 1 V · v(out) = 500 mV · i(v1) = -500 µA

    vout crosses 0.5 V at 693.7 ns. That is ln 2 · τ = 0.693 τ, plus half of the 1 ns edge. Half the step is left across R1, so the current is half too: −0.5 mA.

    More context

    A gate that switches at half the supply switches here, well before one time constant.

  3. Time 1 µsv(in) = 1 V · v(out) = 631.9 mV · i(v1) = -368.1 µA

    One time constant: vout = 631.9 mV. The formula gives 1 − e−1 = 632.1 mV; the edge started the charge 0.5 ns late. The current has fallen to e−1 of its start, −0.37 mA.

  4. Time 2.303 µsv(in) = 1 V · v(out) = 900 mV · i(v1) = -100 µA

    vout reaches 90 % at 2.303 µs, which is ln 10 · τ. The current is down to a tenth: −0.1 mA.

  5. Time 5 µsv(in) = 1 V · v(out) = 993.3 mV · i(v1) = -6.741 µA

    Five time constants: vout = 993.3 mV, within 0.7 % of its final value. The current is almost zero (−6.7 µA).

Read the plot as a table
Timev(in)v(out)i(v1)
0 s0 V0 V0 A
1 ns1 V499.9 µV-999.5 µA
693.7 ns1 V500 mV-500 µA
1 µs1 V631.9 mV-368.1 µA
2 µs1 V864.6 mV-135.4 µA
2.303 µs1 V900 mV-100 µA
4 µs1 V981.7 mV-18.33 µA
5 µs1 V993.3 mV-6.741 µA
6 µs1 V997.5 mV-2.48 µA
8 µs1 V999.7 mV-335.6 nA
10 µs1 V1 V-45.42 nA

Every point is from a run of the lab netlist on ngspice 42 (500 of its 1016 time points).

Now give it a name. Charged through a resistor from a step of V, the capacitor follows v(t) = V·(1 − e−t/τ). The time constant τ = R1C1 sets the scale of the time axis, and here τ = 1 kΩ × 1 nF = 1 µs. Double either part and every time on the plot doubles with it.

Milestones in time constants

Solve v(t) = V·(1 − e−t/τ) for the time at which the output reaches a fraction f of the step: t = τ · ln(1/(1 − f)). Five fractions come up again and again.

Fraction of the stepTimeFormulaMeasured on the lab
50 %0.693 τln 2 · τt50 = 6.936531e-07
63.2 %1 τ1 − e−1 = 0.632v_tau = 6.319360e-01
10 % to 90 %2.197 τln 9 · τt10_90 = 2.197212e-06
99 % (settled within 1 %)4.605 τln 100 · τt99 = 4.605639e-06
99.3 %5 τ1 − e−5 = 0.9933v_5tau = 9.932589e-01

τ = 1 µs. The measured times and values include half of the 1 ns input edge.

The 63.2 % point defines τ, but no gate cares about 63.2 %. A gate switches at its switching threshold VM: the input voltage at which its output flips. For a CMOS buffer VM is often about half the supply. The time to reach it is t = τ · ln(V/(V − VM)), which is 0.693 τ at half the supply.

So the reset of the hook ended at 0.69 ms, with τ = 100 kΩ × 10 nF = 1 ms. To hold reset for 1 ms, size the RC for the threshold instead: τ = 1 ms / ln 2 = 1.44 ms.

Sized for τ = 1 ms

VDD vdd 0 PULSE(0 1.8 0 1u 1u 1 2)
R1 vdd por 100k
C1 por 0 10n
.control
tran 1u 5m
meas tran t_reset WHEN v(por)=0.9 RISE=1
.endc

t_reset = 6.936472e-04: the buffer leaves reset after 0.69 ms.

Sized for the 0.9 V threshold

VDD vdd 0 PULSE(0 1.8 0 1u 1u 1 2)
R1 vdd por 144.27k
C1 por 0 10n
.control
tran 1u 5m
meas tran t_reset WHEN v(por)=0.9 RISE=1
.endc

t_reset = 1.000503e-03: τ = 1.44 ms puts the half-supply crossing at 1 ms.

Both measured on ngspice 42. The extra 0.5 µs is half of the supply's 1 µs ramp.

How a transient run steps through time

A transient analysis integrates the circuit through time, and you start one with tran tstep tstop. The solver picks its own internal steps: short ones where voltages change fast, long ones where they settle. tstep is the print interval, and by default it also caps the step. The cap is the smaller of tstep and (tstop − tstart)/50, unless you give a fourth number, tmax.

Before the first step, the solver finds the operating point: the DC state with every source at its time-zero value and every capacitor open. The lab's pulse starts at 0 V, so the capacitor starts empty. The keyword uic (use initial conditions) skips that solve. The run then starts from .ic values, or from 0 V on every node.

  1. PULSE(v1 v2 delay rise fall width period)

    A trapezoid that repeats every period. The lab uses 0 to 1 V, no delay, 1 ns edges, 20 µs high, 40 µs period.

  2. SIN(offset amplitude freq)

    A sine wave around an offset, for E1.6 and the amplifiers later.

  3. PWL(t1 v1 t2 v2 ...)

    Straight lines between listed points: a supply ramp, a glitch, any shape you can tabulate.

An edge never has zero rise time. If you write 0 for the rise of a PULSE, ngspice uses tstep instead. With tran 10n 10u that is a 10 ns edge, so the 50 % crossing moves from 693.7 ns to 698.2 ns. With tran 1n 10u it comes back to 693.6 ns.

Asked in interviews
  1. What is an RC time constant?

    τ = RC, the time an RC takes to reach 63.2 % of a step, or 1 − 1/e. Every time on the charging curve scales with it: double R or C and every time doubles.

  2. How long does an RC take to reach half the supply?

    ln 2 · τ, about 0.69 τ. A gate that switches at half the supply therefore switches well before one time constant. Size a delay for the switching threshold VM: t = τ·ln(V/(V − VM)).

  3. How many time constants to settle within 1 %?

    ln 100 ≈ 4.6 τ for 1 %. Five τ gives 99.3 %, seven τ gives 99.9 %. Settling to the resolution of an ADC takes more: about (N + 1)·ln 2 · τ for half an LSB of N bits.

  4. What does uic do in a SPICE transient?

    It skips the operating-point solve. Capacitors and nodes start from .ic values or IC= on the element, or from 0 V. Without uic, the run starts from the DC solution, so a capacitor on a DC source starts fully charged.

Try it

Run the netlist and read the five meas lines, then open Plots to see the same curve as the figure. FIND ... AT reads a value at a time, WHEN finds the time a value is crossed, and TRIG ... TARG measures the time between two crossings.

Now change C1 out 0 1n to 2n and predict every number before you run. τ doubles to 2 µs, so t50 should double and v_tau should drop to the value at τ/2. Then set the pulse rise to 0 and see t50 move by about half of tstep.

SPICEngspice 42 · simulator service
Edit the netlist, then run it
Expected measurements: v_tau = 6.319360e-01 t50 = 6.936531e-07 t10_90 = 2.197212e-06 targ= 2.303078e-06 trig= 1.058659e-07 v_5tau = 9.932589e-01 t99 = 4.605639e-06

Check yourself

Predict the outputThis netlist drives the same RC from a plain 1 V DC source and runs tran without uic. Type the line meas prints, in the format ngspice uses (for example v1u = 6.319360e-01).
* the RC on a plain 1 V DC source
V1 in 0 1
R1 in out 1k
C1 out 0 1n
.control
tran 10n 5u
meas tran v1u FIND v(out) AT=1u
.endc
.end
ConceptOn the plot, vout crosses 50 % at 0.69 µs although τ = 1 µs. Why is the 50 % point not at τ?
ConceptAn RC with τ = 1 µs is charged by a 1 V step. About what is vout at t = 2 µs?
Conceptτ = 1 µs. Which source lets vout fall again before it has settled within 1 % of 1 V?
ConceptWhat does uic on a tran line change?

Remember

  • A capacitor charged through a resistor follows v(t) = V·(1 − e−t/τ), with τ = RC; every time on the curve scales with τ.
  • The output reaches 50 % at 0.693 τ, 63.2 % at τ, 90 % at 2.303 τ and 99.3 % at 5 τ; settling within 1 % takes 4.6 τ.
  • A following gate switches at its switching threshold VM, at t = τ · ln(V/(V − VM)); size a delay for that threshold, not for τ.
  • tran tstep tstop starts from the operating point unless uic is given; a PULSE edge written as 0 becomes tstep long.