Chapters

26 Sensor Linearization Methods

fundamentals
signal
processing
linearization

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.

  1. Physics Phoebe and Test Tessa record calibration points that reveal a curved sensor response across the working range.

    Physics Phoebe: “The calibration points show the response we have, not the straight line we wish we had.”

  2. Test Tessa points out candidate fits whose residual gaps grow near the ends of the measured sensor range.

    Test Tessa: “A convenient fit can still miss where the sensor bends most.”

  3. Physics Phoebe and Test Tessa choose a segmented evidence-based fit while preserving every calibration point for comparison.

    The team: “Choose the method from measured residuals across the range.”

  4. Physics Phoebe and Test Tessa verify corrected sensor units at cold, middle, and warm reference conditions.

    Test Tessa: “The corrected response now agrees with the references across the range.”

Linearization earns trust when the chosen fit follows calibration evidence and its residuals across the working range.

The mathematical gist. A 90 s excursion has a simple rate of 1/90=0.01111/90=0.0111 Hz, so Nyquist asks for fs0.0222f_s\geq0.0222 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 0.01112(0.005)=0.00111|0.0111-2(0.005)|=0.00111 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.

Math Bridge · guided foundationsHow can a 90-second event masquerade as a 15-minute drift?Let Phoebe unpack sample intervals, the Nyquist bound, folding, and the chapter's thermistor numbers.

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.

Curved sensor response showing a local linearization range, piecewise fit, and out-of-range region.
Figure 26.1: 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.

yes

no

no

Raw sensor code

Apply calibration method

Reference calibration points

Converted physical units

Compare held-out residuals

Residuals within tolerance?

Ship with valid range and uncertainty

Change method, add points, or relax claim

Inside calibrated range?

Flag or clamp instead of extrapolating

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

Method
How It Works
Best When
Watch Out For
Local (Taylor)
A straight-line approximation around one operating point.
The sensor runs in a narrow band near a known point.
Error grows quickly away from that point.
Piecewise-linear
Straight segments between chosen breakpoints.
Moderate curvature with limited compute.
Kinks at breakpoints; error set by segment count.
Lookup table
Stored output values, interpolated between entries.
Constrained compute with a repeatable curve.
Memory use and table density set accuracy.
Polynomial fit
One smooth equation fit to calibration data.
A smooth curve with enough calibration points.
High degree overfits and oscillates.
Characteristic equation
Invert the manufacturer's published model.
The model and its coefficients are trustworthy.
Only as good as your calibration of its parameters.

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.

Method chooser comparing Taylor or local line, piecewise-linear, lookup table, and polynomial or equation approaches.
Figure 26.2: Method choice starts with range, residual behavior, and maintainability, not with the smoothest-looking formula.

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

  1. Characterize the sensor. Gather calibration points across the real operating range, not only a few convenient values.
  2. Quantify nonlinearity and range. A nearly straight, narrow-range sensor needs far less than a steeply curved, wide-range one.
  3. 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.
  4. Choose the simplest method that meets the target. Prefer the least complex method whose residuals stay within budget.
  5. Check residuals on held-out points. Large or patterned residuals mean the method or its parameters are wrong.
  6. 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.

Calibration release record linking raw code, reference value, fit choice, held-out residuals, and release gate.
Figure 26.3: A releaseable conversion keeps the raw code, reference value, fit choice, residuals, and gate decision together.

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

Situation
Evidence
Reasonable Method
Why
Narrow operating band
Residuals small across the band.
Local (Taylor) linearization.
Minimal compute for a small range.
Wide range, compute available
Low-degree polynomial residuals acceptable.
Low-degree polynomial.
One compact equation covers the curve.
Wide range, constrained device
Needs fast, repeatable conversion.
Lookup table with interpolation.
Trades memory for compute.
Sharp local features
Curvature concentrated in a region.
Piecewise-linear, denser where curvature is high.
Bounded per-segment error where it matters.

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.

Four-stage small-signal diagram: expand v equals a0 plus a1x plus a2x squared, obtain rectified DC bias a2 n squared over two, calculate Johnson noise square root of 4kTRB, and compare a device-qualified Hooge one-over-f floor.
Figure 26.4: A quadratic sensor response converts a zero-mean sinusoidal disturbance into DC bias before comparison with white and one-over-f noise 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.

Validation loop using fit points, independent holdout points, residual review, range guard, and a revision loop.
Figure 26.5: 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

  1. Equating fit with accuracy. Passing through every calibration point can be overfitting, not correctness.
  2. Raising polynomial degree to chase residuals. It can oscillate and worsen accuracy between and beyond the points.
  3. Reporting more precision than the calibration supports. The converted value cannot beat its reference.
  4. Extrapolating beyond the calibrated range. Error there is unknown and can be large.
  5. 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.
Key Takeaway

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.