Signal Conditioning

Showing results for 
Search instead for 
Did you mean: 

Using 3 filters to cut off 60, 120, 180 Hz noise

Hello everyone,


I wanted to filter the noise of 60, 120, 180 Hz. So i used 3 filters with bandstop type Bessel filter. So i had the cutoff of 58-65 Hz for 1st Filter, 115-125Hz for 2nd filter and 177-185 Hz. But when i see it in frequency domain then instead of chopping of the peaks i get " U" shaped 3 peaks using 3 filters in the filtered frequency domain. Also i am not getting anything in the real plot . Can anyone help me whether i am in doin right ?


I have attached by vi herewith this text. Thanks alot.. Any suggestions regarding filtering of noise is highly appreciated, Also could you please have a look on my VI and let me know if  there is anything missing in my part?


Thanks, Also i have taken screen shots . Two images in order. IMage 1 : Raw Signal and Result of 1st filter 

                                                                                                                Image 2 :  Result of FIlter 2 and FIlter 3





Download All
0 Kudos
Message 1 of 20

Please supply us with some data. We do not have your hardware.  Run your VI until you have data on the Raw Signal Graph. Stop the VI. Right click on the graph choose Data Operations >> Make Current Value Default. Then save the VI and post that.


Cleaning up the diagram would be nice also.  Wires should run left to right and not under or behind other objects.



0 Kudos
Message 2 of 20

Thats what the type II notch filter is designed for....(DFD IIR comp design)  if you have the filter design toolkit.


another approach is to merge the signal with a half periode f0 delayed one 😉   


  depending on your samplerate you can use tone detection  to measure the actual line frequency and adapt the filter 😉



Greetings from Germany

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

0 Kudos
Message 3 of 20

Apologies for the missing info.


The parts used are

1. cDAQ-9171, CompactDAQ Chassis (1 slot USB)

2. NI 9237 w/ DSUB, 4 Ch , 50 ks/s per Ch, Analog Input module

3. Ni 9923 Front-mount terminal block for 37 pin D sub Modules


Regarding the type of graph i got i have attached the pictures with the previous query.





0 Kudos
Message 4 of 20

Hi ,


Well i am having a problem filtering the signals. I am new to Labview as well. 

Recently i bought the following parts to measure strain from a wheatstone bridge.

1. cDAQ-9171, CompactDAQ Chassis (1 slot USB)

2. NI 9237 w/ DSUB, 4 Ch , 50 ks/s per Ch, Analog Input module

3. Ni 9923 Front-mount terminal block for 37 pin D sub Modules


But right now for a starter i am trying to measure a strain from permanent magnet vibration shaker from ling dynamic system. 


There is a lot of noise in the signal. So when i use fft i could see frequencies only in imaginary plot of fft . Just 1 spike near zero in the real plot.  Can you let me know why?


Also since i could see 60hz signal in different harmonics of 120 and 180 hz in the imaginary plot. So i used the butterworth filter from filter vi. I used two of them . One as a low pass filter that has cutoff at 100 Hz and another as bandstop filter with cutoff between 58-63 hz. But the result of applying two filters is more distorted than using only one filter.


From the first filter i could see some improvement in the signal, But the fft of the filtered signal does not make sense. Can you please help me find out what is wrong with my vi?


I have included my vi along with this query.


Any suggestions and advice are most welcome and appreciated,


0 Kudos
Message 5 of 20

I do not see any power line frequency signal or harmonics in the data you posted with the two filters VI.


Here is the way I might approach the issue.

1. Get rid of the Dynamic Data wire coming out of the DAQ Assistant. It obscures the underlying data structure. The Waveform data type is much better.

2. Remove the constant component.

3. Set all the filters to the same parameters for more realistic comparisons.

4. Use FFT Spectrum (Mag-Phase).vi. This output format is more readily interpretted in terms of signal and filter behavior.

5. Look at different types of filters under identical conditions. When I placed your Zero phase filter into this VI it showed broad notches at 1 and 2 kHz.

6. Look at a real signal to see what effects the filters have on the signal.  With this noise signal you cannot see the phase effects on a real signal.  It odes give a pretty good indication of the amplitude response.



0 Kudos
Message 6 of 20

Hi Lynn,


Thank you for your effort. It guess it will be quite useful for me.  I will check and let you know soon  the result.


Thank you once again.




0 Kudos
Message 7 of 20

Hi Lynn,

Thanks for your help. I changed the data type to single wave form and plotted magnitude and phase like u showed me. I think thats the proper way of showing in frequency domain..


I used the bandstop filter to cutoff 58 to 65 Hz and it  cut off that noise. But still tehre is some nois below 0.05 Hz.  So i tried to cut off that noise using  again bandstop type of Bessel filter it starts to give aliasing . (filtered signal becomes a curve shape). 


As u you said use the same paramter in the filter. But in my case i just need to cut off nois below 0.5hz. So basically if i used the same parameter again then the filter doesn't do any better.

So can you suggest me what i should be doing in this case?


Could you please have a look on my VI too. Thanks alot.


Appreciated alot .



0 Kudos
Message 8 of 20



There are two reasons you have noise at low frequencies. First, there is a significant offset in the data.  The raw data has an amplitude of about 0.0017 with a peak to peak variation of about 3E-6. So the offset is about 500 times bigger than the "signal." Second, the signal has a drift upwards of about 3 to 5E-6 over the 1 second of data collection.  That represents a low frequency signal but there is not enough information to determine the actual frequency.


Both of those result in a large zero-frequency (also called DC) component in the spectrum. The first is easily removed by subtracting the mean of the data before further analysis.  If you look closely at the low frequency end of the spectrum without removing the offset, you can see that the low frequency component is more than 5 orders of magnitude larger than the rest of the spectrum!  To get that component reduced to less than one order of magnitude above the rest of the spectrum a high pass filter with a cutoff greater than 60 Hz is required.  Simply removing the mean reduces that peak to about one order of magnitude.


The reason a filter alone does not do a good job of removing that offset is that all filters have a transient response. That large offset strongly excites that transient. This is why you see a very large damped oscillitory response at the low frequency end of the spectrum in your VI.  By subtracting the mean the transient response is not eliminated but it is excited very weakly and is not a problem.


After removing the mean a second order high pass filter (NOT a bandstop filter) with a cutoff of 2.5 to 3 Hz is sufficient to completely remove all the remaining drift component.


If you follow that with a bandstop filter centered at 60 Hz, it will get rid of most of the power line frequency noise.


Because the offset and drift are the biggest interfering signals in the data you have posted (no 60 Hz), it may be better to remove those first and filter the power line interference later.


Also note that your frequency resolution (df) is 1 Hz. So you cannot see the fine details of the behavior of either filter at fractional hertz frequencies.



Message 9 of 20

Hi Lynn,


Thanks for your valuble feedback and information. Well i tried by your way in offsetting the 0.0017 offset . The raw signal seems to respond for the change in response of strain gage. But the filtered signal  response settles at zero even when i make some response of the strain gage. Below i have attached,my new vi like yours. Could please check on it?

I also tried the waveform and scale vi to correct the offset. But i was unable to enter the offset value of that order i am getting. Is there any other way if you have in your mind?


Thank you.


Appreciated once again .



0 Kudos
Message 10 of 20