How to Calibrate a Sensor with Two-Point and Multi-Point Fits
Calibrate sensors step by step: two-point gain and offset, least-squares and polynomial fits, residuals, tolerance checks and converting raw readings.

How to Calibrate a Sensor with Two-Point and Multi-Point Fits
Sensors rarely speak in the units you need. A pressure transmitter sends 4 to 20 milliamps, a load cell a few millivolts, a thermistor a resistance, a microcontroller an ADC count. Calibration is the process of finding the function that turns that raw signal into bar, kilograms or degrees, and showing how accurate the result is. The maths is straightforward once the steps are clear.
Collect reference points
You need a reference that is more accurate than the sensor, ideally by a factor of four or more: a deadweight tester for pressure, certified weights for a load cell, a reference thermometer in a stable bath for temperature. Apply known values across the whole range and write down what the sensor reads at each. Five points spread evenly from bottom to top is a good minimum. Going up and then down the range also reveals hysteresis.
Let readings settle before recording them, and note the conditions such as ambient temperature, because many sensors drift with temperature.
Two-point calibration
The simplest fit uses a low and a high point. The gain (slope) is the change in reference divided by the change in raw reading, and the offset is the reference value where the line crosses a raw reading of zero:
- gain = (ref₂ − ref₁) ÷ (raw₂ − raw₁)
- offset = ref₁ − gain × raw₁
- corrected value = offset + gain × raw
For a 4 to 20 mA transmitter on a 0 to 10 bar range, ideal values give a gain of 10 ÷ 16 = 0.625 bar per mA and an offset of −2.5 bar. Two-point calibration is quick and often enough for linear sensors, but it says nothing about errors between the two points.
Multi-point least squares
With more points, fit the line that minimises the sum of squared errors across all of them. This averages out reading noise and shows linearity errors as a pattern in the residuals. The Sensor Two-Point and Multi-Point Calibration Calculator fits two-point, linear, quadratic and cubic models and draws the fitted curve over your points.
Read the residuals
The residual at each point is the corrected reading minus the reference. Look at three things:
- Size: the largest residual, in units and as a percentage of full scale, compared with your tolerance.
- Pattern: random scatter around zero means the model fits; a smile or frown shape means the sensor is non-linear and a quadratic may be justified.
- Outliers: one point far from the rest may be a reading mistake. Switch it off, refit, and see whether the result changes much before you decide to drop it.
R squared close to 1 is necessary but not sufficient; a curved residual pattern can hide behind an R squared of 0.9999.
Choosing the model
Prefer the simplest model that leaves random residuals within tolerance. Higher-degree polynomials always reduce residuals on the points you used, but can bend between and beyond them. Keep at least two more points than coefficients: five or more for a quadratic, six or more for a cubic. Never trust a fit outside the calibrated range; the tool flags readings that would be extrapolated.
Tolerance, as found and as left
Tolerance may be stated as a percentage of full scale, a percentage of reading or a fixed value. Check every point against it. If you have the previous calibration's coefficients, compute the as-found error with them before adjusting. That tells you whether the sensor had drifted out of tolerance in service, which matters for any decisions made with its readings.
Put the result to work
Enter the gain and offset, or polynomial coefficients, into the PLC, data logger or firmware scaling. For alarms and trips, solve the equation backwards to find the raw value for each set point. Then re-check two or three points to confirm the new scaling.
Document it
Record the instrument, reference standard and its certificate, the conditions, every point with its error and the pass or fail result, and sign it. This sheet is not an accredited certificate, which also needs a documented method and an uncertainty budget, but it is the evidence that your sensor's readings mean what they say.



