A Two Point Calibration is a little more complex. But it can be applied to either raw or scaled sensor outputs. A Two Point calibration essentially re-scales the output and is capable of correcting both slope and offset errors. Two point calibration can be used in cases where the sensor output is known to be reasonably linear over the measurement range.
To perform a two point calibration:
- Take two measurements with your sensor: One near the low end of the measurement range and one near the high end of the measurement range. Record these readings as "RawLow" and "RawHigh"
- Repeat these measurements with your reference instrument. Record these readings as "ReferenceLow" and "ReferenceHigh"
- Calculate "RawRange" as RawHigh – RawLow.
- Calculate "ReferenceRange" as ReferenceHigh – ReferenceLow
- In your code, calculate the "CorrectedValue" using the formula below:
CorrectedValue = (((RawValue – RawLow) * ReferenceRange) / RawRange) + ReferenceLow
A common example of a two-point calibration is to calibrate a temperature sensor using an ice-water bath and boiling water for the two references. Thermocouples and other temperature sensors are quite linear within this temperature range, so two point calibration should produce good resuts.
Since these are physical standards, we know that at normal sea-level atmospheric pressure, water boils at 100°C and the "triple point" is 0.01°C. We can use these known values as our reference values:
ReferenceLow = 0.01°C
ReferenceHigh = 100°C
ReferenceRange = 99.99
Here we'll show a two point calibration of a laboratory thermometer. But the same principles apply to any temperature sensor:
Phase diagram by Matthieumarechal via Wikimedia Commons
As you can see this lab thermometer is off by -4 degrees at the boiling point of water.
"Triple Point" Ice-Water Bath
The same thermometer registers a little less than zero degrees in the ice-water bath.
So the "Raw" readings are:
RawLow = -0.5°C
RawHigh = 96.0°C
RawRange = 96.5°C
So, if we get a raw reading of 37°C with this thermometer, we can plug the numbers into the equation to get the corrected reading:
(((37 + 0.5) * 99.99) / 96.5) + 0.01 = 38.9°C