Tasos Sangiotis

Get mains out of my signal

Power-frequency interference gets picked up through insufficiently shielded instrumentation or electrically 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 acoustic 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 narrow1. 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 bellow2.

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 stopped. I will dig into that more in the future.

Comment details and information

To make a comment, please send an e-mail using the button below. Your e-mail address won't be shared and will be deleted from my records after the comment is published. If you don't want your real name to be credited alongside your comment, please specify the name you would like to use. If you would like your name to link to a specific URL, please share that as well. Thank you.