Sub topic 14
Making the Integrator Practical: Drift and a Feedback Resistor
This chapter assumes you know the ideal inverting integrator, Vout = -(1/RC) ∫Vin dt + Vout(0). It also assumes you know its -20 dB/decade frequency response and the saturation limits of an op amp output. You should be comfortable with the virtual short and with a capacitor's impedance 1/(sC).
Why the ideal integrator fails on a bench
The ideal integrator has no resistor in its feedback path. At DC the capacitor is an open circuit, so the loop has no DC feedback and the DC gain is theoretically infinite. Any tiny DC error at the input gets amplified without limit.
Real op amps always have small DC errors:
- Input offset voltage (Vos). A few millivolts appears between the inputs even when both are grounded. The circuit treats it as a real DC input.
- Input bias current (Ib). A small current, tens of nanoamps for a bipolar input stage, flows into the inverting input. It has nowhere to go except into the capacitor.
Suppose R = 10 kΩ and C = 100 nF, so RC = 1 ms. Take Vos = 2 mV and Vin = 0:
- The offset acts as an input of 2 mV, so the output ramps at
Vos/RC = 2 V/s. - A bias current of 100 nA charges the capacitor at
Ib/C = 1 V/s.
With ±12 V output limits, the ramp saturates the output in about 6 seconds. Once saturated, the op amp's inputs are no longer held equal and the virtual short is gone. The circuit stops integrating, and the output stays pinned until something resets it.
The fix: a resistor across the capacitor
Place a resistor Rf in parallel with C. At DC the capacitor carries no current, so the circuit becomes an ordinary inverting amplifier with gain -Rf/R. The DC gain is now finite and the loop is closed at all frequencies.
The feedback impedance is Zf = Rf / (1 + sRfC), so the transfer function is:
H(s) = Vout/Vin = -(Rf/R) / (1 + s·Rf·C)This is an inverting low-pass filter with these properties:
- DC gain of
-Rf/R. - Corner frequency
fc = 1/(2π·Rf·C). - Well above
fc, the denominator is dominated bysRfC. ThenH(s) ≈ -1/(sRC), which is the ideal integrator.
The circuit is therefore a "leaky" integrator. It integrates for frequencies well above fc and behaves as a plain amplifier well below it.
What the output offset becomes
With the resistor in place, the DC output error is no longer a ramp. Treat Vos as a source at the non-inverting input. The DC gain from that source to the output is the non-inverting gain:
Vout(DC) = Vos · (1 + Rf/R)For Vos = 2 mV, R = 10 kΩ, and Rf = 100 kΩ, the output offset is 2 mV × 11 = 22 mV. That is a fixed value you can tolerate, not a ramp heading for the rail.
For bias current, the inverting input draws Ib through Rf at DC, which adds an error of about Ib·Rf. To cancel most of it, put a compensation resistor Rcomp = R ∥ Rf from the non-inverting input to ground. Then both inputs see the same source resistance, and only the smaller offset current Ios produces an error. For R = 10 kΩ and Rf = 100 kΩ, Rcomp ≈ 9.09 kΩ.
Checking the behavior numerically
The code below integrates the node equation Vout' = Vos/(RC) - (Vout - Vos)/(Rf·C) with simple Euler steps. It compares the ideal integrator (no Rf, clamped at ±12 V) with the leaky one.
R = 10e3 # ohms
C = 100e-9 # farads
Rf = 100e3 # ohms
vos = 2e-3 # input offset voltage, volts
vsat = 12.0 # output limit, volts
dt = 1e-4 # time step, seconds
ideal = 0.0
leaky = 0.0
for step in range(1, 100001): # 10 seconds
ideal += vos / (R * C) * dt
ideal = max(-vsat, min(vsat, ideal))
leaky += (vos / (R * C) - (leaky - vos) / (Rf * C)) * dt
if step in (10000, 100000):
print(f"t={step * dt:4.1f} s ideal={ideal:6.3f} V leaky={leaky:6.3f} V")The output is approximately:
t= 1.0 s ideal= 2.000 V leaky= 0.022 V
t=10.0 s ideal=12.000 V leaky= 0.022 VThe ideal integrator ramps at 2 V/s and sits on the rail by 10 s. The leaky one settles within a few time constants (τ = RfC = 10 ms) at 22 mV, matching Vos(1 + Rf/R).
How Rf changes the response to real signals
Step input
An ideal integrator turns a step into a ramp. With Rf, the output is an exponential:
Vout(t) = -(Rf/R)·Vstep·(1 - e^(-t/τ)), τ = Rf·CFor times much shorter than τ, this looks like the ramp -(Vstep/RC)·t. For times much longer than τ, it flattens at -(Rf/R)·Vstep. The ramp is only trustworthy while t << RfC.
Square wave input
An ideal integrator turns a symmetric square wave into a triangle wave. If the square wave has any DC component, the ideal triangle slides away from zero. With Rf, the DC component is blocked by the finite DC gain, so the triangle stays centered on a stable average. The triangle's flat portions show a slight droop whenever the half-period is not small compared with τ.
Frequency response
Measured against the ideal -90° phase of the integrator (relative to the inverting gain), the leaky integrator has these errors:
| f / fc | Magnitude relative to DC gain | Phase relative to inverting gain |
|---|---|---|
| 0.1 | -0.04 dB | -5.7° |
| 1 | -3.01 dB | -45° |
| 10 | -20.04 dB | -84.3° |
| 100 | -40.0 dB | -89.4° |
At f = 10·fc the phase is within about 6° of the ideal -90°, and the gain slope is nearly -20 dB/decade. This gives a practical rule: keep the lowest frequency you care about at least a decade above fc.
Choosing Rf
Rf trades two goals against each other:
- Larger Rf gives a lower corner
fc, so the circuit integrates accurately down to lower frequencies. It also raises the DC gainRf/Rand the output offset. - Smaller Rf limits DC gain and drift more strongly. It raises
fc, so more of your signal band is attenuated and phase-shifted.
A workable procedure:
- Pick R and C for the integration gain
1/RCyou need. - Set the maximum tolerable DC gain from your offset budget. The maximum Rf is
(DC gain) × R. - Set the lowest signal frequency
f_low. Requirefc ≤ f_low/10, so the minimum Rf is10/(2π·f_low·C). - Choose Rf between those two bounds. If no value fits, change C or R, or add a reset switch.
Worked example with R = 10 kΩ, C = 100 nF, and a goal of a DC gain no larger than 10: Rf = 100 kΩ. Then fc = 1/(2π · 100 kΩ · 100 nF) ≈ 15.9 Hz, so the integrator is accurate above about 160 Hz. A 1 kHz signal is well inside the integrating region.
Exercise
An inverting integrator uses R = 10 kΩ and C = 10 nF. It must integrate signals from 1 kHz upward, and the DC gain must not exceed 20. Find the range of acceptable Rf values and pick one. Then give the corner frequency and DC gain for your choice.
Show answer
The DC gain limit gives Rf ≤ 20 × 10 kΩ = 200 kΩ. The corner must be at most a tenth of 1 kHz, so fc ≤ 100 Hz. Since fc = 1/(2π·Rf·C), this requires Rf ≥ 1/(2π · 100 Hz · 10 nF) ≈ 159 kΩ. Any Rf from about 159 kΩ to 200 kΩ works. Choosing 180 kΩ gives fc = 1/(2π · 180 kΩ · 10 nF) ≈ 88 Hz and a DC gain of 180k/10k = 18 (magnitude, inverting).