What is a filter?
A filter keeps some speeds of change in a signal and reduces others. A heartbeat repeats about once or twice a second. Noise that is much faster, or drift that is much slower, can be reduced without touching the beat.
Laboratory 4 of 5 · Inside a Pulse Oximeter
A raw pulse signal is noisy. Smooth it, set a threshold, find each beat, and see how a pulse rate is calculated. Then see what the cleaning costs.
The signal and the noise are synthetic. The filters here are the simplest useful ones, chosen to teach. Real devices use more advanced methods, and nothing here is a clinical algorithm.
Summary
After the sensor measures the light, a processor has to turn a wobbly line into a number. It cleans the signal, finds each heartbeat, and measures the time between beats. In this laboratory you do each of those steps by hand with sliders, and you see that every step has a price.
Key ideas
A filter keeps some speeds of change in a signal and reduces others. A heartbeat repeats about once or twice a second. Noise that is much faster, or drift that is much slower, can be reduced without touching the beat.
Smoothing replaces each sample with the average of its neighbors. Fast fuzz averages away. A wider window removes more fuzz, but it also rounds off the real pulse and makes it smaller.
Slow drift can be removed by subtracting a running average of the surrounding few seconds. What is left changes only at the speed of the pulse.
A beat is a peak that rises above a threshold. A minimum gap of 0.3 seconds between beats stops one beat from being counted twice, because a heart cannot beat much faster than that.
Pulse rate in beats per minute is 60 divided by the average time between beats, in seconds. Beats that are missed or invented change that average, so the rate becomes wrong.
Whatever a filter removes, it may remove from the real signal too. Movement is the hardest case: it changes at about the same speed as the pulse, so no simple filter can separate them. Try it with the Walking example.
| Control | What it helps with | What it costs |
|---|---|---|
| More smoothing | Fuzz and light flicker | The pulse gets smaller and rounder, and fine detail such as the notch is lost |
| Remove slow drift | A trace that wanders up and down | Very slow real changes are removed too, and the start and end of the signal are less reliable |
| Higher threshold | Noise peaks counted as beats | Weak real beats are missed |
| Lower threshold | Catching weak beats | Noise peaks are counted as extra beats |
Simulation
| Result |
|---|
A found beat is a detection within 0.12 seconds of a true beat. The true beats are known because the signal is synthetic. In a real device they are not, which is what makes the problem hard. Pulse size kept compares the filtered clean pulse with the original.
The time between each pair of neighboring beats is averaged, and 60 is divided by that average.
Limitations
For filters and sampling in more depth, read Signal processing in biomedical devices.
Check your understanding