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


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

About Me

My name is Tasos Sangiotis and I work at Arpedon, an engineering company. This website is a collection of posts, essays and photos. They are mainly about travel, food and technical stuff. Occasionally I shoot photos. They are mostly on Instagram. If you choose to wander this wasteland do so with caution. Consider this your final warning. To contact me use [email protected]

Newsletter