Author Topic: FFT and 60 Notch filter software  (Read 3612 times)

0 Members and 1 Guest are viewing this topic.

Offline loop123Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 297
  • Country: ca
FFT and 60 Notch filter software
« on: March 11, 2024, 05:18:23 am »
Hi, I need an FFT software and Notch filter software that can analyze the components of the waveforms and interferences directly from the ADC (with generic voltage input fed to the ADC that Audacity can easily read, meaning no coding of any kind)  to tell what frequencies of the output are involved. And also attempt to 60 Hz Notch filter it with brick wall response from 59 to 61 Hz.

The software can be combined in one or separate and must be free. Or cost so little. Know any?  Thanks.

2064053-0
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11269
  • Country: us
    • Personal site
Re: FFT and 60 Notch filter software
« Reply #1 on: March 11, 2024, 05:35:39 am »
Both things come with Audacity by default.

The notch filter even defaults to 60 Hz, since they anticipate it as the most common use.
Alex
 

Offline loop123Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 297
  • Country: ca
Re: FFT and 60 Notch filter software
« Reply #2 on: March 11, 2024, 07:05:24 am »
Both things come with Audacity by default.

The notch filter even defaults to 60 Hz, since they anticipate it as the most common use.

Great to know that. Do you know how to convert Audacity file to one that can be read by Matlab in general (and EEGLab in particular)?
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14488
  • Country: fr
Re: FFT and 60 Notch filter software
« Reply #3 on: March 11, 2024, 07:22:21 am »
Matlab can read WAV files, so that's probably your easiest path.
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 2221
  • Country: 00
Re: FFT and 60 Notch filter software
« Reply #4 on: March 11, 2024, 07:32:29 am »
EDFbrowser has many  kinds of (notch-)filters:

https://www.teuniz.net/edfbrowser/

The files generated can be read by matlab.

 

Offline loop123Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 297
  • Country: ca
Re: FFT and 60 Notch filter software
« Reply #5 on: March 11, 2024, 09:42:15 am »
Matlab can read WAV files, so that's probably your easiest path.

If Matlab can read WAV files. why cant EEGLab read WAV files since EEGLab runs in Matlab? see

https://www.researchgate.net/post/what_file_formats_are_possible_to_load_in_EEGLAB
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14488
  • Country: fr
Re: FFT and 60 Notch filter software
« Reply #6 on: March 11, 2024, 09:55:04 am »
 

Offline Andy Chee

  • Frequent Contributor
  • **
  • Posts: 688
  • Country: au
Re: FFT and 60 Notch filter software
« Reply #7 on: March 11, 2024, 10:41:00 am »
Matlab can read WAV files, so that's probably your easiest path.
If Matlab can read WAV files. why cant EEGLab read WAV files since EEGLab runs in Matlab?
If you don't want to manually code the WAV import into MATLAB array, then try using the Biosig plugin with EEGLAB.

https://eeglab.org/tutorials/04_Import/Importing_Continuous_and_Epoched_Data.html
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19519
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: FFT and 60 Notch filter software
« Reply #8 on: March 11, 2024, 11:02:13 am »
Once the OP has managed to notch out 60Hz, he'll probably realise it is 60Hz+-allowed variability.

Then he might want to notch out the harmonics, since modern mains waveforms are not sinusoidal.

The first time I looked at that this millennium, I thought something was wrong with the scope, transformer, etc. Nope: the problem was with the waveform.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 2221
  • Country: 00
Re: FFT and 60 Notch filter software
« Reply #9 on: March 11, 2024, 11:20:02 am »
Once the OP has managed to notch out 60Hz, he'll probably realise it is 60Hz+-allowed variability.

Then he might want to notch out the harmonics, since modern mains waveforms are not sinusoidal.

The first time I looked at that this millennium, I thought something was wrong with the scope, transformer, etc. Nope: the problem was with the waveform.

And then he might probably realize that notch filters can create ringing with particular waveforms, for example with EKG.
Usually, the best approach is to avoid powerline interference from being recorded.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19519
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: FFT and 60 Notch filter software
« Reply #10 on: March 11, 2024, 11:35:19 am »
Once the OP has managed to notch out 60Hz, he'll probably realise it is 60Hz+-allowed variability.

Then he might want to notch out the harmonics, since modern mains waveforms are not sinusoidal.

The first time I looked at that this millennium, I thought something was wrong with the scope, transformer, etc. Nope: the problem was with the waveform.

And then he might probably realize that notch filters can create ringing with particular waveforms, for example with EKG.
Usually, the best approach is to avoid powerline interference from being recorded.

Definitely!

He could always try to notch out the ringing  >:D
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 
The following users thanked this post: rhb

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8179
  • Country: fi
