Sub topic 15
Where these transients matter: timers, filters, and switching supplies
This chapter assumes you can solve a first-order step response with the general formula x(t) = xfinal + (xinitial − x_final)e^(−t/τ). It also assumes you know τ = RC for capacitor circuits and τ = L/R for inductor circuits, with R the equivalent resistance seen by the storage element. Here we use those results on three kinds of real circuit: timers, filters, and switching power supplies. In each one, the time constant sets the behavior you care about.
One idea, three jobs
Every application below uses the same fact. A capacitor voltage or inductor current moves toward its final value along an exponential, and the time constant tells you how fast. A designer picks R, C, or L so that τ lands where the circuit needs it.
- A timer uses the exponential as a clock. It waits until a voltage crosses a threshold.
- A filter uses τ to decide which signal changes pass and which are smoothed away.
- A switching supply uses the inductor's slow current change to move energy in small, controlled packets.
Timers: using the exponential as a clock
Delay to a threshold
A capacitor charging through a resistor reaches a chosen voltage at a predictable time. Solve the step response for t when vC equals a threshold Vth:
v_C(t) = V(1 − e^(−t/τ))
Setting vC = Vth and solving gives
t = −τ ln(1 − Vth / V) = τ ln(V / (V − Vth))
A comparator or logic input watches the capacitor and changes state at that moment. Microcontroller reset circuits, power-on delays, and simple "turn on after a pause" circuits work this way.
Some useful reference points follow from the formula.
| Threshold as a fraction of V | Delay in units of τ |
|---|---|
| 0.50 | 0.693 |
| 0.632 | 1.000 |
| 0.90 | 2.303 |
| 0.99 | 4.605 |
The delay to the half-way point, 0.693τ, appears in many timer datasheets. It is the same number that links the time constant to a half-life.
The next program computes the delay for a given threshold. It uses a 10 kΩ resistor, a 100 nF capacitor, and a 5 V supply, with a logic input that switches at 3 V.
import math
R = 10e3 # ohms
C = 100e-9 # farads
V = 5.0 # supply voltage
V_th = 3.0 # threshold voltage
tau = R * C
t_delay = tau * math.log(V / (V - V_th))
print(f"tau = {tau * 1000:.3f} ms")
print(f"delay to {V_th} V = {t_delay * 1000:.3f} ms")Here τ = 1 ms and the delay is about 0.916 ms.
Oscillators
A relaxation oscillator charges a capacitor toward a supply, and a comparator discharges it when a threshold is crossed. The capacitor then charges again. The comparator uses two thresholds, an upper and a lower one, so the voltage swings between them. Each half-cycle is a piece of the exponential, so the period is proportional to RC. This is how the classic 555 timer in astable mode sets its frequency.
Tolerance and drift
Timing accuracy depends on the parts. A capacitor with ±10% tolerance and a resistor with ±1% tolerance give a τ that is uncertain by about ±11% in the worst case. Temperature changes the capacitance, and some dielectrics change a great deal. A circuit that needs precise timing should use a stable capacitor type, such as C0G/NP0 ceramic or film, or should rely on a crystal-based clock instead.
Filters: τ as a frequency boundary
Low-pass behavior in the time domain
An RC low-pass filter takes the output across the capacitor. A rapid change at the input shows up at the output only after the capacitor charges, so fast changes are smoothed and slow changes pass through. A noisy sensor signal that passes through such a filter loses its rapid fluctuations but keeps its slow trend.
You can read the filter's speed straight from τ. A step at the input produces an output that reaches 63% of the step after one τ and about 99% after 5τ. This is the filter's step response, and it is the time-domain view of the same filter that frequency analysis describes.
The corner frequency, where the output amplitude falls to 1/√2 of the input for a sinusoid, is
f_c = 1 / (2πτ) = 1 / (2πRC)
This relation comes from sinusoidal steady-state analysis, which is outside this chapter. We use it here only to connect the two views: a larger τ means a lower corner frequency and a slower step response.
High-pass behavior and coupling
Swap the positions of the resistor and capacitor and take the output across the resistor. The capacitor blocks steady voltage, because its current falls to zero once it is fully charged. A step at the input appears at the output as a spike that decays with time constant τ. This arrangement is called AC coupling. It passes the changing part of a signal and removes the DC level.
If the input is a step of height V, the output across the resistor is
v_R(t) = V e^(−t/τ)
This is the capacitor-charging equation read from the resistor's side, since vR = V − vC.
Debouncing a switch
A mechanical switch does not close cleanly. The contacts bounce for a few milliseconds and produce a burst of on and off transitions. An RC low-pass filter between the switch and a logic input spreads those transitions out. The capacitor cannot jump, so the input voltage does not follow each bounce. Choose τ longer than the bounce time, and keep it short enough that the response still feels immediate to a person.
Switching supplies: the inductor as an energy carrier
Why switching instead of dropping voltage
A linear regulator lowers voltage by burning the difference as heat. A switching supply instead turns a switch on and off many thousands of times each second and uses an inductor and a capacitor to average the result. The inductor current, which cannot change instantly, carries energy between the input and the output. Little energy is lost as heat, so efficiency is much higher.
The buck converter
A buck converter steps voltage down. A switch connects an inductor to the input for a fraction D of each period, called the duty cycle, and a diode provides a path for the inductor current while the switch is off.
During the on time, the inductor sees the difference between input and output voltage, so the current ramps up. During the off time, the diode conducts and the inductor sees about −Vout, so the current ramps down. In steady state the up and down changes cancel, and the output voltage settles near D × Vin.
The current ramp comes from the inductor relation v = L di/dt. With a nearly constant voltage across the inductor, the current changes linearly:
Δi = (V_L / L) × Δt
The switching period is short compared with the L/R time constant of the whole circuit, so each ramp is only a small piece at the start of an exponential, and it looks straight. This is why designers often write the ripple current as a simple ramp rather than an exponential.
The next program computes the peak-to-peak inductor ripple for a buck converter that converts 12 V to 5 V with a 22 µH inductor at 500 kHz.
V_in = 12.0 # volts
V_out = 5.0 # volts
L = 22e-6 # henries
f_sw = 500e3 # hertz
D = V_out / V_in # duty cycle, ideal converter
T = 1 / f_sw
t_on = D * T
ripple = (V_in - V_out) / L * t_on
print(f"duty cycle = {D:.3f}")
print(f"ripple current = {ripple * 1000:.1f} mA peak to peak")The program prints a duty cycle of 0.417 and a ripple of about 265 mA.
The flyback path
Opening the switch interrupts the current from the source, but the inductor current must continue. The diode in the buck converter gives it a place to flow. Without it, the inductor would force its current through the open switch and produce a very large voltage, as in the voltage-spike case covered earlier in this tutorial. In a switching supply this diode (or a second switch that plays the same role) is a required part of the circuit.
In a flyback converter, the designer uses this effect on purpose. The inductor, built as a transformer, stores energy while the switch is on and releases it to the output when the switch opens.
The output capacitor
The output capacitor smooths the ripple. The inductor current ripple flows into the capacitor, and the capacitor voltage changes by only a small amount during each cycle. The load and capacitor together form an RC time constant, which should be much longer than the switching period so the output stays steady. The same idea appears when the supply starts up: the output capacitor charges along an exponential-like curve, and designers often add a soft-start function to limit the inrush current.
Common errors
- Using the wrong R for τ. In a real circuit, a source resistance, a load, or a diode can change the equivalent resistance. Find the Thevenin resistance seen by the storage element before you compute τ.
- Ignoring component tolerance. Electrolytic capacitors can vary by ±20% or more. A timer built on one may be far from its design value.
- Treating a switching ramp as an exponential, or the reverse. If the switching period is much shorter than τ, the ramp is nearly linear. If the period is comparable to τ, use the exponential.
- Leaving out the flyback path. An inductor driven by a switch always needs a path for its current when the switch opens.
- Placing a threshold too close to the final value. The capacitor voltage flattens near V, so the delay becomes unstable.
Summary of design relations
| Application | Key relation | What τ sets |
|---|---|---|
| Delay timer | t = τ ln(V / (V − V_th)) | Time until the threshold is reached |
| Low-pass filter | f_c = 1 / (2πRC) | Corner frequency and step settling time |
| High-pass coupling | v_R = V e^(−t/τ) | How fast the DC level is removed |
| Debounce | τ greater than bounce time | How much switch noise is hidden |
| Buck converter ripple | Δi = (V_L / L) Δt | Ripple size, through L and the switching period |
Exercise
A reset circuit uses R = 47 kΩ and C = 220 nF, driven by a 3.3 V supply step. A logic input treats any voltage above 2.0 V as a high level. How long after the supply steps does the capacitor reach 2.0 V?
Show answer
First find τ = RC = 47e3 × 220e-9 = 10.34 ms. The delay is t = τ ln(V / (V − V_th)) = 10.34 ms × ln(3.3 / 1.3) = 10.34 ms × 0.9316, which is about 9.6 ms.
Exercise
A debounce filter must hide switch bounce lasting up to 5 ms, so you want τ about 5 ms. You choose C = 100 nF. What resistor do you need, and what is the 10% to 90% rise time of the filter output for a step input?
Show answer
R = τ / C = 5e-3 / 100e-9 = 50 kΩ, so a standard 47 kΩ or 51 kΩ part works. The 10% to 90% rise time is about 2.2τ, which is roughly 11 ms. This is still fast enough that a person does not notice the delay.
Exercise
A buck converter has Vin = 24 V, Vout = 12 V, L = 47 µH, and f_sw = 200 kHz. Find the duty cycle and the peak-to-peak inductor ripple current. Then explain why the ripple can be treated as a straight ramp.
Show answer
D = 12 / 24 = 0.5. The period is 5 µs, so t_on = 2.5 µs. The ripple is (24 − 12) / 47e-6 × 2.5e-6 = 0.638 A peak to peak. The on time of 2.5 µs is very short compared with the circuit's L/R time constant, so only the first small part of the exponential is used, and that part is almost a straight line.