Sensors & Measurement · Study deck
Sensor Calibration Techniques
Calibration is the moment a sensor reading becomes accountable.
Physics Phoebe is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- Justify why sensor calibration is necessary for production IoT systems and identify which error type each technique corrects
- Execute one-point and two-point calibration procedures using reference standards
- Implement calibration routines in MicroPython on ESP32 and store coefficients in non-volatile memory
- Design a calibration maintenance schedule for deployed sensors based on sensor type and environment
Major section
Start With the Measurement Story
Calibration is the moment a sensor reading becomes accountable.
- The next shows that its plotted readings can sit off the reference line.
- The third compares the probe with the reference again; the last shows a corrected line kept inside a checked band.
- A clean line is evidence only for the conditions actually tested.
Major section
In 60 Seconds · Two Different Things Both Called "Gain"
The correction slope and converter step size describe different limits; independent validation rejects this fit.
- Calibration scale changes the raw-to-corrected slope.
- Converter step size changes displayed granularity.
- Independent validation misses by 1.68 °C; the allowed error is 0.5 °C.
- Decision: the two-point fit fails.
Major section
Key Concepts
Calibration: the process of comparing a sensor's output against a known reference standard and applying correction factors to make readings accurate.
- Gain (Scale) Error: a proportional error where the sensor's reading diverges from truth at a rate proportional to the measured value; requires at least two reference points to correct.
Major section
For Beginners: Sensor Calibration
Calibration is like setting your bathroom scale to zero before weighing yourself.
- Every sensor has small manufacturing differences, so two identical temperature sensors might give slightly different readings in the same room.
- Calibration corrects these differences by comparing the sensor's reading against a known reference value and applying a simple correction formula to get accurate results.
Major section
Every Sensor Needs Calibration
Even the best sensors have manufacturing variations.
- Two DHT22 sensors from the same batch might read 0.5°C apart when measuring the same temperature.
- Production spread can make devices from the same run disagree.
- Different sensing principles can respond differently under similar conditions.
Major section
Putting Numbers to It
The two reference points set a line, while a separate point tests its validity.
- The raw reading maps through the fitted scale and offset.
- The two fit references do not prove the middle of the range.
- Validate at an independent reference point.
24.5 °C raw → about 23.5 °C corrected
Major section
Multi-Point Calibration
When to use: Sensor has nonlinear response that two-point calibration cannot correct (as demonstrated in the worked example below).
- The following example uses NumPy for polynomial fitting.
- On resource-constrained microcontrollers, compute the coefficients on a PC and hard-code them, or use a simple lookup table with linear interpolation between points.
Major section
Polynomial Calibration Explorer
Enter 3--5 calibration points (reference vs raw) and see how a quadratic polynomial fits the data.
- Adjust individual points to observe how nonlinearity affects the correction curve.
Major section
Calibration Schedule Guidelines
Humidity and gas sensors receive shorter default intervals because high-humidity exposure and contamination can alter their sensing films or chemistry.
- A pH probe is checked before each use because storage state and electrode condition directly affect the next measurement, while a load cell's annual interval is immediately overridden by an overload event.
Major section
ESP32 Two-Point Calibration
The reference uncertainty and application range bound the chosen calibration points.
- The reference thermometer is accurate to ±0.1 °C.
- The greenhouse operating range is 0–50 °C.
- Use a high reference near 45 °C and validate at a separate point.
High reference near 45 °C; greenhouse range 0–50 °C.
Major section
Try It: Calibration Validation Checker
Enter your calibration coefficients and a validation measurement to determine if your calibration is adequate or if you need a different approach.
- This makes deployed readings auditable and repeatable.
Major section
Lesson from This Example · Common Calibration Pitfall
The validation step (Step 4) caught a problem that two-point calibration alone would have missed.
- In production, always validate against a reference point that was NOT used for calibration.
- Temperature and humidity affect many sensor types beyond the one you are calibrating.
Major section
For Kids: Meet the Sensor Squad!
Temperature Terry was feeling embarrassed. "I keep saying it is 2.3 degrees when it should be zero!" he told the Squad while sitting in a bowl of ice water.
- "Do not worry, Sammy!" said the microcontroller. "That is totally normal.
- Every sensor is a little bit different from the factory.
Major section
For Kids: Meet the Sensor Squad! (continued)
We just need to calibrate you!".
- Max explained: "We dip Sammy in ice water -- we KNOW that is 0 degrees.
- "And ALWAYS use a reference that is MORE accurate than the sensor you are calibrating," Max added. "Otherwise, it is like asking someone who is MORE lost for directions!".
- In six months, we do it again because sensors can drift over time -- like a clock that slowly gets behind.".
Major section
Calibration Decision Guide
Low-risk, easily reached equipment may justify a quick one-point correction when validation shows only offset.
- The result should be the smallest method that passes independent validation, not automatically the most elaborate curve available.
Major section
Try It Yourself
Beginner: You have a DHT22 that reads 23.8°C while your reference thermometer reads 22.0°C.
- Advanced: An MQ-135 gas sensor gives these readings at known CO₂ concentrations: (400 ppm, raw=120), (800 ppm, raw=280), (1200 ppm, raw=390), (1600 ppm, raw=460), (2000 ppm, raw=505).
Major section
Common Pitfalls
Calibrating a sensor against a reference that has not been verified against a primary standard propagates the reference's error into the calibrated sensor.
- A one-point offset calibration at 25 C assumes the offset is constant across the sensor's range.
- Many sensors have temperature-dependent offset.
- Linearity errors are not visible at calibration endpoints.
Deck summary
Key takeaways
Calibration is the moment a sensor reading becomes accountable.
- Sensor calibration compares readings with known references and can correct modeled offset and scale errors.
- Calibration: the process of comparing a sensor's output against a known reference standard and applying correction factors to make readings accurate.
- Calibration is like setting your bathroom scale to zero before weighing yourself.
- Even the best sensors have manufacturing variations.
Retrieval practice
Recall check 1 of 2

Physics Phoebe says: answer from memory, then check your reasoning.
Q1Your sensor always reads 2.3°C too high at any temperature. What calibration do you need?
Show answer
Answer: A A constant error at all temperatures indicates pure offset (bias) error.
Q2A temperature sensor reads 2.3°C in ice water (reference 0°C) and 98.5°C in boiling water (reference 100°C). The application requires ±0.5°C accuracy at both references. What calibration is needed?
Show answer
Answer: A see answers page
Retrieval practice
Recall check 2 of 2

Physics Phoebe says: answer from memory, then check your reasoning.
Q3Why should calibration coefficients be stored in non-volatile memory (EEPROM/flash)?
Show answer
Answer: C Non-volatile memory retains data when power is removed.
Q4What pairs each raw calibration reading with a known reference across the intended range?
Show answer
Answer: A Measurement pairs bind each raw reading to a known reference across the intended range.
Print reference
Answers
Answer key.
- A · A constant error at all temperatures indicates pure offset (bias) error.
- A · The sensor has both an offset error (reads 2.3 instead of 0 at the low end) and a gain error (the span is 96.2 degrees instead of 100). One-point calibration only fixes offset; two-point calibration fixes both by calculating scale = (100-0)/(98.5-2.3) = 100/96.2 = 1.0395 and offset = 0 - 2.3 × 1.0395 = -2.39.
- C · Non-volatile memory retains data when power is removed.
- A · Measurement pairs bind each raw reading to a known reference across the intended range.