Re: FFT and 60 Notch filter software
« Reply #11 on: March 11, 2024, 06:54:35 pm »
Then he might want to notch out the harmonics, since modern mains waveforms are not sinusoidal.

Yeah. Anyone who ever worked with audio and tried to filter out mains hum by using a band-stop filter, realized a long time ago it's a futile task. Heck, you can hear that the hum is much more than the 50 or 60Hz component. Harmonics go to kHz range.

The only way really is to design audio (or other measurement) circuits such that they don't pick up the interference in the first place, or interference is cancelled e.g. by differential design, where cancellation happens with wide BW.
 

Offline loop123Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 297
  • Country: ca
Re: FFT and 60 Notch filter software
« Reply #12 on: March 11, 2024, 11:11:31 pm »
Both things come with Audacity by default.

The notch filter even defaults to 60 Hz, since they anticipate it as the most common use.

I created a 2.5mV 60Hz output using a Netech simulator. It displayed in Audacity. When I used the notch filter at 60Hz. The waveform disappeared so it is not on at default.
When I tried Frequency Analysis. Why don't I get just a peak at 60Hz (or 50Hz), instead, it shows many frequencies up to 9kHz like the following. I also attached the audio file. I need a frequency analyzer that will only show the 60Hz sine wave (or other frequency) in the display. I want one that will show the frequency in the plots. Attached is the 60Hz audio file so other can also check if the frequency is only 60HZ or a range of frequencies up to 9kHz not showed at Audacity?

* Netech 2point5mV 60Hz output.wav (1652.6 kB - downloaded 24 times.)

2065991-1
« Last Edit: March 11, 2024, 11:14:59 pm by loop123 »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11269
  • Country: us
    • Personal site
Re: FFT and 60 Notch filter software
« Reply #13 on: March 11, 2024, 11:37:53 pm »
The waveform disappeared so it is not on at default.
I did not say it was on by default. This is not even how Audacity works, nothing is on by default. The workflow if such that you apply plugins. I said that the default value when you apply the filter is 60 Hz.


When I tried Frequency Analysis. Why don't I get just a peak at 60Hz (or 50Hz), instead, it shows many frequencies up to 9kHz like the following.
Enable logarithmic scale for the frequency axis and increase the size of the FFT.

This is basic FFT stuff. If you can't figure that out at this point, you are not likely to get anywhere.
Alex
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19519
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: FFT and 60 Notch filter software
« Reply #14 on: March 11, 2024, 11:46:05 pm »
I created a 2.5mV 60Hz output using a Netech simulator. It displayed in Audacity. When I used the notch filter at 60Hz. The waveform disappeared so it is not on at default.
When I tried Frequency Analysis. Why don't I get just a peak at 60Hz (or 50Hz), instead, it shows many frequencies up to 9kHz like the following.

Welcome to the world of windowing functions, e.g. Hanning, Hamming, flat-top, Blackman, and many others. Do you want to emphasise amplitude precision, frequency precision, a balance?

Thought experiment: if you have a 999Hz sinewave that is turned on/off at 10Hz, what do you think the frequency domain equivalent is - or should be?
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 
The following users thanked this post: newbrain

Offline loop123Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 297
  • Country: ca
Re: FFT and 60 Notch filter software
« Reply #15 on: March 11, 2024, 11:46:36 pm »
The waveform disappeared so it is not on at default.
I did not say it was on by default. This is not even how Audacity works, nothing is on by default. The workflow if such that you apply plugins. I said that the default value when you apply the filter is 60 Hz.


When I tried Frequency Analysis. Why don't I get just a peak at 60Hz (or 50Hz), instead, it shows many frequencies up to 9kHz like the following.
Enable logarithmic scale for the frequency axis and increase the size of the FFT.

This is basic FFT stuff. If you can't figure that out at this point, you are not likely to get anywhere.

Done. So the other frequencies shown besides 60Hz is the noise floor?  What kind of application where it will only show the 60Hz and the component frequencies from Fourier breakdown of the frequencies actually displayed. This is what I want to see. Not the inclusion of noise floor or whatever the wide frequency in the plot.

2066033-0
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19519
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: FFT and 60 Notch filter software
« Reply #16 on: March 11, 2024, 11:48:57 pm »

So the other frequencies shown besides 60Hz is the noise floor? 
No.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11269
  • Country: us
    • Personal site
Re: FFT and 60 Notch filter software
« Reply #17 on: March 11, 2024, 11:50:26 pm »
Done. So the other frequencies shown besides 60Hz is the noise floor?
They are artifacts of the transform and quantization. You can apply different windowing functions and see how they change.


What kind of application where it will only show the 60Hz and the component frequencies from Fourier breakdown of the frequencies actually displayed. This is what I want to see. Not the inclusion of noise floor or whatever the wide frequency in the plot.

