C6 · Lesson 32 · Op-amp circuits lab
Common-mode rejection, filter design, meters and transimpedance compensation, in Python
Lessons 16 to 29 built a toolkit of op-amp circuits, each with design formulas. In this lab you'll turn the formulas into design functions and check the results the formulas only estimate: a difference amplifier's exact common-mode rejection with real resistor errors, the component values of multiple-feedback and Tow-Thomas filters, what an average-responding meter really reads for waveforms other than sines, and the exact feedback capacitor that flattens a transimpedance amplifier.
Play
- The bars show what an average-responding meter, calibrated for sines, reads for a sine, a square and a triangle of the same peak, against their true RMS values.
- For a sine the two agree, by design. For a square the meter reads 11% high; for a triangle, about 4% low.
- Only a true-RMS meter reads all three correctly.
Predict
A difference amplifier with a gain of 10 is built from 0.1% resistors, and the worst-case formula gives a CMRR of 2750. If only the two resistors on the non-inverting side are off by 0.1%, in opposite directions, what's the CMRR?
About 5500, twice the worst case: only half of the possible error is present. The worst-case formula assumes all four resistors are off by the full tolerance in the most damaging directions. Real batches usually do better, but a design that must meet a specification has to assume the worst, or trim.
Name it
Exact common-mode rejection
For a difference amplifier with to the inverting input, in feedback, and , dividing the non-inverting input,
With , the common-mode gain is , the differential gain , and the CMRR is their ratio. Matched ratios make zero.
Filter design functions
- Multiple-feedback band-pass with equal capacitors C, center , quality Q and center gain −G: , , and from the formula, .
- Tow-Thomas: , , for band-pass gain G.
Meters
An average-responding meter rectifies, averages, and multiplies by = 1.111 so a sine reads its RMS. For any other waveform the reading is 1.111 times the rectified average, not the RMS.
Transimpedance compensation
From lesson 24, with and . Q falls steadily as grows, so bisection on finds the value that gives any Q, such as 0.707.
Worked example
A gain-10 difference amplifier ( = 10 kΩ, = 100 kΩ) has its resistors off by 0.1% in the worst directions. Check the worst-case formula exactly.
Show the solution
- Worst directions. and low by 0.1%, and high.
- Exact gains. Then against = 10.0.
- CMRR. The ratio is 2750, matching to five digits.
- Why it matches. The formula's derivation is first order in ε, which at 0.1% is far more than enough.
Answer the exact worst-case CMRR is 2750, the same as the formula's to five digits.
Worked example
Design a multiple-feedback band-pass at 1 kHz with Q = 5 and a center gain of −5, using 10 nF capacitors.
Show the solution
- Feedback resistor.
- Input resistor.
- Third resistor. The formula, solved for with = 159,155 Ω and = 15,915 Ω: matching lesson 26.
- Why is small. It sets while the other two set Q and gain, and its value sinks as Q rises.
Answer = 159.2 kΩ, = 15.9 kΩ and = 1.77 kΩ.
Worked example
An average-responding meter calibrated for sines measures a 1 V peak square wave and a 1 V peak triangle. What does it read, and what are the true RMS values?
Show the solution
- Square wave. Its rectified average is 1 V, so the meter reads 1.111 V. Its RMS is 1 V, so the reading is 11% high.
- Triangle. Its average is 0.5 V and the meter reads 0.555 V, against a true RMS of 0.577 V: 3.8% low.
- Sine. Its average is 0.637 V, and its RMS exactly, which is the only case the calibration covers.
Answer the meter reads 1.111 V for the square (true RMS 1 V) and 0.555 V for the triangle (true RMS 0.577 V).
Check
Step 1. Write diff_cmrr(R1, R2, R3, R4) returning the exact CMRR (as a ratio) of a difference amplifier. Return float('inf') if the common-mode gain is exactly zero.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 2. Write mfb_bandpass(f0, Q, C, G) returning (R1, R2, R3) for a multiple-feedback band-pass with equal capacitors and center gain −G.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 3. Write tow_thomas(f0, Q, C, G) returning (R, RQ, Rin) for a Tow-Thomas band-pass with center gain G.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 4. Write meter(samples) returning (avg_abs, rms, reading) for one period of a waveform, where reading is an average-responding meter's: 1.111 times the rectified average, exactly .
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 5. Write tia_cf(Rf, Cin, GBW, Q=0.7071) returning the feedback capacitor that gives the transimpedance amplifier the requested Q, by bisection between 0 and 100 pF.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
What's the worst-case CMRR of a difference amplifier with gain 10 built from 0.01% resistors?
Check
An average-responding meter calibrated for sines measures waveforms of 1 V peak.
(a)
What does it read for a square wave?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
(b)
And for a triangle wave?
Explain why
Why does an average-responding meter misread a square wave?
The meter can't measure RMS directly. It rectifies the signal, averages it, and multiplies by a fixed factor chosen so that a sine wave reads its RMS value: the sine's RMS is 1.111 times its rectified average. A square wave's RMS equals its rectified average, because it spends all its time at the peak, so the factor that corrects a sine overcorrects the square by 11%. Every waveform has its own ratio of RMS to average, so the meter is right only for sines, and a true-RMS meter computes the root of the mean square instead.
Practice
Keep practicing
3 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.