ChatPPG Editorial

Notch Filter for PPG: Removing 50/60 Hz Powerline Noise Without Distorting Pulses

Use a narrow 50/60 Hz notch in PPG only when mains interference is visible. This guide covers Q factor, phase tradeoffs, aliasing, and implementation.

ChatPPG Research Team
9 min read
Notch Filter for PPG: Removing 50/60 Hz Powerline Noise Without Distorting Pulses

A notch filter powerline noise PPG problem is best solved with a very narrow 50 Hz or 60 Hz rejection stage, but only when mains contamination is actually visible in the sampled signal. In many wearable pipelines, a cardiac bandpass already suppresses that energy, so adding a notch can create ringing, phase shift, or extra complexity without improving beat detection.

A notch is different from the broader filtering strategies discussed in our guides to bandpass filter design for PPG, PPG Butterworth filter design, and PPG baseline wander removal. It is a surgical tool, not a default stage.

When powerline noise is a real PPG problem

Powerline contamination usually appears as a narrow spectral spike at 50 Hz or 60 Hz, sometimes with harmonics at 100, 120, 150, or 180 Hz. In contact PPG hardware, that interference can enter through the analog front end, LED drive circuitry, poorly isolated USB power, long sensor leads, or shared grounds between the optical module and a noisy host board.

You should suspect real mains contamination when three things are true:

  1. The spectrum shows a stable narrow line at the local mains frequency.
  2. The line persists even when motion is minimal.
  3. The interference is large enough to affect the metric you care about, such as peak timing, pulse morphology, or a derivative feature.

A visible 60 Hz spike is not automatically a problem. If your pipeline ends with a low-pass at 8 Hz and your beat detector is stable, the line may be irrelevant in practice.

When not to use a notch filter

The fastest way to misuse a notch filter is to add it by habit.

Heart-rate-only pipelines often do not need it

For many wrist and finger PPG systems, the useful cardiac content sits well below 20 Hz. If your production pipeline already uses a bandpass like 0.5 to 8 Hz, or 0.7 to 5 Hz for rate tracking, 50 Hz and 60 Hz interference are already far outside the passband. In that case the notch is redundant.

Low sampling rates change the problem

Many wearables sample at 25, 50, or 100 Hz. At 25 Hz and 50 Hz, a 50 Hz component cannot exist in the discrete-time signal as a clean 50 Hz line because it is above or at the Nyquist limit. At 100 Hz, a 50 Hz line sits right at Nyquist, where numerical behavior is awkward and any frequency drift can fold into nearby bins. If analog anti-alias filtering is weak, mains noise may alias into a lower frequency. Once that happens, a digital notch placed at 50 or 60 Hz will not fix it. You have to identify the aliased frequency in the sampled data, or correct the analog front end.

Motion artifact can masquerade as electrical noise

Cadence-related artifact from walking or running often creates narrow peaks too, especially in short FFT windows. Those peaks move with activity and usually sit inside the cardiac band. A notch aimed at motion frequency can destroy legitimate pulse energy because, unlike mains noise, motion often overlaps the physiology. In that situation you need adaptive filtering, Kalman filtering, or signal-quality gating, not a static powerline notch.

The design target: narrow rejection, minimal collateral damage

For PPG, the best notch is usually a second-order IIR notch, implemented as a biquad. It places zeros at the unwanted frequency and nearby poles just inside the unit circle to control stopband width, which makes it cheap enough for embedded deployment.

The standard digital form is:

H(z) = (1 - 2 cos(w0) z^-1 + z^-2) / (1 - 2 r cos(w0) z^-1 + r^2 z^-2)

Here w0 is the normalized center frequency and r sets the width. Values of r closer to 1 create a narrower notch. In library functions such as scipy.signal.iirnotch, the same tradeoff is expressed with the quality factor Q.

How to choose the center frequency

The right center frequency is local and empirical.

If you are in a 60 Hz region, start at 60 Hz. If you are in a 50 Hz region, start at 50 Hz. Then confirm it against the actual spectrum from your device, your power source, and your sampling rate. Some bench setups are powered by laptop chargers, USB hubs, or switching supplies that inject sidebands or harmonics. The mains label on the wall does not guarantee that the dominant interference line in the digitized PPG is exactly 50.000 or 60.000 Hz.

