Get mains out of my signal

Power-frequency interference gets picked up through insufficiently shielded instrumentation or electricly generated mechanical faults.

While correct installation, ground loop avoidance and elimination of other sources is the goal sometimes it is not possible.

Bellow is the timeseries and spectrum of an heterodyned output ultrasound sensor. It transfers the high frequency signals to the accoustic range.

Image title
Image title

As you see, 50 Hz is very prominent here resulting in a constant hum. You can also spot a lot of harmonics.

Queue the notch filter.

A notch filter is a type of band-stop filter, which is a filter that attenuates frequencies within a specific range while passing all other frequencies unaltered. For a notch filter, this range of frequencies is very narrow. The range of frequencies that a band-stop filter attenuates is called the stopband.

Because we want to also catch the harmonica we can use a filter sampling frequency that is
a multiple of our power-frequency.

The ideal result in a the time domain will look as bellow.

Image title

Doing that to our signal results in a much cleaner representation for the other phenomena.

Image title
Image title

Harmonics are still there but affect much less the signal. One could certainly phase them out but I used audacity which does not feature sampling rate settings for notch filters so I went manual and I stoped after 450Hz.

I will dig into that more in the future.


References:

  1. Scipy notch function
  2. Introduction to Signal Processing – Sophocles J. Orfanidis (Rutgers University)
  3. Audacity used to generate the above tests

Comments

Leave a comment