You are looking at it at the result of the transform. You can extract the full information. There is an export button where it will save this information into the file and you can take whatever you need.

I don't understand what you want from it, so it is hard to tell what to do exactly.
Alex
 

Offline loop123Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 297
  • Country: ca
Re: FFT and 60 Notch filter software
« Reply #18 on: March 11, 2024, 11:53:24 pm »
This is actually what I want. I inputted 10 microvolt 50Hz into the amplifier I always get this waveforms and not a uniform sine wave. I even enclosed the electrodes in metal box so it is shielded from capacitive coupling and intereference current. What I want to know is what is causing the interference such tha the waveforms are distorted and not pure 10uV 50Hz sine wave?

2066051-0
« Last Edit: March 12, 2024, 03:25:39 am by loop123 »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11269
  • Country: us
    • Personal site
Re: FFT and 60 Notch filter software
« Reply #19 on: March 11, 2024, 11:57:40 pm »
I inputted 10 microvolt 50Hz into the amplifier I always get this waveforms and not a uniform sine wave.
What makes you think your source is a pure sine wave in a first place? Have you characterized your amplifier for noise and distortion?

You are working with very low levels and shitty electrical setups. Of course there will be all sorts of distortions.

I don't see how FFT would be of a lot of help here.
Alex
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11269
  • Country: us
    • Personal site
Re: FFT and 60 Notch filter software
« Reply #20 on: March 12, 2024, 12:16:47 am »
Besides FFT. How to know what frequencies cause the interference or noises?
What is wrong with FFT? It is perfectly adequate.

It is said enclosing the whole setups in Faraday Cage can eliminate the distortion. True?
Depends on the source of the distortion. If your amplifier is crap, no matter how much you enclose it, it will remain crap.

I'm done with this this topic. I mistakenly did not ignore it from the start.
Alex
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7747
  • Country: ca
Re: FFT and 60 Notch filter software
« Reply #21 on: March 12, 2024, 12:19:47 am »
Just so you are aware, if you are making sampling tech which needs to notch out 50hz and 60hz, if I remember correctly, Analog Devices makes a 24bit ADC which has an absurd built in 21 tap, or more, digital filtering processor specifically designed for that task to deal with AC emi and it's overtones.  It had something like an insane 180db reject on those 2 frequencies.

I once designed scales for food filling machines which had to sample really fast, yet reject the food feed vibration beds which were controlled by the my electronic scale.

It just requires 1 crystal and it provides you a clock with a fixed sample rate.  You can gang them together using only 1 crystal to create a huge channel sampling system with channel to channel perfect reject of those tones.
« Last Edit: March 12, 2024, 12:21:35 am by BrianHG »
 

Offline loop123Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 297
  • Country: ca
Re: FFT and 60 Notch filter software
« Reply #22 on: March 12, 2024, 01:19:50 am »
The amp (model AMP01) used in the commercially built equipment is not crap. It is one of the best with noise of 5 nV/sqrt(Hz) so at 100 Hz bandwidth, the noise rms is 50nV or 0.05uV so 10uV signal should have no problem. If I increase the signal to 30microvolt, 50Hz. The following is nice sine wave output with no distortion (using 100Hz bandidth too in amp). It is only when I used 10microvolt that I got the distortion. Using the 10uV wav file I shared in last message. Guys pls help determine the frequencies interfering with it. From the file, can you tell if the noise is external or in the circuit??

2066222-0
« Last Edit: March 12, 2024, 01:48:01 am by loop123 »
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14488
  • Country: fr
Re: FFT and 60 Notch filter software
« Reply #23 on: March 12, 2024, 02:05:43 am »
Just so you are aware, if you are making sampling tech which needs to notch out 50hz and 60hz, if I remember correctly, Analog Devices makes a 24bit ADC which has an absurd built in 21 tap, or more, digital filtering processor specifically designed for that task to deal with AC emi and it's overtones.  It had something like an insane 180db reject on those 2 frequencies.

Yes. They have many of them actually, for instance the AD7190.
 

Offline Andy Chee

  • Frequent Contributor
  • **
  • Posts: 688
  • Country: au
Re: FFT and 60 Notch filter software
« Reply #24 on: March 12, 2024, 02:15:17 am »
From the file, can you tell if the noise is external or in the circuit??
Are you only measuring one channel/electrode, or multiple channels/electrodes?  Your photo only shows one waveform, so I'm assuming you're only measuring a single channel/electrode.

If you measure multiple electrodes, you can mathematically remove the common noise.  The theory is that the skin potentials will be different at each electrode, but the noise (particularly 60Hz and other EMI) will be the same in all channels. 

EEGlab can do this multiple channel common noise reduction, and I'm pretty sure Audacity should be able to do it with two channel stereo.  The key is that you need multiple channels, not single.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf