Sensors & Measurement · Study deck
Sensor Processing: Sampling and Signals
A clean chart can hide aliasing, clipping, or lost detail.
Physics Phoebe is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- Implement and compare moving average, Kalman, and median filters to reduce sensor noise
- Execute two-point calibration procedures to correct sensor offset and gain errors
- Design data validation pipelines that detect anomalies and reject outliers
- Select and justify appropriate filtering strategies based on signal characteristics and resource constraints
Major section
Start With the Measurement Story
Bandwidth is the range of change a signal or link can carry.
- Smoothing may hide the jump, but it may also hide a real door-open event.
- No filter can recover facts that were never measured.
- A reading becomes information only after noise, drift, outliers, scaling, and timing are handled.
Major section
Phoebe's Field Notes: Where Vibration Nyquist Meets the Sensor's Own Step Size
The mathematical gist: The chapter's 100 Hz ADXL345 stream has a 50 Hz Nyquist ceiling: higher vibration components fold to false lower frequencies before a median or moving-average filter can see them.
- Choosing the right filter depends on your signal characteristics and noise type.

Major section
Phoebe's Field Notes: Where Vibration Nyquist Meets the Sensor's Own Step Size (continued)
For most beginner IoT projects, do not start with Kalman.
- The order shows why noise reduction cannot repair bias and why calibrated values still require invalid-sample handling.
- The moving average filter is the simplest and most common approach.
- ESP32's floating-point unit makes Kalman practical.
Major section
Phoebe's Field Notes: Where Vibration Nyquist Meets the Sensor's Own Step Size (continued)
When sensor data has occasional spike errors (outliers), a median filter is more effective than averaging.
- For a beginner, the behavior matters more than the implementation: a larger window gives a smoother line but reacts more slowly.
- The Kalman filter provides optimal noise reduction for linear systems with Gaussian noise by modeling the system dynamics.
- The median instead rejects an isolated outlier while preserving the surrounding level.
Major section
Phoebe's Field Notes: Where Vibration Nyquist Meets the Sensor's Own Step Size (continued)
It adapts based on measurement uncertainty and process noise. (For non-linear sensors such as thermistors or pH electrodes, Extended or Unscented Kalman Filters are needed instead.).
- A single bad spike is ignored instead of being averaged into future readings.
- Kalman filter response varies based on Q and R parameters and is explored in the interactive calculator below.
- The moving average spreads a spike across its window, so several later samples remain displaced after the raw event has passed.
- Kalman requires knowing process noise (Q) and measurement noise (R) -- wrong values degrade performance.
Major section
Phoebe's Field Notes: Where Vibration Nyquist Meets the Sensor's Own Step Size (continued)
That difference connects the expected noise shape to filter choice: use averaging for distributed random variation, but prefer a median when occasional impulses would contaminate a windowed mean.
- The EMA is the most memory-efficient filter -- it requires only a single float (4 bytes) of state.
- Unlike a moving average that weights all N samples equally, the EMA gives exponentially decreasing weight to older samples.
- The smoothing factor alpha (0 to 1) controls responsiveness: lower alpha means smoother output but slower response.
Major section
Phoebe's Field Notes: Where Vibration Nyquist Meets the Sensor's Own Step Size (continued)
Option B: Kalman Filter (1D): A compact state estimate with adaptive gain and Q/R tuning; memory, CPU time, delay, and noise reduction depend on the implementation and signal.
- Decision Factors: For stationary signals with Gaussian noise (temperature averaging), moving average is simpler and nearly as effective.
- For tracking changing signals (position, velocity, acceleration) where latency matters, Kalman filters provide faster response with better noise rejection.
- For resource-constrained 8-bit MCUs (ATmega328), moving average's integer-only math saves flash and runs faster.
Deck summary
Key takeaways
Bandwidth is the range of change a signal or link can carry.
- The mathematical gist: The chapter's 100 Hz ADXL345 stream has a 50 Hz Nyquist ceiling: higher vibration components fold to false lower frequencies before a median or moving-average filter can see them.
- For most beginner IoT projects, do not start with Kalman.
- When sensor data has occasional spike errors (outliers), a median filter is more effective than averaging.
- It adapts based on measurement uncertainty and process noise. (For non-linear sensors such as thermistors or pH electrodes, Extended or Unscented Kalman Filters are needed instead.).
Retrieval practice
Recall check 1 of 3

Physics Phoebe says: answer from memory, then check your reasoning.
Q1A sensor stream has rare impossible spikes and ordinary jitter. Which pipeline keeps a spike from tainting later decisions?
Show answer
Answer: B Correct: validation before smoothing prevents a bad value spreading through the window.
Retrieval practice
Recall check 2 of 3

Physics Phoebe says: answer from memory, then check your reasoning.
Q2A sensor is calibrated in the lab, then loses power in the field. What should firmware do at startup?
Show answer
Answer: C Correct: persistent coefficients let the corrected measurement survive a restart.
Retrieval practice
Recall check 3 of 3

Physics Phoebe says: answer from memory, then check your reasoning.
Q3What is the main purpose of sensor data processing before data is used for decisions?
Show answer
Answer: A Processing should improve interpretability for a use case while keeping measurement assumptions visible.
Print reference
Answers
Answer key.
- B · Correct: validation before smoothing prevents a bad value spreading through the window.
- C · Correct: persistent coefficients let the corrected measurement survive a restart.
- A · Processing should improve interpretability for a use case while keeping measurement assumptions visible.