Sensors & Measurement · Study deck

Sensor Processing: Filter Selection and Validation

A vibration filter can remove noise and erase the fault at the same time.

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:

  • Select a vibration filter from spectral evidence.
  • Validate filter output against timing and amplitude requirements.
  • Explain: Scenario: A food processing plant needs to monitor vibration on 12 conveyor belt motors.
  • Explain: Filtering removes random noise, but it cannot fix systematic errors built into the sensor itself.
iotclass.org

Major section

Vibration Filter Selection

Scenario: A food processing plant needs to monitor vibration on 12 conveyor belt motors.

  • A 50-feature moving average spans 0.5 seconds if one feature arrives per sample.
  • Result: A 50-feature window fills in 0.5 seconds at 100 features/s, but detection latency also depends on the RMS feature window, threshold, overlap, and fault waveform.
  • False-alarm and missed-detection rates require a labeled validation set; the filter choice alone cannot establish them.
iotclass.org

Major section

Sensor Calibration

Filtering removes random noise, but it cannot fix systematic errors built into the sensor itself.

  • A sensor that consistently reads 2 degrees too high will still read 2 degrees too high after filtering -- just with less jitter.
  • You have cleaned random variation.
  • The next failure mode is bias: a value can be stable and still be wrong.

Why it matters

The process needs two separated known values because one point cannot distinguish slope error from offset.

Sensor measurement error types
Sensor measurement error types
iotclass.org

Major section

Sensor Calibration (continued)

The process needs two separated known values because one point cannot distinguish slope error from offset.

  • Each error leaves a different pattern, so one calibration or filter cannot repair them all.
  • To see how both systematic terms can be estimated, inspect Figure: Two-point calibration process before using the formula.
  • This sequence connects calibration arithmetic to evidence that the corrected line works between its endpoints.
Two-point calibration process
Two-point calibration process
iotclass.org

Major section

Soil Moisture Calibration

Scenario: You are deploying a soil moisture monitoring system for a greenhouse.

  • The capacitive soil moisture sensor outputs an analog voltage (0-3.3V) that varies with soil moisture content.
  • However, the raw ADC readings do not correspond to meaningful gravimetric water-content percentages.
  • You need accurate readings to trigger irrigation at 30% gravimetric water content.
iotclass.org

Major section

Soil Moisture Calibration (continued)

Goal: Develop and implement a two-point calibration procedure to convert raw ADC readings into gravimetric water-content percentages (0-60% over the two measured reference points; extrapolated values need validation).

  • The data points fall closely on the linear model, confirming this sensor has good linearity in the 0-60% gravimetric water-content range.
  • For readings beyond 60%, the linear model extrapolates but accuracy degrades -- use multi-point calibration if a wider gravimetric water-content range is needed.
  • From 40–60%, the ±2.5% result is still accepted for this use, but it should not be silently generalised beyond the highest calibration reference.
iotclass.org

Major section

Soil Moisture Calibration (continued)

The dry-to-trigger region is the important operating span, so the ±1.5% and ±2.0% errors support a 30% irrigation threshold with more margin than the wetter end.

  • The final row makes that limit explicit: values above 60% are extrapolated and exceed 5% typical error, so saturated-soil decisions require additional reference points.
  • Preserve the fitted gain and offset with the raw reference pairs, repeated-measurement spread, validation date, and installed probe condition.
  • The maintenance schedule then reopens this result after soil chemistry, probe placement, electronics, or seasonal conditions change, carrying the worked calibration into an operational measurement record.
iotclass.org

Major section

Common Processing Pitfalls

The Mistake: Using a large moving average window (N=32 or N=64 samples) to filter sensor data that changes rapidly, introducing unacceptable lag that makes control systems sluggish or miss transient events entirely.

  • For slowly-changing signals (room temperature sampled at 1Hz), a 10-second window works well.
  • This works for sensors with linear response and negligible gain error.
  • But many sensors are inherently non-linear: thermistors follow the Steinhart-Hart equation (exponential), pH electrodes have temperature-dependent Nernst slope, photodiodes have logarithmic response at high intensity.
iotclass.org

Major section

Common Pitfalls

A moving average window that is too large smooths out genuine rapid changes in the measured quantity.

  • A temperature spike from a briefly opened oven door may be a real event, not noise.
  • Size the filter window to be shorter than the fastest legitimate change you need to detect.
  • The reference contributes uncertainty to every calibration result; a calibrated sensor cannot be more accurate than its reference.
  • Flashing new firmware can erase EEPROM calibration data depending on memory layout.
iotclass.org

Deck summary

