12 Sensor Circuits: Conditioning and Filters
12.1 Overview
This first route shapes small sensor signals with amplification, filtering, protection, and calculated interfaces.
This is part 1 of 2. Continue with Sensor Circuits: Bridges and Noise for the second focused route.
- First identify why raw sensor outputs need conditioning.
- Then inspect bridge circuits and millivolt signals.
- Next size gain and low-pass filtering for a 0-3.3V ADC.
- Finally apply the chain to thermistors, load cells, noise, grounding, and anti-aliasing.
Checkpoints recap each design decision; deeper circuit details support a first read.
Start with Instrumentation Amplifier: A differential amplifier with high input impedance and a single gain resistor; ideal for amplifying small differential signals from Wheatstone bridges and strain gauges in the presence of common-mode noise. Then Wheatstone Bridge: Four resistors in a diamond configuration where one or more are sensing elements; the differential output voltage is proportional to the resistance change and is immune to supply voltage variations. Next Common-Mode Rejection Ratio (CMRR): The amplifier’s ability to reject identical signals on both inputs while amplifying the difference; high CMRR (>80 dB) is critical for rejecting noise on long sensor cables. After that Anti-Aliasing Filter: A low-pass filter placed before the ADC to ensure no signal components above fs/2 reach the converter, preventing aliasing from misrepresenting high-frequency noise as false low-frequency signals. Continue by Rail-to-Rail Op-Amp: An op-amp whose output can swing to within millivolts of both supply rails; essential for single-supply 3.3 V designs where the conditioned signal must span the full ADC input range. Continue by Signal Offset Removal: Subtracting a DC offset from a sensor signal to center it in the ADC’s input range, maximizing dynamic range utilization for differential or bridge sensors. Continue by Gain-Bandwidth Product: The product of an op-amp’s gain and its bandwidth is approximately constant; higher gain settings reduce the usable bandwidth, limiting the maximum signal frequency that can be accurately amplified. Finally Input Impedance Matching: The amplifier’s input impedance must be much higher than the sensor’s source impedance to prevent loading effects that would reduce the measured voltage and introduce gain errors.
12.3 Learning Objectives
By the end of this chapter, you will be able to:
- Design Signal Conditioning Chains: Construct complete pipelines from raw sensor output to ADC-ready signals
- Calculate Amplifier Gain: Derive required gain to utilize full ADC range for maximum resolution
- Implement Wheatstone Bridges: Configure bridge circuits for precision resistance measurements
- Evaluate Worked Examples: Trace step-by-step calculations for real thermistor and strain gauge interfaces
- Select Appropriate Components: Compare instrumentation amplifiers and filter components for specific applications
Imagine trying to listen to a friend whispering in a noisy stadium — you would need to amplify their voice and filter out the crowd noise. Signal conditioning does exactly this for sensor signals. It boosts weak electrical signals, removes unwanted noise, and adjusts voltage levels so the microcontroller can read them clearly and accurately.
12.4 Introduction
Raw sensor outputs are rarely suitable for direct connection to microcontroller ADCs. Signals may be too weak (millivolts from thermocouples), too noisy (interference from motors), or at the wrong voltage level (5V sensors on 3.3V MCUs). Signal conditioning transforms these problematic signals into clean, properly scaled inputs for accurate digital conversion.
Start with the whole chain before choosing parts: gain, noise, safe voltage range, then ADC conversion.
Within the larger sensor pipeline, the signal conditioning block transforms weak, noisy sensor signals through four sequential stages:
Step 1: Amplification (Boosting Weak Signals)
Start by Instrumentation amplifier with adjustable gain (1-1000x). Then Formula: Gain = (Vref_ADC_max - Vref_ADC_min) / (Vsensor_max - Vsensor_min). Next Example: 10mV sensor signal amplified 330x to fill 0-3.3V ADC range. Finally Result: Maximizes ADC resolution, converts millivolts to measurable voltage.
Step 2: Filtering (Removing Noise)
Start by Low-pass RC filter or active filter removes frequencies above signal bandwidth. Then Cutoff frequency: fc = 1/(2πRC) set below noise, above signal. Next Example: 10Hz cutoff passes slow temperature changes, blocks 60Hz mains hum. Finally Result: Clean signal with interference removed.
Step 3: Level Shifting (Voltage Matching)
Start by Voltage divider or op-amp circuit adjusts signal to MCU ADC input range. Then Converts bipolar (-5V to +5V) to unipolar (0 to 3.3V) if needed. Next Protects MCU from overvoltage damage. Finally Result: Signal safely matches ADC specifications.
Step 4: ADC Conversion (Digitization)
Start by Sample-and-hold circuit captures instantaneous voltage. Then Successive approximation converts to N-bit digital value. Next Resolution: Vstep = Vref / 2^N determines precision. Finally Result: Binary number representing calibrated physical measurement.
This four-stage pipeline is the foundation of all professional sensor interfaces.
The mathematical gist. A 20.0 mV sensor span multiplied by the chapter’s practical 150× gain fills 3.00 V of a 12-bit ADC, giving 0.732 mV/count and about 0.00488 C/count for a 1 mV/C sensor. Its 16 kohm, 1 uF low-pass has Hz and attenuates 60 Hz by 15.7 dB; gain, filtering, and buffering therefore protect different parts of the same measurement chain.
12.5 Signal Processing Pipeline Overview
Before designing individual circuits, locate each source of measurement quality in the complete signal path. Use Figure 12.1 to follow one physical quantity all the way to an IoT action, noting where the signal is still analogue and where it has become data.
Read Figure 12.1 from left to right. The physical quantity is transduced into an electrical signal; conditioning scales and filters it before conversion; the ADC produces codes; digital processing turns codes into evidence; and the output stage uses or transports the result. An error introduced before conversion can be labelled downstream but not reconstructed, which is why the bridge, thermistor, and gain circuits in this chapter belong inside an end-to-end chain.
Key Pipeline Stages:
| Stage | Purpose | Example Components | Typical Issues |
|---|---|---|---|
| 1. Physical | Measure real-world phenomenon | Temperature, light, pressure | Environmental interference |
| 2. Transduction | Convert to electrical signal | Thermistor, LDR, piezo sensor | Sensor drift, non-linearity |
| 3. Conditioning | Prepare signal for ADC | Op-amps, RC filters, dividers | Insufficient gain, wrong cutoff |
| 4. ADC Conversion | Digitize analog signal | ESP32 12-bit ADC, ADS1115 | Noise, quantization error |
| 5. Digital Processing | Extract meaningful data | Averaging, Kalman filter | Algorithm complexity, latency |
| 6. Output/Action | Use the data | Display, relay, MQTT | Communication failures, delays |
The stage map explains where work happens, but a practical design must also decide what to trade. Use Figure 12.2 as a review route: inspect cost, power, speed, and complexity from top to bottom, then test whether each proposed response changes another constraint.
Read Figure 12.2 as paired starting strategies rather than universal answers. An RC network can cheaply limit bandwidth; duty cycling changes when measurements are available; averaging reduces uncorrelated noise while adding latency; and modular blocks contain complexity without removing it. Carry those consequences into the component calculations below so that conditioning is justified by a measurement requirement, not added as decoration.
12.6 Wheatstone Bridge
The Wheatstone bridge is a precision measurement circuit used with strain gauges, load cells, and other resistive sensors requiring high accuracy. It detects small resistance changes by comparing two voltage dividers.
The bridge makes the problem visible: a real physical change may only move the output by millivolts.
To understand why a Wheatstone bridge can reveal tiny resistance changes, inspect Figure 12.3 before reading its balance rule. The visual exposes the two divider branches whose midpoint voltages are compared.
Read Figure 12.3, trace each supply-to-ground branch separately, then compare the two centre nodes that form the differential output. Equal resistor ratios balance the bridge; a change in the sensing arm unbalances it, linking mechanical or thermal change to the small voltage that requires amplification. Key Properties:
- Balanced condition: When R1/R2 = R3/Rx, output voltage = 0V
- Sensitivity: Small changes in Rx produce measurable differential voltage
- Applications: Strain gauges (weight scales), pressure sensors, temperature measurement
- Advantage: Common-mode rejection eliminates temperature drift and supply noise
12.6.1 Wheatstone Bridge Sensitivity Calculator
Calculate the output voltage of a Wheatstone bridge for a given resistance change in the sensor element.
Set the excitation voltage and nominal arm resistance to match the proposed bridge, then vary the resistance change over the sensor’s credible full-scale range. Compare Output voltage (approximate) with Output voltage (exact): close agreement shows that the small-change approximation is safe around balance, while divergence warns that the sensing arm has moved too far into the divider’s curved response. Next compare the millivolt output with the chosen ADC input range. The calculator’s result is not yet a measurement resolution; it is the differential signal available to an instrumentation amplifier. Use the displayed magnitude to select gain with headroom for offset and overload, and retain the exact result as the check against the linear approximation used in firmware or design notes.
Checkpoint: Bridge Signals
- A balanced Wheatstone bridge starts at zero output voltage.
- A 350ohm bridge with a 0.1% change and 5V excitation produces about 1.25mV.
- High input impedance and common-mode rejection protect that tiny differential signal.
12.7 Signal Conditioning Chain
Complete signal conditioning transforms raw sensor signals into clean, properly scaled inputs for ADC conversion.
After the bridge, the chain prepares the signal for conversion: amplify, filter, shift, buffer, sample.
Before sizing individual components, inspect Figure 12.4 to see how each conditioning stage prepares the signal for the next boundary.
Read Figure 12.4 from the weak sensor output through gain, filtering, level shifting, sampling, and conversion. That order connects noise and range decisions to the final digital measurement instead of treating each circuit as an isolated recipe.
Signal Conditioning Pipeline: From millivolt sensor output to calibrated digital measurement.
Each stage addresses specific signal quality issues:
| Stage | Function | Typical Components |
|---|---|---|
| Amplification | Boost weak signals to full ADC range | Instrumentation amplifier (INA128, AD620) |
| Filtering | Remove noise above Nyquist frequency | RC low-pass, active filters |
| Level Shifting | Match sensor output to ADC input range | Voltage divider, op-amp buffer |
| Buffering | Provide high-impedance input isolation | Unity-gain op-amp |
12.7.1 Gain and ADC Resolution
Use this interactive tool to calculate the optimal amplifier gain for your sensor-to-ADC interface and see the resulting measurement resolution.
12.7.2 RC Low-Pass Filter Designer
Calculate component values for an anti-aliasing RC low-pass filter given your desired cutoff frequency.
Start with the highest signal frequency the application must preserve, then choose a cutoff above that band but below frequencies that would alias at the ADC’s sample rate. Enter a practical resistor and inspect the calculated ideal capacitance alongside its nearest E12 value; the standard component changes the realised cutoff, so use that realised value for the sampling check. The resistor cannot be chosen from filter maths alone: a very large value can raise thermal noise and may prevent the ADC sampling capacitor from settling, whereas a very small value increases loading and requires a larger capacitor. After selecting the pair, verify attenuation at the first unwanted frequency and confirm that the ADC sample rate still satisfies Nyquist for the filtered bandwidth. This connects the component choice to the acquisition boundary rather than treating the calculator as a parts lookup.
The photographs below make load cell (wheatstone-bridge weight sensor) a physical comparison: look for changes in package, exposed interfaces, mounting, scale, and service access before treating the forms as interchangeable.
Read across the forms as engineering evidence. They share a capability name, but packaging and installation change the electrical, mechanical, environmental, and maintenance constraints.
Checkpoint: Gain and Filtering
- A 10mV to 30mV sensor span is only 20mV, so a 3.3V ADC can need gain near 165x.
- A 12-bit converter has 4096 levels; amplification decides how many counts the sensor actually uses.
- A 10Hz RC cutoff can pass slow temperature changes while reducing 50Hz or 60Hz interference.
12.8 Thermistor Signal Conditioning
Scenario: You need to measure room temperature (15-35C) using an NTC thermistor for a smart HVAC system. The thermistor output is only 20mV at 25C, but your ESP32 ADC needs 0-3.3V input.
Before sizing gain for the HVAC example, inspect Figure to anchor the calculation in the differential amplifier that must handle the thermistor’s millivolt signal. Package pins and circuit limits remain part of the design even when the arithmetic is correct.
Read Figure, begin with the paired input pins that receive the small differential signal, then relate the gain-setting and output connections to the ADC range. The photographed component represents the amplifier class; the specified INA128 and its datasheet values govern the actual circuit below.
Given:
- NTC thermistor output: 10mV at 35C, 30mV at 15C (20mV range)
- ESP32 ADC: 12-bit, 0-3.3V input range
- Target: Use full ADC range for maximum resolution
- Noise environment: Office with fluorescent lights (60Hz interference)
Steps:
-
Calculate required gain: To map 20mV range to 3.3V range: Use standard gain of 150 (close match with common resistor values)
-
Design instrumentation amplifier: Using INA128 with gain set by single resistor: Use 332 ohm standard resistor (gives G = 151.6)
-
Design anti-aliasing filter: For 60Hz noise rejection and 1Hz temperature sampling: Use R = 16k ohm, C = 1uF (gives fc = 10Hz)
-
Level shift for offset: Since thermistor outputs 10-30mV, after 150x gain we get 1.5-4.5V. Add voltage divider to shift into 0-3V range.
Result:
- Amplified signal: 1.5V (at 35C) to 4.5V (at 15C)
- After level shifting: 0V to 3.0V (fits ADC range)
- 12-bit ADC resolution: 3.0V / 4096 = 0.73mV per step
- Temperature resolution: 0.73mV / (150 x 1mV/C) = 0.005C per ADC step
Key Insight: By using full ADC range through proper amplification, we achieve over 150x better resolution than connecting the thermistor directly (which would use only 20mV of the 3.3V range).
Amplifier Gain Calculation for Maximum ADC Resolution: A thermocouple outputs 40μV/°C with 10mV output at 250°C. You need to measure 0-500°C range with ESP32’s 12-bit ADC (0-3.3V). What gain maximizes resolution without clipping?
Sensor output range (0-500°C):
Required gain to fill 3.3V ADC range:
Instrumentation amplifier (INA128) gain formula:
Solving for :
Use standard 301Ω resistor (1% tolerance) → actual gain = 167
ADC resolution after amplification:
Temperature resolution:
Comparison to direct connection (no amplification):
- Signal span without amplification: 20mV → uses only 25 ADC counts (20mV / 0.806mV)
- Temperature resolution: 500°C / 25 counts = 20°C per count (167x worse!)
With proper amplification, we achieve 0.12°C resolution instead of 20°C. The 167x gain improvement (from the INA128 with 301 ohm resistor) translates directly to 167x better measurement precision.
The thermistor example is voltage-range sizing. The load-cell example is the bridge version: full scale can still mean millivolts.
12.9 Strain Gauge Bridge Gain
12.10 Continue to Part 2
Continue with Sensor Circuits: Bridges and Noise.
