Mini Project: Design, Simulate and Characterise a Sensor Amplifier
This project is the course's milestone: take an analog circuit from a written requirement, through hand design and simulation, to a bench prototype and a test report. The circuit is the front end of a temperature logger. A platinum RTD (resistance temperature detector) changes its resistance by about per degree; a microcontroller's 12-bit ADC must read it from to . Nearly every block of the course appears: a ratiometric divider, an instrumentation amplifier, a Sallen-Key low-pass, an error budget with real op-amp limits and tolerances, and noise and layout choices.
The requirement
| Item | Requirement |
|---|---|
| Sensor | Pt1000, IEC 60751 class B, two-wire, leads under |
| Range | to |
| Output | to into a 12-bit ADC with a reference |
| Supply | (ADC reference) and for the op-amps, both from a USB-powered board |
| Rejection | at least at (mains hum picked up by the sensor leads) |
| Accuracy | electronics error below after a two-point calibration |
| Self-heating | under in the sensor |
The output window stops short of each rail so that a single-supply op-amp with a rail-to-rail output never clips (see the output-swing part of Real Op-Amps).
The architecture
Both dividers hang from the same that the ADC uses as its reference. That makes the measurement ratiometric: if the reference drifts by 1 %, the input and the ADC's full scale move together and the code stays put. The offset divider is chosen to equal the RTD divider at ( against ), so the INA amplifies only the change. Its REF pin, driven by a buffered copy of the same , shifts the output to the bottom of the window.
Step 1: excitation and self-heating
The RTD sits in a divider with :
(the IEC 60751 curve for ). At , and the current is , so the sensor dissipates : inside the requirement. A larger current would give more signal but heat the sensor; a typical probe in still air rises a few tenths of a degree per milliwatt (check the probe's datasheet value, often given as a self-heating coefficient).
Step 2: gain and offset
Given: goes from at to at , a span of ; the output must span ; the op-amps run from a single supply.
Find: the gain of a three-op-amp INA and how to split it between its two stages.
Solve: the total gain is . The obvious choice puts it all in the input stage, with for . Look at the input-stage outputs before accepting it:
With , at : impossible on a single supply, and the amplifier would quietly clip. The input common mode is only , so stays above ground only if . Split the gain:
Check: at , and the lowest internal node is , inside a rail-to-rail output's range. The sensitivity is per degree, or 33 ADC codes per degree: the ADC is not the limit. Single-supply INA chips document this trap as a "common-mode versus output voltage" plot; always check it.
Step 3: the hum filter
Temperature changes over seconds, so a corner near costs nothing. A unity-gain Sallen-Key with , (feedback) and (to ground) gives
close to Butterworth () with stock capacitor values. A second-order filter falls about per decade above , so at (about 4.7 times ) expect a little under of rejection. The filter also limits the noise bandwidth (Noise in Analog Circuits) and serves as the ADC's anti-alias filter.
Step 4: the transfer curve and the error budget in Python
The model below computes the exact output against temperature, the ADC code, and the error you would make by treating the curve as a straight line between the two calibration points. Then it draws 5000 random boards with uniform resistor tolerances to show what calibration must remove.
import numpy as np
A, B = 3.9083e-3, -5.775e-7 # IEC 60751 coefficients, T >= 0 degC
R0, Rtop, Vref = 1000.0, 10e3, 3.3
RG, RF, G2 = 10e3, 10e3, 8.87
def rtd(T):
return R0 * (1 + A * T + B * T**2)
def vout(T, r1=Rtop, r3=Rtop, r4=1e3, rg=RG):
vp = Vref * rtd(T) / (rtd(T) + r1)
vm = Vref * r4 / (r4 + r3)
G = (1 + 2 * RF / rg) * G2
return vm + G * (vp - vm)
lo, hi = vout(0), vout(100)
lsb = Vref / 4096
print(" T(C) R(Ohm) Vout(V) code linear est. error")
for T in [0, 25, 50, 75, 100]:
v = vout(T)
code = round(v / lsb)
est = 100 * (v - lo) / (hi - lo)
print(f"{T:5.0f} {rtd(T):8.2f} {v:8.4f} {code:5d} {round(est - T, 2) + 0.0:+10.2f} C")
print(f"sensitivity {1e3*(hi - lo)/100:.2f} mV/C, {(hi - lo)/100/lsb:.1f} LSB/C")
rng = np.random.default_rng(1)
N = 5000
for tol in [0.01, 0.001]:
k = lambda: 1 + tol * rng.uniform(-1, 1, N)
r1, r3, r4, rg = Rtop * k(), Rtop * k(), 1e3 * k(), RG * k()
e0 = (vout(0, r1, r3, r4, rg) - lo) / ((hi - lo) / 100)
e100 = (vout(100, r1, r3, r4, rg) - hi) / ((hi - lo) / 100)
print(f"tolerance {100*tol:.1f} %: error at 0 C sd {e0.std():.2f} C, worst {abs(e0).max():.2f} C;"
f" at 100 C sd {e100.std():.2f} C") T(C) R(Ohm) Vout(V) code linear est. error
0 1000.00 0.3000 372 +0.00 C
25 1097.35 1.0003 1242 +0.94 C
50 1193.97 1.6833 2089 +1.23 C
75 1289.87 2.3497 2916 +0.92 C
100 1385.05 2.9999 3724 +0.00 C
sensitivity 27.00 mV/C, 33.5 LSB/C
tolerance 1.0 %: error at 0 C sd 2.59 C, worst 7.43 C; at 100 C sd 2.89 C
tolerance 0.1 %: error at 0 C sd 0.26 C, worst 0.77 C; at 100 C sd 0.29 C
Two lessons from these numbers. First, the curve is not straight: the RTD's own curvature and the divider's compression add up to at mid-range. That error is systematic, so the firmware removes it by inverting the exact equations (or a small lookup table), not by better parts. Second, with 1 % resistors (every resistor in the model gets the same uniform tolerance) an uncalibrated board can be off. A two-point calibration (an ice bath, or precision resistors of and in place of the sensor) removes offset and gain errors of any size; 0.1 % parts in the dividers make calibration a trim instead of a rescue. What calibration cannot remove is drift: resistor temperature coefficients, op-amp offset drift multiplied by the gain, and the sensor's own class tolerance (class B allows under IEC 60751:2022, the current edition, valid from to for film and to for wire-wound thermometers).
Step 5: the whole chain in SPICE
The deck builds the chain from the course's op-amp macro-model (, GBW; see the macro-model). The RTD is a resistor whose value the control loop changes with alter. A AC source in series with the sensor stands for hum picked up by its leads.
cat > rtd.cir <<'EOF'
* Pt1000 RTD interface: divider, three-op-amp INA (G = 3 x 8.87), Sallen-Key low-pass
.subckt OA inp inn out
G1 0 n1 inp inn 1m
R1 n1 0 100meg
C1 n1 0 159.2p
E1 out 0 n1 0 1
.ends
VREF ref 0 3.3
R1 ref p 10k
VN p pr DC 0 AC 1m
RT pr 0 1000
R3 ref m 10k
R4 m 0 1k
XB m bref bref OA
XA1 p n1 o1 OA
RF1 o1 n1 10k
RG n1 n2 10k
RF2 o2 n2 10k
XA2 m n2 o2 OA
R5 o2 a 10k
R6 a out 88.7k
R7 o1 b 10k
R8 b bref 88.7k
XA3 b a out OA
R9 out s1 100k
R10 s1 s2 100k
C1 s1 fout 220n
C2 s2 0 100n
XA4 s2 fout fout OA
.control
foreach r 1000 1097.35 1193.97 1289.87 1385.05
alter RT = $r
op
echo "RT = $r Ohm: o2 = amp;v(o2) V, vout = amp;v(fout) V"
end
alter RT = 1193.97
ac dec 50 0.1 1k
meas ac g1 find vdb(fout) at=1
meas ac g50 find vdb(fout) at=50
let att = g1 - g50
echo "50 Hz rejection: amp;att dB"
.endc
.end
EOF
ngspice -b rtd.cir 2>&1 | grep -E '^(RT =|50 Hz)'RT = 1000 Ohm: o2 = 0.299997 V, vout = 0.299964 V
RT = 1097.35 Ohm: o2 = 0.273681 V, vout = 1.00017 V
RT = 1193.97 Ohm: o2 = 0.248015 V, vout = 1.68307 V
RT = 1289.87 Ohm: o2 = 0.222974 V, vout = 2.34933 V
RT = 1385.05 Ohm: o2 = 0.198539 V, vout = 2.99949 V
50 Hz rejection: 26.713 dB
The simulated outputs agree with the Python column to better than (the op-amps' finite gain of accounts for the last digits), the input-stage output falls to as Step 2 predicted, and the rejection of meets the requirement. The macro-model has no rails, so SPICE would happily have shown for the first design too: printing the internal nodes and comparing them with the op-amp's input and output ranges is your job, not the simulator's.
Step 6: build and test
Parts. Four rail-to-rail CMOS op-amps (one quad package) on with a ceramic capacitor at the supply pin; 0.1 % thin-film resistors for , , and the four difference-stage resistors; the same for , and the pair; film capacitors (C0G or polypropylene) for the filter. A precision decade resistance box stands in for the RTD during electrical tests; the real probe comes last.
What you would measure, with expected readings and their uncertainty:
| Test | Setup | Expected | Uncertainty and notes |
|---|---|---|---|
| Transfer curve | decade box at , , , , ; DMM on the output | , , , , | box 0.1 % gives about equivalent; offset drift and resistor mismatch add a few mV before calibration |
| Calibration | two-point fit at and | residuals at the middle points under (about ) after the firmware's exact inversion | DMM 0.05 % of reading |
| Hum rejection | inject peak at from a battery-powered or isolated function generator in series with the decade box | about peak at the output, against about peak at | scope with averaging; the generator ground must not form a second path to the board |
| Noise | output on the scope, AC-coupled, limit, or an ADC capture of 1000 samples | well under one LSB () rms | probe ground lead picks up hum: use the tip-and-barrel method |
| Step response | switch the box between two values | settles in about with a few percent overshoot () |
Where the hum numbers come from: the injected signal is scaled by the divider (), amplified by and, at , attenuated by the filter's (): . SPICE's g1 and g50 give the same numbers for a source.
Hazards and safe setup. Everything runs from a USB-powered board at and , or a current-limited bench supply set to and . The ice-bath calibration uses kitchen ice and water; keep it away from the board and the supply. Do not immerse an RTD probe that is not rated for it, and never heat the probe with anything mains-powered on the bench beside the open circuit: use warm water from a kettle poured into an insulated cup, well away from the electronics. Electrostatic discharge can damage CMOS op-amp inputs: touch the bench ground before handling the board.
Write-up template
- Requirement (the table above) and any assumption you added.
- Architecture and why: ratiometric, offset by divider, filter placement.
- Hand design with Given / Find / Solve / Check for the divider, the gain and the filter.
- Simulation: the Python transfer curve and error budget, the SPICE chain, the Monte Carlo spread; one table that compares hand, Python and SPICE.
- Prototype: schematic with every value, photo, layout notes (where the ground of the RTD returns, where the decoupling capacitor sits).
- Measurements against the expected values with uncertainties; calibration constants.
- Discussion: which error dominates, what you would change (three-wire RTD to cancel lead resistance, a higher-resolution ADC, a dedicated INA chip, a reference that is not the supply).
- Conclusion: does the design meet each line of the requirement? Yes or no, with the number.
Extensions
- Lead resistance: two leads add , about . Redraw the front end for a three-wire RTD.
- Replace the three-op-amp INA by a single difference amplifier: what happens to the divider's accuracy when the amplifier's input resistance loads it?
- Add a second-order filter in Python to reach at , and compare the step response.
Test yourself
Why do the RTD divider and the ADC share the same reference?
- To save a component
- So a drift in the reference cancels in the ratio the ADC reports
- Because the ADC needs current from the divider
- To raise the sensitivity
A three-op-amp INA on a single supply has inputs near and a differential input of . Why should most of the gain go in the difference stage?
- The difference stage has more bandwidth
- An input-stage gain of 26 would drive one input-stage output about below its input, i.e. below ground
- The gain resistor would dissipate too much power
- It improves the ratiometric property
The transfer curve bends by about at mid-range. What is the right fix?
- Use 0.01 % resistors
- Invert the exact equation in firmware
- Raise the filter corner
- Increase the RTD current
A second-order low-pass with attenuates hum by about…