Key takeaways

Scenario: A food processing plant needs to monitor vibration on 12 conveyor belt motors.

  • Filtering removes random noise, but it cannot fix systematic errors built into the sensor itself.
  • The process needs two separated known values because one point cannot distinguish slope error from offset.
  • Scenario: You are deploying a soil moisture monitoring system for a greenhouse.
  • Goal: Develop and implement a two-point calibration procedure to convert raw ADC readings into gravimetric water-content percentages (0-60% over the two measured reference points; extrapolated values need validation).
iotclass.org

Retrieval practice

Recall check 1 of 5

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

Q1A vibration trace has isolated electrical spikes and short impacts that may be real faults. Which filter review is safest?

AApply a long average and dismiss every short impact as electrical noise.
BCompare fault and interference recordings for peaks, delay and missed impacts.
CUse a median filter because smoothing preserves short impact events while removing noise spikes.
DChoose the smoothest chart because low visual noise identifies the best impact detector.
Show answer

Answer: B Filter choice must preserve fault amplitude and timing while rejecting measured interference.

iotclass.org

Retrieval practice

Recall check 2 of 5

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

Q2Your temperature sensor reads 1.2C in an ice bath (should be 0C) and 98.8C in boiling water (should be 100C). What is the calibration slope?

ASlope 1.025, scaling the 97.6°C measured span to 100°C.
BSlope 0.976, from shrinking the measured span of 97.6°C.
CSlope 1.000, treating both endpoint errors as irrelevant.
DSlope 1.200, using the ice-point offset as the slope.
Show answer

Answer: A see answers page

iotclass.org

Retrieval practice

Recall check 3 of 5

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

Q3What is the main advantage of a Kalman filter over a simple moving average filter?

AUses less memory and CPU cycles
BAdapts to measurement uncertainty.
CEasier to implement and tune
DWorks without any tuning parameters
Show answer

Answer: B The Kalman filter adapts dynamically based on measurement uncertainty and process noise, providing optimal estimates for linear systems with Gaussian noise.

iotclass.org

Retrieval practice

Recall check 4 of 5

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

Q4For a moving average filter with window size N=10 sampling at 100Hz, what is the approximate latency introduced?

AAbout 45 ms, from 4.5 samples of group delay at 100 Hz.
BAbout 10 ms, counting just one sample interval of delay.
CAbout 100 ms, counting the full ten-sample window as delay.
DNo latency because averaging can be completed between consecutive sample arrivals.
Show answer

Answer: A For N=10 at 100 Hz, steady-state group delay is (N−1)/2 = 4.5 samples × 10 ms = 45 ms, approximately 50 ms. First-full-window startup is a separate issue.

iotclass.org

Retrieval practice

Recall check 5 of 5

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

Q5Which calibration approach should you use for a non-linear sensor like a thermistor?

AOne room-temperature point, leaving nonlinear response unmodeled.
BTwo endpoints at 0 °C and 100 °C with a straight correction line.
CMultiple points in a lookup table or a Steinhart-Hart model.
DNo calibration because every thermistor is factory-exact.
Show answer

Answer: C Thermistors are inherently non-linear, following the Steinhart-Hart equation (exponential relationship between resistance and temperature).

Q6Complete the moving average filter for sensor data:

Awindow = deque(maxlen=10)
Bwindow = list(10)
Cwindow = deque(size=10)
Dwindow = array(10)
Show answer

Answer: A A deque with maxlen automatically drops old values when full, creating a sliding window.

iotclass.org

Print reference

Answers 1 of 2

Answer key.

  1. B · Filter choice must preserve fault amplitude and timing while rejecting measured interference.
  2. A · The calibration slope = (actual_high - actual_low) / (raw_high - raw_low) = (100 - 0) / (98.8 - 1.2) = 100 / 97.6 = 1.025. The sensor under-reads by 2.4%, so the slope correction is slightly above 1.0. The offset b = 0 - (1.025 x 1.2) = -1.23.
  3. B · The Kalman filter adapts dynamically based on measurement uncertainty and process noise, providing optimal estimates for linear systems with Gaussian noise.
iotclass.org

Print reference

Answers 2 of 2

Answer key.

  1. A · For N=10 at 100 Hz, steady-state group delay is (N−1)/2 = 4.5 samples × 10 ms = 45 ms, approximately 50 ms. First-full-window startup is a separate issue.
  2. C · Thermistors are inherently non-linear, following the Steinhart-Hart equation (exponential relationship between resistance and temperature).
  3. A · A deque with maxlen automatically drops old values when full, creating a sliding window.
iotclass.org