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
Phoebe's Field Notes: Two Different Things Both Called "Gain"
The mathematical gist.: The DHT22's catalog-typical 0.100 °C step has $\\sigma_q=0.0289$ °C RMS.
- Its 1.68 °C validation residual is about $58.2\\times$ the unrounded quantisation floor and exceeds the 0.5 °C HVAC tolerance, so rounding cannot explain the stated nonlinearity.
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 corrected formula is corrected = raw * 1.034: 1.86.
- At room temperature, a raw reading of 24.5°C becomes 23.5°C.
- Without calibration, the 1.0°C error would violate many HVAC control requirements.
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
Scenario: You are deploying 20 DHT22 sensors in a commercial greenhouse.
- Each sensor will trigger HVAC adjustments, so accuracy matters -- a 2°C error could stress plants or waste energy.
- Your reference instrument is a NIST-traceable digital thermometer accurate to +/-0.1°C.
- This exposes nonlinearity, so the sensor needs multi-point calibration or a better sensor.
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
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.
Major section
Common Calibration Pitfall
Temperature and humidity affect many sensor types beyond the one you are calibrating.
- A pressure sensor calibrated in a heated lab may behave differently at outdoor deployment temperatures.
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
The mathematical gist.: The DHT22's catalog-typical 0.100 °C step has $\\sigma_q=0.0289$ °C RMS.
- Calibration is like setting your bathroom scale to zero before weighing yourself.
- Even the best sensors have manufacturing variations.
- The corrected formula is corrected = raw * 1.034: 1.86.
- When to use: Sensor has nonlinear response that two-point calibration cannot correct (as demonstrated in the worked example below).
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 (should be 0°C) and 98.5°C in boiling water (should be 100°C). What type of calibration is needed?
Show answer
Answer: A
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.
Q4Place each calibration step where it lives so you can prove a fitted correction works beyond the points used to create it.
Show answer
Answer: A Place each calibration step where it lives so you can prove a fitted correction works beyond the points used to create it.
Print reference
Answers
Answer key.
- A · A constant error at all temperatures indicates pure offset (bias) error.
- A
- C · Non-volatile memory retains data when power is removed.
- A · Place each calibration step where it lives so you can prove a fitted correction works beyond the points used to create it.