IoT Fundamentals · Study deck

Sensor Linearization Methods

Picture a water tank whose level sensor is correct near empty and near full but bends through the middle.

Physics Phoebe is your guide for this deck.

signalprocessinglinearization
Physics Phoebe, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Explain: 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.
  • Explain: 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.
  • Explain: If the held-out residuals are still larger than the product's tolerance, the display should not imply more accuracy than the calibration proves.
iotclass.org

Major section

In 60 Seconds

A smooth conversion can still give the wrong depth where the pump decision matters.

  • An analog-to-digital converter is a part that turns a changing electrical signal into numbered steps.
  • This trial does not prove every sensor or fitting method.
  • Linearization turns a curved sensor response into physical units, but it must not hide uncertainty.
iotclass.org

Major section

Start With the Story

You will choose a sensor correction method and check where calibration evidence supports its use.

  • The mathematical gist.: A 90 s excursion has a simple rate of $1/90=0.0111$ Hz, so Nyquist asks for $f_s\geq0.0222$ Hz, or one sample at least every 45 s.

Numbers to remember

0.806 mVIts separate 12-bit check gives a 0.806 mV code
0.233 mV0.233 mV RMS quantization noise before any calibration fit.
iotclass.org

Major section

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.
  • Linearization is that conversion for a sensor.

Key terms

If the held-out residuals
If the held-out residuals are still larger than the product's tolerance, the display should not imply more accuracy than the calibration proves.
Linearization is valid only where calibration evidence supports the correction.
Linearization is valid only where calibration evidence supports the correction.
iotclass.org

Major section

Turn a Curved Response Into Correct Units (continued)

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 pointer still moves, but not evenly, so you need a conversion that knows the spring's curve to read true weight.
  • Making the numbers come out smooth is not the same as making them accurate.
  • If this gives you the core principle, you can stop here.
iotclass.org

Major section

Turn a Curved Response Into Correct Units (continued)

Reading physical units against raw sensor code clarifies the practical meaning of Linearization is valid only where calibration evidence supports the correction.

  • 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.
  • The calibrated region bounds the supported correction; values beyond it need a flag or clamp instead of extrapolation.
iotclass.org

Major 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 sensor runs in a narrow band near a known point.
  • Error grows quickly away from that point.

Key terms

If your job
If your job is to select and validate a conversion, you can stop here.
Method choice starts with range, residual behavior, and maintainability, not with the smoothest-looking formula.
Method choice starts with range, residual behavior, and maintainability, not with the smoothest-looking formula.
iotclass.org

Major section

Apply It: Choose a Method From the Evidence (continued)

Quantify nonlinearity and range.: A nearly straight, narrow-range sensor needs far less than a steeply curved, wide-range one.

  • Memory use and table density set accuracy.
  • One smooth equation fit to calibration data.
  • The model and its coefficients are trustworthy.
  • Piecewise-linear, denser where curvature is high.
iotclass.org

Major section

Apply It: Choose a Method From the Evidence (continued)

Segments extend coverage, tables provide fixed breakpoints, and polynomial fits need residual checks.

  • 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.
  • 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.
  • 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.
iotclass.org

Major section

Under the Hood: How Each Method Fails

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.

Key terms

Passing through the points
Passing through the points is not accuracy.
Accuracy
Accuracy is therefore bought with more breakpoints or table entries, which costs memory.

Why it matters

The deeper layer explains the error behavior behind each method, because choosing well means knowing how each one breaks.

A quadratic sensor response converts a zero-mean sinusoidal disturbance into DC bias before comparison with white and one-over-f noise floors.
A quadratic sensor response converts a zero-mean sinusoidal disturbance into DC bias before comparison with white and one-over-f noise floors.
iotclass.org

Major section

Under the Hood: How Each Method Fails (continued)

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.
  • Prefer the lowest degree whose held-out residuals are acceptable.
  • The error inside a segment depends on the curve's bend and the segment width.
iotclass.org

Major section

Under the Hood: How Each Method Fails (continued)

Residual Analysis Residuals are the differences between the model and held-out calibration points.

  • 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.
  • Accuracy is therefore bought with more breakpoints or table entries, which costs memory.
  • If the reference is uncertain, every converted value inherits that uncertainty.
iotclass.org

Major section

Under the Hood: How Each Method Fails (continued)

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.

  • 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 first uses: Validate before release to mark a decision point, the second highlights: Fit Points, and the last highlights: Holdout.
iotclass.org

Major section

Under the Hood: How Each Method Fails (continued)

Common Pitfalls Equating fit with accuracy.: Passing through every calibration point can be overfitting, not correctness.

  • 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.
  • Reporting more precision than the calibration supports.: The converted value cannot beat its reference.
iotclass.org

Major section

Under the Hood: How Each Method Fails (continued)

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.

  • Raising polynomial degree to chase residuals.: It can oscillate and worsen accuracy between and beyond the points.
  • Extrapolating beyond the calibrated range.: Error there is unknown and can be large.
  • At this depth, linearization is a trade among model flexibility, compute, memory, and honesty about uncertainty.
iotclass.org

Deck summary

Key takeaways

A smooth conversion can still give the wrong depth where the pump decision matters.

  • You will choose a sensor correction method and check where calibration evidence supports its use.
  • Many sensors do not produce an output that is proportional to what they measure.
  • If the held-out residuals are still larger than the product's tolerance, the display should not imply more accuracy than the calibration proves.
  • Reading physical units against raw sensor code clarifies the practical meaning of Linearization is valid only where calibration evidence supports the correction.
iotclass.org

Retrieval practice

Recall check 1 of 3

Physics Phoebe says: answer from memory, then check your reasoning.

Q1A converted temperature is displayed to six decimal places and looks very smooth. What does that tell you about its accuracy?

AIt proves six-decimal accuracy because the display rounded the converted value that way
BIt proves the sensor response was linear before any calibration curve was applied
CIt proves only numeric formatting; calibration residuals still set accuracy
DIt proves no reference check is needed once the conversion equation looks smooth
Show answer

Answer: C Numeric precision and visual smoothness are not the same as measurement accuracy.

iotclass.org

Retrieval practice

Recall check 2 of 3

Physics Phoebe says: answer from memory, then check your reasoning.

Q2A steeply nonlinear sensor must be converted quickly on a small microcontroller with little spare compute but some free memory, across a wide range. Which method is the most reasonable starting point?

AA high-degree polynomial evaluated at every sample
BA lookup table with interpolation
CA single Taylor expansion around one operating point
DNo linearization; report the raw codes
Show answer

Answer: B A table converts quickly with little compute and follows the curve as densely as memory allows, giving repeatable conversion across the range.

iotclass.org

Retrieval practice

Recall check 3 of 3

Physics Phoebe says: answer from memory, then check your reasoning.

Q3A high-degree polynomial passes through all the calibration points exactly, but between them it swings far from the true curve, and outside the range it diverges. What is happening, and what is the fix?

AOverfitting, the Runge phenomenon
BThe sensor is broken and must be replaced
CThere are too few calibration points; add more at the same degree
DFloating-point precision loss
Show answer

Answer: A The data fits, but a too-flexible model oscillates between points and diverges outside the range.

iotclass.org

Print reference

Answers

Answer key.

  1. C · Numeric precision and visual smoothness are not the same as measurement accuracy.
  2. B · A table converts quickly with little compute and follows the curve as densely as memory allows, giving repeatable conversion across the range.
  3. A · The data fits, but a too-flexible model oscillates between points and diverges outside the range.
iotclass.org