Removing 60Hz from ECG using digital band stop filter

Let’s make a filter, which filters off the 60Hz frequency from ECG signal. As we know American power supply is 60Hz. This is common noise in biomedical signals, while they are powered from industrial power supply. This type of noise can be defined easily and can be filtered as parameters of noise are known.
Here is one example of how to implement FIR filter using mathematical tools, like Matlab. This can be done by using microcontroller, like ARM or even ARM, because the frequencies are up to 1 KHz.
Initial conditions:

f0=60Hz - pover supply frequency;
fs=500Hz - sampling rate;
frequencies who define complex zeros:

image006.gif

we get w0=0.754;
Positions of complex zeros:

image010.gif

image012.gif

image014.gif

Zeros and poles in z plane

System Function

image018.gif

From it we can calculate filter coefficients:

image020.gif

image022.gif

And filter coefficients:

image024.gif   image026.gif     image028.gif

Also we know that:

image030.gif

image032.gif

image034.gif

And here we get filter characteristics:

image036.jpg

Ve have band stop filter at 60Hz and its jam at 60Hz is -300dB. Bellow is filter structure:

image037.gif

Now using this filter we can filter ECG signal:

image040.jpg

As you can see this is simple FIR filter. In other words there is nothing more than average function which doesn’t need much of resources. The other benefit of FIR filter is that we can get linear Phase characteristics, there fore filtered signal isn’t distorted because of different spectra frequency delay. As result wee see that ECG become more smooth. FIR filter

Blogsphere: TechnoratiFeedsterBloglines
Bookmark: Del.icio.usSpurlFurlSimpyBlinkDigg
RSS feed for comments on this post
 |  TrackBack URI for this post

New on WinAVR Tutorial
Running TX433 and RX433 RF modules with AVR microcontrollers,
Sometimes in embedded design you may want to go wireless. Might be you will want to log various readi …
Programming AVR ADC module with WinAVR,
Most of AVR microcontrollers have Analog to Digital Converter (ADC) integrated in to chip. Such solut …
New on WinARM Tutorial
What are differences between WinARM and WinAVR,
Everyone who is working with AVR microcontrollers knows this powerful tool – WinAVR (http://win …
LPC2000 watchdog timer,
As in all microcontrollers watchdog timers purpose isto reset microcontroller after reasonable amount …

12 Responses to “Removing 60Hz from ECG using digital band stop filter”

  1. thomas young Says:

    Good article.

  2. scienceprog Says:

    Click right mouse button and select open/view image for better image quality.

  3. zorgz Says:

    hi, i’m developping an application for removing 60 Hz noise from ECG diagram, and i’m newbie in all of this.
    I have an array on 2000 points for 4 secs. So Fs=500Hz, how can i remove the 60 Hz noise.

    Ok…if i anderstood w0=0.754 and If the sampling frequency is 500 Hz, the zero at +43,2 degres will completely eliminate any signal at
    60 Hz is it correct??

  4. scienceprog Says:

    As far as I remember yes. Because we get band-stop filter at 60Hz.

  5. Mohsen.m Says:

    hello Dear
    I want remove 50Hz noise of EKG with 500Hz sps. please help me for writing m file(mATLAB pROG.) of your technic.

  6. scienceprog Says:

    Just change
    w0=2*pi*((60)/(fs));
    to
    w0=2*pi*((50)/(fs));
    in attached file bellow article. That should help.

  7. ashwiny Says:

    hi
    i want to remove 50Hz noise of ECG..please help me where i can find the source code..i prefer c language..please help me..

  8. Jose Says:

    The Fs in the zip file is 200, why?

  9. scienceprog Says:

    Probably a mistake, but as ECG signal is low freq, it is even enough of 200Hz sampling freq.

  10. ashwinss Says:

    Hi,
    I am using digital filters,but since i am new to this concept,i have stuck at one doubt.Please help me out. i am designing a LPF having 6Hz & 30Hz passband & stopband edge freq Also Fs(Sampling) is 512Hz. I have got the filters coefficient by implementing it in matlab but on the site from where i am taking guidance of this topic they have got coeff. in integer forms like

    //Lowpass FIR filter coefficients for 17 taps to filter > 30Hz
    static const int coeffslp[9] = {
    5225, 5175, 7255, 9453, 11595, 13507, 15016, 15983, 16315 };//

    I am not getting that how can we get such a large integer no. as a coeff.Is there any scaling process.
    Please guide me about this

  11. Ewigan Says:

    Hi,

    am working on something like that and am trying to understand your article. You are talking about a sample frequency of 500Hz, but yout code only works with 200Hz. i tried to tune it to get it to work, but that didn’t help at all ^^.
    So why the fs=200 in the code?

  12. scienceprog Says:

    Probably it was left after some tweaks. The change of fs to 500 didn’t work?

Leave a Reply