26 Sensor Linearization Methods
More
Depth: Practitioner
Progress saves as you read. Mark sections complete as you go; your progress appears in the sidebar.
26.1 In 60 Seconds
This section: In 60 Seconds — Picture a water tank whose level sensor is correct near empty and near full but bends through the middle.
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
This section: Start With the Story — You will choose a sensor correction method and check where calibration evidence supports its use.
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 is a transient, not a single 0.0111 Hz tone: a 200 s sampling interval can miss it altogether. The Hz (15-minute) alias applies to a continuous 0.0111 Hz sinusoid, not to the excursion. 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
This section: Turn a Curved Response Into Correct Units — Many sensors do not produce an output that is proportional to what they measure.
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 curve in Figure 26.1 marks where the fit holds; check points outside that range.
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
This section: 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 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 method cards in Figure 26.2 start with the range and device limits. A local line suits a narrow band around a known point but grows less reliable away from it. Piecewise segments can follow moderate curvature; a lookup table trades memory for a fast, repeatable conversion. A polynomial gives one smooth equation but can overfit. The worked fit below the cards makes the next test clear: use held-out calibration points to inspect residual gaps, not only the points used for fitting. Small scattered residuals support the fit; a pattern or out-of-range input calls for more points, another method, or a narrower 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.
The record in Figure 26.3 keeps raw codes and fit proof together; check the release gate.
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
This section: Under the Hood: How Each Method Fails — Linearity and noise cease to be separate specifications when a curved transfer function rectifies an AC disturbance.
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 loop in Figure 26.5 tests the fit on held-out points; revise it if they fail.
The loop in Figure 26.5 checks holdout residuals after the fit; notice why a range failure calls for new evidence or a simpler model.
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
This section: 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
This section: 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.
Find help
3 reviewed answers.
Where should I start in a module?
Open the module page from the sidebar to see its chapters in order. Use the module map to return to a topic you need.
Modules and pathsReviewed
What can I try when a project does not work?
Check the symptom, then work through the diagnostic steps. Keep the error message and the smallest example that reproduces it.
When you are stuckReviewed
How do interactive examples work?
Use the interactive guide to check how examples and simulations work before changing your project.
Interactive examples guideReviewed
