20 Calibration Span Error and Validation
Reference Span, Residuals, and Release Evidence
sensor calibration, calibration span, residuals, reference uncertainty, range guard, two-point calibration
20.1 Start With the Measurement Story
A sensor can look correct at one point and fail across the working range. The story here is span evidence: checking low, middle, and high values so the calibration works where the IoT system actually operates.
20.2 Learning Objectives
After this page, you should be able to:
- Explain why reference points that are too close together amplify calibration error.
- Choose calibration references that bracket the operating range instead of extrapolating from the middle.
- Use residual checks to separate random noise from systematic nonlinearity.
- Decide what evidence belongs in a production calibration release record.
20.3 Why This Follows the Lab
The Sensor Calibration Lab builds the two-point equation and stores it in firmware. This page tests the equation as an engineering model: the reference span, independent verification points, residual limits, and range guards decide whether the model is trustworthy enough to ship.
A calibration coefficient is not proof by itself. A useful record includes the two fit references, the calculated slope and offset, at least one holdout verification point, the accepted residual limit, and the range where the correction is allowed to operate.
20.4 Reference Points Too Close
The mistake: An engineer performs two-point calibration on a soil moisture sensor using reference points at 45% and 55% moisture (only 10% apart). After deployment, the sensor shows large errors at 10% and 90% moisture because small inaccuracies in the closely-spaced reference measurements were amplified across the full range.
Why it happens: Two-point calibration creates a linear equation (y = mx + b) using two measurements. When those measurements are close together, any small error in the reference measurement or sensor reading gets amplified when extrapolating to values far from the calibration range.
Real numbers: A 10 ADC count error (1% of full scale) in your reference point, when calibration range is only 100 counts, produces up to 5% error at the measurement extremes. The narrow calibration range acts as a lever arm amplifying tiny reference errors into significant measurement errors.
The fix: Use calibration points that bracket your expected measurement range with margin:
- Bad practice: Greenhouse needs 20-80% moisture, but calibration points are only 45% and 55%. The 10% calibration span covers only 17% of the operating range.
- Good practice: Greenhouse needs 20-80% moisture, and calibration points are 10% and 90%. The 80% span brackets the full operating range with margin.
Industry rule of thumb: Calibration span should be at least 1.2x your measurement range, ideally centered on your operating range. For a 20-80% application, calibrate at 10% and 90%.
Why wide span matters:
- Error division: 10 ADC count error / 800 ADC span = 1.25% relative error in gain, versus 10% relative error with a 100-count span.
- Interpolation not extrapolation: Measuring within calibration range is accurate; measuring outside it magnifies errors.
- Sensor nonlinearity: Most sensors are most linear in their mid-range; calibrating near the working endpoints exposes curvature sooner.
Verification test: After calibration, check several points across the full range:
- 0% moisture: Read dry sensor in air.
- 25% moisture: Use calibrated reference soil.
- 50% moisture: Half-saturated reference.
- 75% moisture: Nearly saturated reference.
- 100% moisture: Fully submerged in water.
If errors at 0% and 100% exceed +/-2%, your calibration points were too close together.
20.5 Close Reference Points Add Error
- Calibration points: 45% and 55%.
- Correct raw readings: 450 and 550 on a 0-1000 ADC scale.
- Correct gain:
(55 - 45) / (550 - 450) = 0.1. - If the high point is off by only 10 ADC counts, the gain becomes
(55 - 45) / (560 - 450) = 0.0909. - At the low extreme, 0% becomes 4.1%.
- At the high extreme, 100% becomes 95.0%.
The tiny reference error becomes a large endpoint error because the calibration span was too narrow.
20.6 Calibration Span Error
Explore how the width of your calibration span affects error amplification. Adjust the calibration points and reference error to see the impact on measurement accuracy at the extremes.
20.7 Knowledge Check: Calibration Span
20.8 Concept Relationships
| This Concept | Relates To | Relationship Type |
|---|---|---|
| Two-Point Calibration | Linear Algebra | Uses y=mx+b equation for correction |
| Gain Correction | Sensitivity Error | Multiplier that fixes slope/sensitivity issues |
| Offset Correction | Zero-Point Error | Additive constant that fixes bias |
| EEPROM Storage | Persistence | Non-volatile memory preserves calibration across power cycles |
| Moving Average Filter | Noise Reduction | Pre-filters data before calibration capture |
20.9 Label the Diagram
20.10 Code Challenge
20.11 Calibration Linearity Limits
A two-point calibration produces a straight line, so it silently assumes the sensor is linear between and beyond those points. That assumption is where calibrations quietly go wrong.
Use residuals to see the limit. Suppose the 0 kPa and 100 kPa references both calibrate exactly after the two-point fit, but a 50 kPa check reference reports 54 kPa. The residual is +4 kPa at mid-range. Repeating the 50 kPa measurement ten times may reduce random scatter around that 54 kPa value, but it will not move the average to 50 kPa because the remaining error is systematic curvature. A production calibration record should therefore keep the reference points, the fitted coefficients, and at least one independent verification residual, not just the final slope and offset.
Extrapolation is even riskier. The same line may be acceptable from 0 to 100 kPa but untrustworthy at 120 kPa, because the sensor diaphragm, bridge circuit, or ADC front end may stop behaving linearly outside the bracketed range. If the device must operate across a wider range, add reference points and use a piecewise-linear table or a fitted curve, then document the maximum allowed residual. The important engineering habit is to treat calibration as a model with a valid range, not as a permanent magic correction.
One point vs two points
A single reference can only correct offset; it trusts the datasheet slope. Two references correct offset and gain. Neither can correct curvature — that needs more points.
Interpolation vs extrapolation
Readings between the two references are interpolated and usually solid. Readings outside them are extrapolated, where unmodelled nonlinearity grows fastest. Bracket your working range.
Residual nonlinearity
If the true curve bows away from the line, a two-point fit leaves a bow-shaped error, largest near the middle. A three-point or polynomial fit is the fix, not a better two points.
Only as good as the reference
The calibration inherits the uncertainty of your reference standard. An uncertain reference gives an uncertain line — traceability matters, and drift means the line expires and must be redone.
It is also worth separating two jobs that are easy to confuse. Calibration removes systematic error (offset, gain, and with more points, curvature). Averaging many samples removes random error (noise). Averaging a badly calibrated sensor just gives you a very repeatable wrong answer.
20.11.1 Calibration Validation Limits
20.12 Release Checklist
Before accepting a two-point sensor calibration, record this evidence:
- The low and high reference values, including their uncertainty and traceability.
- The raw ADC counts or electrical readings captured at each reference.
- The calculated slope and offset, with units.
- At least one independent holdout point that was not used to fit the line.
- The maximum allowed residual and the actual residuals observed.
- The operating range where interpolation is allowed and the rule for rejecting extrapolated readings.
20.13 See Also
- Sensor Calibration Lab - hands-on Wokwi calibration workflow
- Sensor Calibration Techniques - broader calibration method reference
- Sensor Data Processing - filtering and signal conditioning before calibration capture
20.14 What’s Next
Return to Sensor Calibration Lab for the lab summary, or continue to Sensor Power Management to connect measurement quality with field energy constraints.
