Home / Learn Embedded C / Calibrating an Analog Sensor
Calibrating an Analog Sensor
Correcting a sensor's raw-to-real-world conversion using one or more known reference points.
Breaking it down
Definition
Calibrating a sensor means adjusting its raw-to-real-world conversion formula using one or more known reference measurements, correcting for manufacturing variation, aging, or an imprecise generic datasheet formula.
Why you need this
Cheap sensors often vary unit-to-unit more than their datasheet's "typical" formula suggests — a simple calibration (measuring at one or two known points) can significantly improve real-world accuracy cheaply.
How it works
A single-point calibration shifts the whole curve by a constant offset; a two-point calibration also corrects its slope — more reference points generally allow correcting more complex, non-linear sensor behavior.
Where you'll see this
- Sensor accuracy improvement
- Production calibration routines
- Compensating for unit-to-unit variation
Try it
This standard linear-interpolation formula is the core of most simple two-point sensor calibrations.
Try it: a simpler single-point offset calibration
This only shifts every future reading by a constant offset — it cannot correct the sensor's slope the way the two-point method below can.
Test what you just read
1. What does a two-point calibration correct that a single-point calibration cannot?
A single reference point can only shift the whole curve by a constant amount; a second reference point lets you also correct how steeply the reading changes (the slope).