Unit 08 · lesson
Calibration, Noise, and Sampling
A sensor value can be repeatable and still be wrong.
Calibration connects sensor output to a known reference.
Offset and scale
Suppose a distance sensor reports:
| Known distance | Sensor reading |
|---|---|
| 0.20 m | 0.23 m |
| 0.50 m | 0.54 m |
| 1.00 m | 1.05 m |
The sensor appears to read slightly high. You might investigate an offset, scaling effect, mounting geometry, or environmental condition.
Do not "fix" the number until you understand the pattern.
Noise
Noise causes measurements to vary.
A stationary sensor might produce:
51.2, 50.8, 51.5, 50.9, 51.1
A simple average can reduce random variation:
mean ≈ 51.1
But averaging also adds delay. If the robot moves quickly, an old average can be less useful than a noisier recent sample.
Filtering is a tradeoff between smoothness and responsiveness.
Sampling rate
A sensor read ten times per second observes a changing system differently from one sampled one thousand times per second.
If the event you care about happens faster than the sampling process can represent, important behavior can disappear between readings.
More samples are not always better either. Higher rates create more data, computation, bus traffic, and sometimes more noise.
Bias versus noise
- noise varies around a value;
- bias shifts measurements consistently.
Averaging reduces random noise. It does not remove a consistent bias.
Run a small data test
Use either real, supplied, or invented-but-clearly-labeled sensor data.
Record at least ten samples under one fixed condition.
Calculate:
- minimum;
- maximum;
- average;
- range.
Then change one condition and repeat.
Your conclusion should name the condition and evidence:
Under brighter light, the measurement spread increased from ___ to ___.
That is a sensor claim you can defend.
Sampling can hide motion
A sensor does not observe the world continuously. Software receives samples.
If a wheel rotates quickly while a slow sensor is sampled only occasionally, the recorded values can miss important behavior. A vibration can appear smaller, slower, or even like a different pattern than the physical motion.
This is not just a camera problem. Encoders, current sensors, IMUs, microphones, and control loops all have timing limits.
Inspect a simple sample sequence
A rotating mechanism changes rapidly:
real event: + - + - + - + -
samples: ^ ^ ^
The software sees only what exists at the sample instants.
A higher sample rate is not automatically better. More samples require processing, storage, bandwidth, and sometimes amplify high-frequency noise. The correct rate depends on what behavior must be observed or controlled.
Calibration needs a reference
A calibration equation such as:
distance_cm = 1.04 × raw_value - 2.1
is meaningful only if it came from comparison against known reference distances.
Store the calibration evidence with the equation:
- reference values used;
- measured raw values;
- fitted relationship;
- tested range;
- conditions where the relationship failed.
A calibration constant without its test boundary becomes folklore surprisingly fast.