Sensors
Sensor interfacing, signal conditioning, and measurement accuracy.
1 subtopic · 12 pages
Sensors convert physical quantities — temperature, pressure, acceleration, current, position, humidity — into electrical signals that a microcontroller or measurement system can process. Getting accurate, reliable measurements requires understanding the sensor's output characteristics, designing appropriate signal conditioning circuitry, and correctly interfacing with the ADC.
What Is Sensor Interfacing?
Sensor interfacing covers the complete path from the physical world to digital data:
- Sensor selection — choosing the right technology (resistive, capacitive, piezoelectric, optical, electrochemical) for the measurement range, accuracy, speed, and power requirements.
- Signal conditioning — amplifying, filtering, and scaling the sensor's raw output to match the ADC's input range.
- ADC interfacing — selecting the ADC type (SAR, delta-sigma, successive approximation), setting the sampling rate, and applying anti-aliasing.
- Calibration — compensating for offset, gain, and temperature drift to achieve the required measurement accuracy.
Why Sensor Design Matters
A sensor design failure is often invisible in the lab but catastrophic in the field. Common failure modes:
- Accuracy worse than expected — noise analysis not done, amplifier noise dominates over sensor signal, or incorrect ADC reference voltage produces systematic offset.
- Drift over temperature — components with high temperature coefficients change the measurement reading as temperature changes; this is especially significant in outdoor or industrial applications.
- EMI pickup on the sensor interface — long sensor cables act as antennas; differential signalling, proper shielding, and filtering are required to achieve the specified accuracy in electrically noisy environments.
- Impedance mismatch — some sensors (piezoelectric, pH electrode, capacitive) have very high source impedance; the amplifier's input impedance must be orders of magnitude higher to avoid loading the sensor.
Key Concepts
- Signal conditioning — the collective term for amplification, filtering, level shifting, impedance transformation, and offset correction applied to a sensor signal before digitisation.
- Full-scale range — the span of values the sensor can measure, e.g. −40 °C to +125 °C for a temperature sensor.
- Sensitivity — the change in output per unit change in the measured quantity, e.g. 10 mV/°C for an analogue temperature sensor.
- Anti-aliasing filter — a low-pass filter placed before the ADC to remove signal components at or above half the sampling frequency, preventing them from aliasing into the measurement band.
- Differential measurement — measuring the difference between two signals rather than each relative to ground; required for small signals in the presence of common-mode noise (e.g. bridge sensors, thermocouples, 4–20 mA current loops).
- NTC thermistor — a resistor whose resistance decreases non-linearly with increasing temperature. Requires the Steinhart-Hart equation or a lookup table to convert resistance to temperature.
- RTD (Resistance Temperature Detector) — a precision temperature sensor whose resistance increases linearly with temperature (PT100: 100 Ω at 0 °C, 0.385 Ω/°C). More accurate and more expensive than an NTC thermistor.
- IMU (Inertial Measurement Unit) — a sensor combining a 3-axis accelerometer and 3-axis gyroscope, commonly also with a 3-axis magnetometer; outputs acceleration, angular rate, and optional orientation data.
Common Tools and Software
- Manufacturer evaluation boards — most major sensor manufacturers (TI, STMicroelectronics, TE Connectivity, Bosch Sensortec) provide evaluation kits with reference firmware. Starting with a known-working evaluation board lets you characterise a sensor's behaviour before committing to a custom PCB design.
- Test equipment — a multimeter for verifying sensor excitation voltages and basic output levels; an oscilloscope for checking analog sensor output waveforms and identifying noise sources; a logic analyser for verifying I2C/SPI sensor communication.
- Calibration references — for temperature calibration: a traceable reference thermometer or temperature-controlled bath. For current calibration: a calibrated bench ammeter or a precision shunt resistor with a calibrated voltage measurement.
- Signal conditioning design tools — LTspice for simulating the complete signal conditioning chain (sensor model → amplifier → filter → ADC), TI's WEBENCH for instrumentation amplifier and filter selection.
Common Mistakes
- Not accounting for sensor source impedance at the amplifier input — piezoelectric sensors, pH electrodes, and some capacitive sensors have very high source impedance (GΩ range). The amplifier's input impedance must be orders of magnitude higher, or the sensor is loaded and the output is incorrect. Use a FET-input op-amp or a dedicated electrometer amplifier for high-impedance sources.
- Skipping the anti-aliasing filter before the ADC — noise and signal components above half the ADC sampling rate alias into the measurement band and cannot be removed in firmware. Every ADC interface requires a low-pass filter with a cutoff at or below half the sampling frequency.
- Measuring sensor accuracy only at room temperature — most accuracy requirements are over an operating temperature range. Temperature coefficients in resistors, op-amp offset drift, and ADC reference drift all shift readings as temperature changes. Test at the extremes of the operating range, not just on a lab bench at 25 °C.
- Running analog sensor wiring parallel to digital or power traces — long sensor cables act as antennas and pick up radiated noise from adjacent digital signals and switching converters. Use differential signalling (instrumentation amplifier, 4–20 mA loop), twisted-pair cable, or shielded cable for sensors in electrically noisy environments.
- Two-point calibration without accounting for non-linearity — for sensors with non-linear outputs (NTC thermistors, some pressure sensors), a two-point gain-and-offset correction gives good accuracy only near the calibration points. Use the Steinhart-Hart equation or a multi-point lookup table where accuracy is required across the full range.
Common Questions
What is the difference between an NTC thermistor and a PT100 RTD?
Both measure temperature through resistance change, but they differ in output, accuracy, and application. An NTC thermistor has a large, non-linear resistance change with temperature (providing high sensitivity but requiring a non-linear calibration equation), and is typically used from −40 to +150 °C. A PT100 RTD has a small, linear resistance change (0.385 Ω/°C nominally) and is far more accurate and stable over a wider range, but requires a more careful interface circuit and is more expensive. For precision industrial or scientific measurement above 150 °C, an RTD is appropriate; for cost-sensitive applications needing ±0.5–1 °C accuracy, an NTC thermistor or digital sensor is usually more practical.
How do I reduce noise in my ADC readings from a sensor?
Work from the source: ensure the sensor's signal conditioning amplifier has sufficient gain so the ADC sees a signal that spans most of its input range. Apply an anti-aliasing filter whose cutoff is at most half the ADC sampling rate. Use a quiet power supply for the ADC VREF and analog supply, separate from any digital supplies. Route the analog signal on a layer away from digital clock traces. Average multiple samples in firmware (oversampling + decimation) to reduce random noise at the cost of bandwidth. See sensor signal conditioning basics for the complete framework.
How do I calibrate a sensor interface?
Two-point calibration (offset and gain correction) covers the majority of applications: measure the output at two known reference points, compute the offset and gain correction factors, and apply them in firmware. For applications requiring higher accuracy across a temperature range, multi-point calibration with a polynomial or lookup table may be needed. Zeus Design designs sensor interfaces and data acquisition hardware for industrial and IoT applications.
Knowledge Base
Temperature Sensing
- What Is a Thermistor? — NTC thermistor operating principle, B-parameter model, linearisation, and ADC interface
- How Do PT100 and RTD Temperature Sensors Work? — 2-wire, 3-wire, and 4-wire connections; Wheatstone bridge; instrumentation amplifier interface
- How Do You Interface a Digital Temperature Sensor? — DS18B20 1-Wire, MCP9808 I2C, and choosing between analog and digital sensor outputs
- How Do You Use the MAX31865 RTD-to-Digital Converter with a PT100 Sensor? — SPI wiring, configuration register, resistance-to-temperature conversion, fault detection
Motion and Orientation Sensing
- What Is an Accelerometer and IMU? — MEMS accelerometer and gyroscope principles, SPI/I2C interface, data fusion basics
Current Sensing
- How Do You Measure Current with a Shunt Resistor? — high-side and low-side sensing, shunt resistance selection, Kelvin connections, and when to use dedicated current-sense ICs
- How Do You Use the INA219 and INA226 I2C Current-Sense ICs? — calibration register, configuration register, ALERT pin setup, address selection, and bring-up code
Signal Conditioning
- Sensor Signal Conditioning Basics — amplification, offset and scaling, anti-aliasing filters, ADC input protection, and 4–20 mA loop interfaces
- What Is an Instrumentation Amplifier? — three-op-amp topology, CMRR, and gain setting for bridge and differential sensor inputs
References and Precision
- What Is a Voltage Reference IC? — choosing a stable reference for ADC VREF, DAC reference, and precision measurement circuits
Subtopics
Forum Discussions
MAX31865 reading fault bit on every conversion — VBIAS enabled but still faulting
Spent most of yesterday trying to get a MAX31865 talking to my STM32F4 and I'm stuck on the same problem no matter what I try: the fault bit
ICM-42688-P INT1 never fires after FIFO setup — FIFO count stuck at 0x0000 but WHO_AM_I reads back correctly
Working on a motion data logger — ICM-42688-P on an STM32F4 via SPI4 at 4 MHz. SPI seems fine: WHO_AM_I at register 0x75 reliably returns 0x
NTC thermistor temperature reading jumping ±4°C — ADC noise or something in the circuit?
I've got an NTC thermistor (10 kΩ at 25°C, standard B = 3950) in a voltage divider with a 10 kΩ fixed resistor, top rail 3.3 V, thermistor t