26 Sensor Linearization Methods
26.1 In 60 Seconds
Check the Curve With a Point You Did Not Fit
Picture a water tank whose level sensor is correct near empty and near full but bends through the middle. A smooth conversion can still give the wrong depth where the pump decision matters. The operator needs a result tied to measured points, not a neat line that only fits the points used to create it.
An analog-to-digital converter is a part that turns a changing electrical signal into numbered steps. It is often shortened to ADC. Record the raw step, the known tank depth, the allowed range, and the conversion version. Keep some measured points out of the fitting work so they can test the result independently.
Try the empty, middle, and full regions. Add a noisy reading, a value just outside the measured range, and a restart. Check that the converted value stays within the agreed error, that an outside value is flagged or bounded, and that the original reading remains available.
This trial does not prove every sensor or fitting method. The deeper sections compare simple segments, tables, and equations, then show how residual error and range evidence support the final choice.
Linearization turns a curved sensor response into physical units, but it must not hide uncertainty. Pick the simplest method whose held-out residuals meet the target, keep the calibrated range explicit, and flag or clamp values outside the evidence instead of extrapolating confident numbers.
26.2 Start With the Story
You will choose a sensor correction method and check where calibration evidence supports its use. Start with measured reference points and the range over which the corrected values must remain reliable.
Follow one curved sensor response across four beats to see how calibration evidence selects a linearization method.
-
Physics Phoebe: “The calibration points show the response we have, not the straight line we wish we had.”
-
Test Tessa: “A convenient fit can still miss where the sensor bends most.”
-
The team: “Choose the method from measured residuals across the range.”
-
Test Tessa: “The corrected response now agrees with the references across the range.”
The mathematical gist. A 90 s excursion has a simple rate of Hz, so Nyquist asks for Hz, or one sample at least every 45 s. The chapter’s 200 s logger samples at only 0.005 Hz and folds the event to Hz — a smooth-looking 15-minute fake drift. Its separate 12-bit check gives a 0.806 mV code and 0.233 mV RMS quantization noise before any calibration fit.
26.3 Turn a Curved Response Into Correct Units
Many sensors do not produce an output that is proportional to what they measure. A thermistor's resistance, for example, changes steeply and nonlinearly as temperature changes. Linearization is the step that converts that curved raw response into the correct physical units.
Picture a bathroom scale whose spring stiffens as it compresses. The pointer still moves, but not evenly, so you need a conversion that knows the spring's curve to read true weight. Linearization is that conversion for a sensor.
If you only need the intuition, this layer is enough: linearization maps a sensor's curved output to real units, and a smooth, precise-looking converted number is only as accurate as the calibration it rests on, never more.
The honesty rule matters most here. Making the numbers come out smooth is not the same as making them accurate. A conversion can present a clean value to many decimals while the real uncertainty lives in the calibration behind it. No method can be more accurate than the calibration data it was built from.
Consider an NTC thermistor on a cold-chain logger. The ADC code may change quickly near freezing and slowly at warmer temperatures, so a single slope can make the freezer end look acceptable while the room-temperature end drifts. A better workflow is to collect reference points across the shipping range, fit a Steinhart-Hart equation or a lookup table, then compare the converted temperatures against held-out reference readings. If the held-out residuals are still larger than the product's tolerance, the display should not imply more accuracy than the calibration proves. The firmware also needs to know the calibrated range: an ADC code outside the tested span should be flagged or clamped, not silently converted into a confident Celsius value.
The next Turn a Curved Response Into Correct Units decision depends on the diagram Figure 26.1. Reading physical units against raw sensor code clarifies the practical meaning of Linearization is valid only where calibration evidence supports the correction.
Inspect the curved response beside the local line and piecewise fit in Figure 26.1. The calibrated region bounds the supported correction; values beyond it need a flag or clamp instead of extrapolation.
The One-Minute Linearization Decision
Know the curve
Get the sensor's characteristic from the manufacturer or your own calibration before choosing a method.
Match method to constraints
Balance accuracy, operating range, and the device's available compute and memory.
Keep error visible
Track residuals and the valid range so the conversion does not hide measurement uncertainty.
Beginner Examples
- A nearly linear sensor over a small range may need only a straight-line fit with an offset and a slope.
- A steeply curved sensor over a wide range needs a method that follows the curve, such as a lookup table or a fitted model.
- A value shown to six decimals is not accurate to six decimals if the calibration was only good to a fraction of a unit.
Linearization Honesty Knowledge Check
If this gives you the core principle, you can stop here. Continue to Practitioner when you need to choose a method for a real sensor.
26.4 Apply It: Choose a Method From the Evidence
The practical job is to choose the simplest linearization method whose residuals meet the accuracy target within the device's limits, then prove it on held-out data and protect against out-of-range inputs.
The Method Options
The The Method Options argument uses Figure 26.2 to compare Choose by evidence, range, upkeep. Look next for narrow range near one point before accepting Method choice starts with range, residual behavior, and maintainability, not with the smoothest-looking formula as a design claim.
Read the method cards in Figure 26.2, starting with the local line for a narrow range. Segments extend coverage, tables provide fixed breakpoints, and polynomial fits need residual checks. Choose using the calibration range and maintenance needs.
Walkthrough: From Sensor Curve to Validated Conversion
- Characterize the sensor. Gather calibration points across the real operating range, not only a few convenient values.
- Quantify nonlinearity and range. A nearly straight, narrow-range sensor needs far less than a steeply curved, wide-range one.
- List device constraints. Available compute, memory, and required conversion speed narrow the field; a small microcontroller may favor a lookup table over a high-degree polynomial.
- Choose the simplest method that meets the target. Prefer the least complex method whose residuals stay within budget.
- Check residuals on held-out points. Large or patterned residuals mean the method or its parameters are wrong.
- Guard the range and validate at release. Clamp or flag inputs outside the calibrated range, and re-validate against references before shipping and after any sensor or firmware change.
A reliable Walkthrough: From Sensor Curve to Validated Conversion review needs the figure Figure 26.3. Its Calibration record before release and Raw Code markers reveal where A releaseable conversion keeps the raw code, reference value, fit choice, residuals, and gate decision together enters the running decision.
Within the visual Figure 26.3, Calibration record before release establishes the opening checkpoint because it uses Calibration record before release to hold review evidence. Raw Code develops the Walkthrough: From Sensor Curve to Validated Conversion reading by showing how it highlights Raw Code; Reference completes it by showing where it highlights Reference. The sequence makes A releaseable conversion keeps the raw code, reference value, fit choice, residuals, and gate decision together auditable for Walkthrough: From Sensor Curve to Validated Conversion.
Choosing by Evidence
Incremental Practice
Beginner
For a near-linear sensor over a small range, justify using a simple slope-and-offset fit.
Intermediate
For a constrained device and a steeply curved sensor, argue for a lookup table over a high-degree polynomial.
Advanced
Given residuals that form a systematic curved pattern after a linear fit, state what that pattern reveals and your next step.
Method Selection Knowledge Check
If your job is to select and validate a conversion, you can stop here. Continue to Under the Hood for how each method fails.
26.5 Under the Hood: How Each Method Fails
Linearity and noise cease to be separate specifications when a curved transfer function rectifies an AC disturbance. Figure 26.4 expands that path and places the resulting bias beside Johnson and Hooge floors.
In Figure 26.4, Expand the response exposes the squared sinusoid, and Rectified DC bias uses mean{sin²ωt}=1/2 to produce a₂n²/2 even though the disturbance itself averages to zero. Johnson floor and Hooge / 1/f floor then set the small-signal threshold below which that curvature-induced bias must remain.
The deeper layer explains the error behavior behind each method, because choosing well means knowing how each one breaks.
Local (Taylor) Linearization
A local linearization keeps the first-order term of a series expanded around an operating point, which is the local slope, and discards the rest. Those discarded higher-order terms are the error, and they grow roughly with the square of the distance from the expansion point. The result is excellent near the point and increasingly wrong far from it.
Polynomial Fit and Overfitting
A polynomial of degree n has n + 1 coefficients and can pass exactly through n + 1 points. Passing through the points is not accuracy. High-degree fits, especially with equally spaced calibration points, can swing far above and below the true curve between the points, a behavior known as the Runge phenomenon, and they diverge quickly outside the calibrated range. Prefer the lowest degree whose held-out residuals are acceptable.
Piecewise-Linear and Lookup Tables
Both approximate the curve with straight segments, and a lookup table is essentially a piecewise-linear model stored as data. The error inside a segment depends on the curve's bend and the segment width. For a smooth curve the worst-case interpolation error scales with the square of the segment width, so halving the segment width roughly quarters the error. Accuracy is therefore bought with more breakpoints or table entries, which costs memory.
Calibration Uncertainty Is the Floor
No linearization can be more accurate than the calibration points it is built from. If the reference is uncertain, every converted value inherits that uncertainty. Keep two ideas separate: model error is how well the curve fits the points, and calibration error is how good those reference points were in the first place.
Residual Analysis
Residuals are the differences between the model and held-out calibration points. Small, randomly scattered residuals suggest a good fit, while a systematic pattern, such as a consistent smile or trend, means the model is missing real structure. Residuals measured on the same points used to fit understate the true error, so always check against points the model did not see.
The next Residual Analysis decision depends on the diagram Figure 26.5. Reading Validate before release against Fit Points clarifies the practical meaning of Validation uses independent holdout points and range guards; failing residuals send the method back for better evidence or a simpler fit.
Follow Figure 26.5 from Validate before release into Fit Points before checking Holdout. The first uses Validate before release to mark a decision point, the second highlights Fit Points, and the last highlights Holdout. This ordered reading preserves Validation uses independent holdout points and range guards; failing residuals send the method back for better evidence or a simpler fit in the Residual Analysis evidence chain.
Extrapolation Is Unbounded
Every method is valid only inside the calibrated range. Outside it, polynomial terms explode and tables have no data, so out-of-range inputs must be clamped or flagged rather than silently converted into confident, wrong numbers.
Common Pitfalls
- Equating fit with accuracy. Passing through every calibration point can be overfitting, not correctness.
- Raising polynomial degree to chase residuals. It can oscillate and worsen accuracy between and beyond the points.
- Reporting more precision than the calibration supports. The converted value cannot beat its reference.
- Extrapolating beyond the calibrated range. Error there is unknown and can be large.
- Checking residuals only on the fitting points. That hides the real generalization error.
Overfitting Knowledge Check
At this depth, linearization is a trade among model flexibility, compute, memory, and honesty about uncertainty. The best method is the simplest one whose held-out residuals meet the target, applied only inside the range where the calibration can vouch for it.
26.6 Summary
- Linearization converts a sensor’s nonlinear raw output into correct physical units.
- A smooth, precise-looking converted value is never more accurate than the calibration behind it.
- Common methods are local (Taylor) linearization, piecewise-linear, lookup tables with interpolation, and polynomial fits, each with different error behavior.
- Choose the simplest method whose held-out residuals meet the accuracy target within the device’s compute and memory limits.
- High-degree polynomials can overfit and oscillate, so passing through every calibration point is not proof of accuracy.
- Every method is valid only inside the calibrated range, so out-of-range inputs must be clamped or flagged and residuals checked on held-out points.
Pick the simplest linearization method whose held-out residuals meet the accuracy target, keep the calibration uncertainty visible rather than hidden by smooth numbers, and never trust the conversion outside its calibrated range.
26.7 See Also
ADC Sampling Fundamentals
The sampling and resolution decisions that produce the raw codes you linearize.
Signal Processing Essentials
Where linearization fits among filtering, resolution, and validation decisions.
