25 Lab: Signal Processing
Run Evidence-First Sampling, Filtering, and Validation Exercises
25.1 In 60 Seconds
Signal-processing labs should prove that a sampled signal still represents the physical event. Capture a raw trace first, then vary one decision at a time: sample rate, ADC range, bit depth, filter type, frequency analysis, and downsampling. The output of each lab is a short evidence record that names what changed, what was preserved, what was removed, and what must be validated before the pipeline is reused.
25.2 Start With the Story
Start with a physical signal that is noisy, delayed, sampled, quantized, calibrated, filtered, packed, and finally sent as a number someone will trust. The core idea in Lab: Signal Processing is simple: signal processing is the bridge between the physical world and digital evidence, so every sampling, ADC, filter, and calibration choice changes the value that leaves the device. This page focuses that idea on Platform-neutral signal-processing lab for capturing raw traces, testing sample-rate and ADC-resolution choices, comparing filters. In everyday IoT, temperature drift, vibration spikes, audio snippets, and lab traces all become decisions only after their limits and uncertainty are made visible. Start simple: trace one measurement through the chain, keep the raw-to-processed evidence, and move advanced math into the deeper review only when the simple chain no longer explains the result.
25.3 Learning Objectives
By the end of this lab chapter, you should be able to:
- Capture a raw sensor trace and preserve enough metadata to repeat the test.
- Compare sample-rate choices without confusing aliasing with real behavior.
- Fit ADC resolution to useful signal span, noise, and reference range.
- Compare median, moving-average, low-pass, notch, and high-pass filters by failure pattern.
- Use frequency-domain evidence carefully, with sample-rate and window choices recorded.
- Build a multi-stage pipeline and document what each stage removes or delays.
Quick Check: Lab
25.4 How It Works: Run a Signal Lab Without Hiding Evidence
The labs follow a repeatable evidence loop.
- Capture raw data first. Save units, timestamps, sample interval, sensor setup, and expected event timing before changing the stream.
- Change one decision. Adjust only sample rate, ADC range, bit depth, or filter choice so the result has a traceable cause.
- Compare against the requirement. Decide whether the changed stream still preserves the event, threshold, or trend the product needs.
- Write the release note. Record what the pipeline removes, what it delays, and what should trigger a retest.
25.5 Incremental Examples
Beginner Example: Compare raw and moving-average temperature data. The average may reduce jitter, but the lab record must note the delay it introduces.
Intermediate Example: Test two sample rates for a vibration trace. If the apparent pattern changes, keep the raw traces and review aliasing before choosing a filter.
Advanced Example: Build a staged pipeline for an acoustic event: anti-alias filter, sample-rate choice, windowed frequency review, and a validation check against missed events.
25.6 Concept Check: One Variable
Why should the lab avoid changing sample rate and filter type at the same time?
Answer: changing both hides the cause. A cleaner output could come from better sampling, stronger smoothing, or accidental loss of useful evidence.
25.7 Concept Check: Raw Trace Value
What should you do before accepting a processed trace as release evidence?
Answer: compare it with the raw trace and the original requirement, then record what was preserved, removed, or delayed.
25.8 Try It Yourself
Design a five-row lab table with columns for raw evidence, one changed decision, before/after observation, risk introduced, and release decision. Fill it for a sensor or dataset you can inspect.
25.9 See Also
- Signal Processing Essentials - explains the analog-to-digital path the labs exercise.
- ADC Sampling Fundamentals - helps interpret sample-rate and anti-aliasing failures.
- Quantization and Digital Filtering - supports filter selection and ADC fit checks.
25.10 Lab Workflow
Run the labs as small experiments. Do not change the sensor, sample rate, reference range, and filter all at once.
25.10.1 Start With Raw Evidence
Save an unfiltered trace with timestamp spacing, units, expected event timing, reference range, and any known environmental conditions.
25.10.2 Change One Decision
Vary only sample rate, bit depth, reference range, or filter choice. A lab that changes multiple decisions cannot explain the result.
25.10.3 Compare Before and After
Keep the raw trace beside the processed trace. Record latency, missed events, rejected spikes, and any information the processing could hide.
25.10.4 Validate the Pipeline
Test with a known event or reference trace before treating the processed stream as trustworthy.
25.11 Lab Sequence
Use the following sequence as a workbook. Each exercise has a decision, an observation, and a record.
25.12 Exercise 1: Raw Trace and Timing Record
Capture a short trace from the sensor or signal source before applying any digital processing.
Minimum record:
- physical quantity and units
- expected range and useful signal span
- sample interval and timestamp source
- reference range or gain setting
- known event timing or stimulus
- raw trace storage location
If the raw trace is not saved, there is no way to prove that a later filter preserved the event instead of hiding it. Raw evidence is the baseline for every later lab.
25.13 Exercise 2: Sample-Rate Review
Use a known event or controlled signal and repeat the capture at several sample rates. The goal is not to find the fastest setting; the goal is to find the lowest rate that preserves the needed timing evidence with margin.
Review prompts:
- Does the apparent frequency change when the sample rate changes?
- Does a short event disappear at a lower rate?
- Is the analog front end limiting content before the ADC?
- Is the selected rate justified by useful bandwidth rather than convenience?
When a pattern moves with sample rate, suspect aliasing and return to ADC Sampling Fundamentals before choosing a filter.
25.14 Exercise 3: ADC Resolution Fit
Measure whether the chosen reference range and bit depth are meaningful for the useful signal span. More bits help only if the analog evidence supports them.
Run it: Put your numbers into the formula calculator below before you judge the fit. Enter the reference range and bit depth to get the ADC code step, then compare that step against your required change size and noise estimate. Sweep the bit depth and watch where extra bits stop shrinking the code step below your noise floor – that is the point the practical fit rule warns about – and record whether the resolution is too coarse, useful, or overspecified.
Use this record:
- reference range
- expected useful signal span
- required physical change size
- code step
- noise estimate in codes or physical units
- decision: too coarse, useful, or overspecified
The code step should be smaller than the required change size, but extra bit depth stops helping when analog noise, reference drift, or sensor uncertainty is larger than the code step.
25.15 Exercise 4: Filter Comparison
Run every candidate filter against the same raw trace. A filter should be chosen because it matches the observed failure pattern.
Run it: Run all four filters against one signal in the workbench below instead of arguing about them on paper. Load a sampled trace with spikes, jitter, and a drift or tone, then switch between median, moving average, low-pass, and notch and watch each one help one failure pattern while damaging another – staircasing, smeared spikes, missed fast events, or removed signal. Match the filter to the failure pattern you actually see, and note the window delay or lag it costs.
25.15.1 Median
Best for isolated spikes. Watch for staircase behavior and window delay.
25.15.2 Moving Average
Best for random jitter when lag is acceptable. Watch for smeared spikes and delayed edges.
25.15.3 Low-Pass
Best when useful content is slower than unwanted noise. Watch for missed fast events.
25.15.4 Notch or High-Pass
Best for a known interference tone or slow baseline drift. Watch for removed legitimate signal content.
25.16 Exercise 5: Frequency Evidence
Frequency analysis is useful only when sample rate, record length, and windowing choices are part of the record.
Before accepting a spectral peak:
- Confirm the sample rate is above the useful frequency range with room for the analog filter boundary.
- Confirm the record length gives enough frequency resolution for the question.
- Compare the peak with known physical events or a reference capture.
- Change the sample rate as a diagnostic test if the peak seems suspicious.
- Record the windowing or binning method if spectral leakage matters.
25.17 Exercise 6: Pipeline Review
Build the pipeline only after the individual stages have evidence. A common order is analog boundary, sampling, spike rejection, smoothing, downsampling, and validation.
The pipeline record should answer:
- Which stage prevents aliasing before sampling?
- Which stage removes isolated bad samples?
- Which stage smooths random jitter?
- Which stage reduces data volume?
- What is the latency added by each stage?
- What event or signal change would force a new review?
25.18 Check Your Understanding
Lab Workflow Label Check
Lab Decision Matching
Lab Order
Knowledge Check
25.19 Common Pitfalls
If sample rate, bit depth, reference range, and filter type change together, the lab cannot explain which decision caused the improvement or failure.
Digital smoothing can hide aliasing, clipping, or missed short events. Check the analog boundary and sample plan first.
A processed stream should be tested with a known event. A trace that looks calm may simply be removing the information the system needs.
25.20 Capture Limits Software Cannot Repair
A signal-processing lab is not a search for the smoothest chart. It is a controlled experiment that proves whether a processing decision still preserves the physical event the IoT product needs. The baseline is always a raw trace with units, timestamps, expected event timing, reference range, sensor setup, and analog-front-end settings recorded before any smoothing, clipping, downsampling, or frequency analysis.
For sampling, define the highest useful signal frequency, the shortest event duration, and the analog bandwidth before choosing a sample rate. Nyquist gives the lower bound: to capture frequencies up to f, the stream must be sampled above 2f. In practice, leave margin above that bound because analog filters need transition room and real events rarely arrive as perfect sinusoids.
For conversion, record the ADC reference range, bit depth, noise estimate, and smallest meaningful physical change. An N-bit ADC divides its reference into 2^N codes, so one code step is approximately Vref / 2^N. Extra nominal bits do not help when sensor noise, reference drift, or analog-front-end error is larger than the code step.
| ADC bits | Levels | Step at Vref = 3.3 V |
|---|---|---|
| 8-bit | 256 | about 12.9 mV |
| 12-bit | 4096 | about 0.81 mV |
| 16-bit | 65536 | about 0.050 mV |
A vibration lab that expects useful energy up to 1 kHz and meaningful amplitude changes around 1 mV needs both timing and amplitude evidence. Nyquist demands more than 2 kHz, but a lab might test 3.2 kHz and 4 kHz to leave margin for the analog filter and short events. At a 3.3 V reference, an 8-bit ADC cannot resolve a 1 mV change; a 12-bit ADC can, provided analog noise is not larger. The final record should name both the sample-rate margin and the ADC-fit evidence.
25.20.1 Irreversible Failures
Two lab failures are irreversible after capture: aliasing and clipping. Aliasing occurs when energy above half the sample rate folds into the measured band. Once that folding has happened, the sampled data cannot tell whether a low-frequency pattern was real or created by undersampling. A proper lab therefore records the analog anti-alias boundary, not just the digital sample rate. The low-pass filter must act before the ADC, with cutoff and rolloff chosen so unwanted energy is reduced before it can fold down.
Clipping is equally destructive. If the sensor, amplifier, or ADC reference range saturates, the missing waveform shape cannot be reconstructed by a later smoothing filter. The raw-trace exercise should mark full-scale hits, baseline drift, and gain settings before any filter makes the trace look acceptable. The ADC-fit exercise then decides whether to change gain, reference range, bit depth, or sensor placement.
Frequency evidence has its own bookkeeping. An FFT bin spacing of fs / N depends on sample rate and record length, so a spectral peak is only meaningful when those values and the windowing method are recorded. Window choice affects leakage; downsampling requires a low-pass stage before decimation; and filter phase or group delay can move event timing even when amplitude looks improved.
A release-ready pipeline records the analog boundary, ADC fit, filter cost, spectral assumptions, decimation rule, and validation trigger. Without those records, a clean trace is only a presentation artifact.
25.21 Summary
The strongest signal-processing lab is repeatable. Capture raw evidence, vary one decision, compare before and after, choose filters by observed failure pattern, and validate the final pipeline with a known event. The lab record should make the engineering decision easy to audit later.
25.22 What’s Next
- Signal Processing Essentials: return to the route map for the full sequence.
- ADC Sampling Fundamentals: review sample-rate and anti-aliasing decisions.
- Quantization and Digital Filtering: deepen filter and code-step design.
- Signal Processing Practice and Lab: continue with calibration and non-linear sensor practice.
25.23 Key Takeaway
Signal-processing labs should compare expected transformations with measured data. The goal is to understand noise, delay, quantization, calibration, and error before deploying the algorithm.