For long clinical recordings, the grid frequency may drift slightly over time. A very high-Q notch can miss part of that drift. For most wearable and benchtop PPG work, keeping the notch narrow but not razor-thin is the right compromise.

Q factor: the main tuning knob

The quality factor is defined as:

Q = f0 / BW

where f0 is the center frequency and BW is the bandwidth between the half-power points.

For PPG work, these are sensible starting points:

  • Q = 10 to 15 for moderate rejection when the frequency may drift or coefficient precision is limited.
  • Q = 20 to 35 for clean bench data where the interference is stable and you want minimal loss outside the notch.
  • Q above 40 only when you have very stable frequency, enough numerical precision, and a good reason to be that narrow.

A low Q removes too much neighboring content. A very high Q gives beautiful textbook plots but can become fragile in real hardware. It also increases sensitivity to coefficient quantization in fixed-point implementations.

One practical example: at f0 = 60 Hz with Q = 30, the notch bandwidth is about 2 Hz. That is narrow enough to avoid broad spectral damage, but still wide enough to tolerate small drift and bin mismatch. For many systems this is a better starting point than an ultra-narrow notch that looks elegant in simulation and underperforms on device.

Phase distortion and why it still matters in PPG

A common argument is that 50 Hz or 60 Hz is far above the cardiac band, so phase distortion from a notch cannot matter. Often that is true for simple heart-rate output. It is less true when you care about waveform shape, derivative features, or edge transients.

Three mechanisms matter:

1. Startup and edge transients

An IIR notch responds to abrupt changes with ringing. If your signal contains clipped samples, dropped packets, or hard window boundaries, the transient can leak into the time domain in a way that broadens or ripples the pulse.

2. Interaction with later filtering

A notch is rarely the only stage. If you apply a notch, then a steep bandpass, then derivative-based peak detection, the compound effect can change peak sharpness more than any single stage suggests.

3. Derivative amplification

The first derivative and especially the second derivative amplify small waveform imperfections. If your downstream task uses PPG waveform basics, the second derivative SDPPG, or notch-sensitive morphology features, validate on those outputs directly.

For offline analysis, forward-backward filtering is the safest option because it removes phase shift. For real-time streaming, you need a causal notch, and then you should measure whether timing error stays inside your tolerance.

A practical implementation in Python

import numpy as np
from scipy.signal import iirnotch, sosfiltfilt, tf2sos

def notch_ppg(x, fs, f0=60.0, q=30.0, zero_phase=True):
    # Design second-order notch
    b, a = iirnotch(w0=f0, Q=q, fs=fs)
    sos = tf2sos(b, a)

    if zero_phase:
        return sosfiltfilt(sos, x)

    # For streaming use sosfilt with carried state instead
    from scipy.signal import sosfilt
    y, _ = sosfilt(sos, x, zi=np.zeros((sos.shape[0], 2)))
    return y

This code is only the start. In production, add a spectral check, test at the real device sample rate, and validate peak timing after the full preprocessing chain.

Where the notch belongs in the pipeline

The notch should sit early enough to prevent the interference from polluting later stages, but late enough that you are not ignoring front-end failures.

A sound default order is:

  1. Check for clipping, dropouts, and timestamp gaps.
  2. Remove or interpolate isolated invalid samples.
  3. Apply a notch only if powerline contamination is confirmed.
  4. Run the broader cardiac bandpass or low-pass stage.
  5. Apply motion-suppression methods if needed.
  6. Run PPG signal quality assessment before trusting peaks or features.

That order avoids a common error, which is to throw a notch at a signal that is actually failing because of motion, loose wear, or aliasing.

Validation: what to measure after adding the notch

A notch is successful only if the unwanted line falls and the physiologic metric stays intact.

For rate-tracking pipelines, validate:

  • heart-rate MAE versus ECG or a clean reference PPG
  • false and missed beat counts
  • timing jitter of detected systolic peaks

For morphology pipelines, validate:

  • waveform correlation before and after the notch on clean data
  • dicrotic notch visibility when it exists physiologically
  • derivative landmark timing and amplitude

