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.

sensordataprocessing
Physics Phoebe, the module guide, in a scene from this chapter.
iotclass.org

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
iotclass.org

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.

Why it matters

They show which fault each method can reduce and which limit must remain visible.

iotclass.org

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.

Key terms

Higher Q/R ratio
Higher Q/R ratio means the filter trusts measurements more; lower ratio means it trusts its own predictions more.

Numbers to remember

0.00113 gIts 3.9 mg/LSB step has a 0.00113 g RMS quantisation floor
Sensor data processing pipeline from raw readings to calibrated output
Sensor data processing pipeline from raw readings to calibrated output
iotclass.org

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.
iotclass.org

Major section

Phoebe's Field Notes: Where Vibration Nyquist Meets the Sensor's Own Step Size (continued)

A single bad spike is ignored instead of being averaged into future readings.

  • 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.
  • Kalman requires knowing process noise (Q) and measurement noise (R) -- wrong values degrade performance.
iotclass.org

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.).

  • When sensor data has occasional spike errors (outliers), a median filter is more effective than averaging.
  • 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, while the median rejects an isolated outlier, connecting signal shape to filter choice.
iotclass.org

Major section

Phoebe's Field Notes: Where Vibration Nyquist Meets the Sensor's Own Step Size (continued)

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.
  • 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.
iotclass.org

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.
  • A single bad spike is ignored instead of being averaged into future readings.
  • 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.).
iotclass.org

Retrieval practice

Recall check

Physics Phoebe says: answer from memory, then check your reasoning.

Q1What is the main purpose of sensor data processing before data is used for decisions?

ASmooth the signal for a steadier display
BPreserve raw values for later reanalysis
CProcess data without preserving the assumptions or limits of the measurement
DApply processing that preserves measurement meaning.
Show answer

Answer: D Processing should improve interpretability for a use case while keeping measurement assumptions visible.

iotclass.org

Print reference

Answers

Answer key.

  1. D · Processing should improve interpretability for a use case while keeping measurement assumptions visible.
iotclass.org