Learn / Sensors and actuators / Sensor basics

Interpreting Sensor Data

ReviewedBeginnerFreeAbout 5 min
BME280
In short

Interpreting Sensor Data: the short answer

Sensors have uncertainty, response time, calibration needs and environmental operating conditions. A reading is not inherently a certified measurement. Example: Self-heating from the board added about 4 °C. Keep sensors away from regulators and microcontrollers, then compare against a reference.

Level
Beginner
Time
About 5 min
Topic
Sensors and actuators
You will learn to

Judge whether a sensor reading is believable and spot the common reasons it is not.

Before this: Sensor Interfaces

Sensors have uncertainty, response time, calibration needs and environmental operating conditions. A reading is not inherently a certified measurement.

A measurement has units, sample timestamp, range, uncertainty and environmental conditions. Filtering reduces noise under some circumstances but does not remove a faulty calibration or wrong sensor type.

Take a series of readings at a stable reference condition. Compare median and spread, note drift and detect missing/error values instead of interpreting them as true zeros.

Accuracy, precision and resolution are different

Resolution is the smallest change the sensor or ADC can report. Precision is how closely repeated readings agree with each other. Accuracy is how close they are to the true value. A DHT22 may report temperature to 0.1 °C (resolution) while being accurate only to ±0.5 °C. A cheap sensor can be very repeatable and consistently wrong, and a calibration offset fixes that kind of error.

Read the datasheet's accuracy line and its test conditions. The headline number is often for a narrow range, such as 0 to 50 °C, and gets worse outside it.

Noise, drift and response time

Noise is the jitter between samples; averaging or a median filter reduces it. Drift is a slow, steady shift over hours or months, caused by ageing or temperature, and averaging doesn't remove it. Response time is how long the sensor takes to follow a change: a DS18B20 in a metal probe takes tens of seconds to settle, a bare BME280 only a second or two.

A reading taken before the sensor has caught up is not wrong, it is simply old. Wait long enough between a change and a measurement, and say how long you waited.

Believable or not: a short checklist

Is it inside the physical range (a room at 85 °C or humidity at 120 % is a fault, not a reading)? Does it agree with a second instrument at one reference point? Does it change plausibly when you change the world, for example does the temperature rise when you hold the sensor in your hand? Are readings that read exactly 0, −127 or 255 really sensor error codes?

Treat error values as missing data. The DS18B20 returns −127 °C when it can't be read and a DHT library returns NaN on a failed read. If you log those as numbers, your average and your chart are wrong.

Environment changes the reading

Board heat is the commonest culprit: a sensor next to a regulator or the ESP32 reads several degrees high. Sunlight on a sensor case, a draught, condensation, and a supply that sags during a Wi-Fi burst can all move the number. A gas or air-quality sensor often needs minutes or hours of warm-up before its output means anything.

Record the conditions with the data: supply voltage, location, time, and what else was running. Then a strange value can be explained instead of argued about.

Calibrate with two points

Measure the sensor at two known conditions, for example in ice water (0 °C) and at room temperature next to a trusted thermometer. Fit a straight line through the two pairs to get an offset and a gain, and apply it in code. One point can fix an offset; two can fix offset and slope.

Common mistakes
  • Logging the error value as if it were a measurement.
  • Placing a temperature sensor on the board itself and trusting its value.
  • Believing a number because it has three decimal places.
Worked example

Is the room really 31 °C?

  1. The sensor says 31.4 °C; a room thermometer says 27 °C.
  2. The sensor sits right above the ESP32, which runs warm.
  3. Move it 5 cm away on a short cable and wait 10 minutes.
  4. It now reads 27.6 °C.

Result. Self-heating from the board added about 4 °C. Keep sensors away from regulators and microcontrollers, then compare against a reference.

Try it

List three reasons a temperature sensor could give an unexpected value.

Check yourself

3 quick questions

  1. Averaging ten readings removes…

  2. A sensor returns -999 when it fails. What should a logger do?

  3. Why might a temperature sensor read high on a breadboard?

Common questions

What will I learn in "Interpreting Sensor Data"?

Judge whether a sensor reading is believable and spot the common reasons it is not.

Is the room really 31 °C?

The sensor says 31.4 °C; a room thermometer says 27 °C. The sensor sits right above the ESP32, which runs warm. Move it 5 cm away on a short cable and wait 10 minutes. It now reads 27.6 °C. Self-heating from the board added about 4 °C. Keep sensors away from regulators and microcontrollers, then compare against a reference.

Averaging ten readings removes…

Random noise. Averaging smooths noise but a fixed offset stays in every reading.

A sensor returns -999 when it fails. What should a logger do?

Store it as missing or error. Error codes are not measurements; keep them separate.

Why might a temperature sensor read high on a breadboard?

Heat from nearby chips and regulators. Self-heating and nearby warm parts are the most common cause.