It is also worth testing under two negative conditions: first, on data with no mains contamination, to make sure the notch does not hurt clean signals; second, on aliased contamination, to confirm you are not giving yourself false confidence with the wrong center frequency.

Common failure modes engineers run into

Notching the wrong frequency after resampling

If you resample from 200 Hz to 50 Hz and then add a 60 Hz notch, you are solving yesterday's problem. After resampling, the interference has either been filtered out, folded, or transformed by the decimation chain. Design for the signal you actually have at that stage.

Using a notch to cover a hardware issue

A severe 60 Hz line can be a symptom of grounding, shielding, LED drive coupling, or poor analog layout. A digital notch may make the plot look better while the hardware remains weak. If you are still in the design phase, fix the analog problem first.

Forgetting the harmonics

Some systems pick up not only 50 or 60 Hz but also 100 or 120 Hz from full-wave rectification or LED power electronics. If those harmonics leak into the sampled band, a single notch may be incomplete. That still does not justify spraying multiple narrow notches into a heart-rate pipeline without checking whether a better low-pass or cleaner hardware would be simpler.

FAQ

Do all PPG pipelines need a notch filter for 50 or 60 Hz noise?

No. Many PPG pipelines already remove mains interference with a low-pass or bandpass stage, especially for heart-rate estimation. Add a notch only when a narrow interference line is present and affects the output metric.

What Q factor should I start with for a PPG notch filter?

A practical starting range is Q = 20 to 30 for stable bench or clinical recordings, and Q = 10 to 15 when the interference frequency drifts or embedded precision is limited.

Should the notch come before or after the bandpass filter?

Usually before the main bandpass, so the narrow interference does not contaminate later stages. But if the broad filter already removes the line completely, the notch may be unnecessary.

Can a notch filter distort PPG pulse morphology?

Yes. It can introduce ringing or interact with later filters, especially when you use derivatives, short windows, or morphology-sensitive endpoints. That is why validation should include waveform timing and shape, not only visual cleanup.

Why is 50 or 60 Hz still visible after I added a notch?

Common reasons are frequency drift, a harmonic that was not removed, aliased contamination, or a hardware path that is injecting broadband noise in addition to the mains line.

What if my wearable samples at 25 Hz or 50 Hz?

At those sample rates, mains contamination often aliases or is already beyond the usable digital band. Focus on analog anti-alias filtering and inspect the sampled spectrum before placing a digital notch.

References

  1. Allen J. Photoplethysmography and its application in clinical physiological measurement. Physiological Measurement. 2007. https://doi.org/10.1088/0967-3334/28/3/R01
  2. Elgendi M. On the analysis of fingertip photoplethysmogram signals. Current Cardiology Reviews. 2012. https://doi.org/10.2174/157340312801215782
  3. Charlton PH, et al. Assessing hemodynamics from the photoplethysmogram to gain insights into vascular age. American Journal of Physiology-Heart and Circulatory Physiology. 2022. https://doi.org/10.1152/ajpheart.00392.2021

Frequently Asked Questions

Do all PPG pipelines need a notch filter for 50 or 60 Hz noise?
No. Many PPG pipelines already remove mains interference with a low-pass or bandpass stage, especially for heart-rate estimation. Add a notch only when a narrow interference line is present and affects the output metric.
What Q factor should I start with for a PPG notch filter?
A practical starting range is Q = 20 to 30 for stable bench or clinical recordings, and Q = 10 to 15 when the interference frequency drifts or embedded precision is limited.
Should the notch come before or after the bandpass filter?
Usually before the main bandpass, so the narrow interference does not contaminate later stages. But if the broad filter already removes the line completely, the notch may be unnecessary.
Can a notch filter distort PPG pulse morphology?
Yes. It can introduce ringing or interact with later filters, especially when you use derivatives, short windows, or morphology-sensitive endpoints. Validation should include waveform timing and shape, not only visual cleanup.
What if my wearable samples at 25 Hz or 50 Hz?
At those sample rates, mains contamination often aliases or is already beyond the usable digital band. Inspect the sampled spectrum first and focus on analog anti-alias filtering before placing a digital notch.