Sensors & Measurement · Study deck

Sensor Calibration: Measurement Foundations

A sensor can be precise and still report the wrong value.

Physics Phoebe is your guide for this deck.

sensorcalibration
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Explain calibration fundamentals: Describe why sensors need calibration and how raw readings differ from true values
  • Implement two-point calibration: Calculate offset and gain correction using low and high reference points
  • Apply signal conditioning: Configure moving average filtering to reduce noise in sensor readings
  • Evaluate raw vs calibrated data: Measure the impact of calibration on measurement accuracy
iotclass.org

Major section

Key Concepts

Moving Average Filter: A digital filter replacing each reading with the average of the last N samples, reducing noise at the cost of slower response to rapid changes.

  • Reference Standards: Known, accurate values used as the basis for calibration; reference accuracy sets a ceiling on achievable calibration accuracy, while the rest of the measurement chain adds uncertainty.
  • Calibration Drift: Gradual change in sensor response over time due to aging, contamination, or thermal stress, requiring periodic recalibration.
Calibration transforms inaccurate raw sensor readings into precise, reliable measurements
Calibration transforms inaccurate raw sensor readings into precise, reliable measurements
iotclass.org

Major section

Most Valuable Understanding (MVU)

Every real sensor has manufacturing variations that cause its readings to deviate from the true value.

  • Two-point calibration uses two known reference points to calculate correction coefficients that map inaccurate raw readings to accurate calibrated values.
  • The formula y = mx + b (from basic algebra) is the foundation - gain is the slope (m) and offset is the y-intercept (b).
Calibration transforms inaccurate raw sensor readings into precise, reliable measurements
Calibration transforms inaccurate raw sensor readings into precise, reliable measurements
iotclass.org

Major section

Introduction

In this hands-on lab, you will build a complete sensor calibration system using an ESP32 microcontroller in the Wokwi browser-based simulator.

  • You will wire a potentiometer to simulate a sensor with offset and gain errors, implement two-point calibration to correct those errors, and apply a moving average filter for noise reduction.
  • The lab takes approximately 45-60 minutes to complete and requires no physical hardware -- everything runs in your browser.
  • By the end of this lab, you will have working firmware that interactively captures reference points, calculates calibration coefficients, and applies real-time correction to sensor readings.
iotclass.org

Major section

Calibration Matters

Think of calibration like adjusting a musical instrument: Even a brand-new guitar needs to be tuned before it plays the right notes.

  • Sensors are similar - they need to be "tuned" to give accurate readings.
  • Manufacturing variations: No two sensors are exactly identical, just like no two guitars are perfectly tuned from the factory.
  • This lab teaches you how to find those correction values using two known reference points - just like tuning a guitar by comparing it to a tuner at two different notes!
  • A tuned note does not prove the sensor is accurate across its full range.
iotclass.org

Major section

Calibration Matters (continued)

Environmental factors: Temperature, humidity, and age can cause sensors to drift over time.

  • Component tolerances: The electronic parts inside sensors have slight variations.
  • The mathematical approach: Instead of just "subtract 2", calibration gives us a formula: corrected = raw × gain + offset.
  • Offset fixes constant errors (like always being 2 degrees off).
iotclass.org

Major section

Teaching Sensors Truth

Sammy always reads too high - that is an offset error (always adding a constant).

  • But notice something: at 10 degrees Sammy is off by 3, and at 25 degrees Sammy is off by 3 too.
  • That constant +3 shift is a pure offset error.
  • You could fix it by subtracting 3 from every reading.

Key terms

Many thermometers
Many thermometers are off by a few degrees!
iotclass.org

Major section

Teaching Sensors Truth (continued)

A fixed zero error is only an offset.

  • The scale can also stretch the numbers: a gain error changes with the reading, so one subtraction cannot correct both reference points.
  • Sammy says "It's 3 degrees!" Oops - that is Sammy's offset error! (0 + 3 = 3).
  • Max the Motor adds: "I need calibration too!
iotclass.org

Major section

Teaching Sensors Truth (continued)

Sammy says "It's 103 degrees!" Still 3 degrees too high - the offset is consistent! (100 + 3 = 103).

  • Lila the Light explains: "It's like being a translator!
  • When someone tells me 'go 50% speed', I might actually go 55% without calibration.
  • That could make robots bump into walls!".
iotclass.org

Major section

Folded Error And Quality Metrics Notes

Offset shifts the whole response by a constant amount, so a zero reference can be wrong even when the slope is usable.

  • Gain changes the slope, so error grows as the true value moves away from the reference point.
  • These metrics are evidence for the tested range only.
  • A two-point calibration should therefore record both reference points, the calculated slope and offset, and at least one verification point between or beyond the references.
  • If the reference points are too close together, small reference mistakes can amplify at the extremes, so span and verification evidence matter as much as the equation.
iotclass.org

Deck summary

Key takeaways

Moving Average Filter: A digital filter replacing each reading with the average of the last N samples, reducing noise at the cost of slower response to rapid changes.

  • Every real sensor has manufacturing variations that cause its readings to deviate from the true value.
  • In this hands-on lab, you will build a complete sensor calibration system using an ESP32 microcontroller in the Wokwi browser-based simulator.
  • Think of calibration like adjusting a musical instrument: Even a brand-new guitar needs to be tuned before it plays the right notes.
  • Environmental factors: Temperature, humidity, and age can cause sensors to drift over time.
iotclass.org

Retrieval practice

Recall check 1 of 5

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

Q1A raw sensor reads 10 at a true value of 0 and 90 at a true value of 100; which linear correction maps both references?

Acalibrated = raw − 10
Bcalibrated = raw + 10
Ccalibrated = 1.25 × raw − 12.5
Dcalibrated = 0.8 × raw + 10
Show answer

Answer: C The slope is 100/80 and the intercept makes raw 10 map to zero.

iotclass.org

Retrieval practice

Recall check 2 of 5

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

Q2Noisy readings fluctuate around a stable value; what does a moving average trade for smoother output?

AIt permanently removes every calibration offset from the readings.
BIt expands the sensor's physical range at the cost of extra samples.
CIt retains every short transient spike while smoothing random noise.
DIt suppresses noise but slows the response to rapid real changes.
Show answer

Answer: D Averaging several samples smooths changes over time.

Q3Why store calibrated gain and offset in non-volatile memory?

ASo the ADC gains more physical resolution
BSo the sensor never needs a reference check again
CSo the coefficients survive a device power cycle
DSo random measurement noise becomes zero
Show answer

Answer: C Non-volatile storage preserves the correction after restart.

iotclass.org

Retrieval practice

Recall check 3 of 5

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

Q4The calibration lab has both systematic error and noisy readings. Which operation specifically targets the random variation?

AApply a moving average across successive noisy measurements.
BTreat a calibration reference point as a temporal filter window.
CReplace the sensor simulation with a cleaner dashboard label.
DChange the calibration offset separately for each noisy sample.
Show answer

Answer: A The introduction assigns noise reduction to averaging and offset/gain correction to calibration.

iotclass.org

Retrieval practice

Recall check 4 of 5

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

Q5At a separate true reference of 50, a sensor reads 54 raw and 51 after calibration; how did absolute error change?

ARaw 54 to calibrated 51: the error falls by three readings.
BThe error stays four, even after the calibrated value changes.
CAbsolute error falls from four to one, an improvement of three.
DAbsolute error rises from one to four after calibration.
Show answer

Answer: C Comparing both readings with 50 shows the corrected value is closer.

iotclass.org

Retrieval practice

Recall check 5 of 5

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

Q6A thermometer reads a constant amount too hot across the tested range. Which calibration term addresses that pattern?

AAdjust the display refresh interval without changing readings.
BAdjust gain to correct a proportional error across the range.
CApply an offset to remove the constant reading shift.
DIncrease reference count without fitting a correction formula.
Show answer

Answer: C The chapter distinguishes a constant error from a gain or scaling error.

iotclass.org

Print reference

Answers

Answer key.

  1. C · The slope is 100/80 and the intercept makes raw 10 map to zero.
  2. D · Averaging several samples smooths changes over time.
  3. C · Non-volatile storage preserves the correction after restart.
  4. A · The introduction assigns noise reduction to averaging and offset/gain correction to calibration.
  5. C · Comparing both readings with 50 shows the corrected value is closer.
  6. C · The chapter distinguishes a constant error from a gain or scaling error.
iotclass.org