get 1kHz signal from noises, FFT? or FIR?

Thread Starter

richiechen

Joined Jan 1, 2012
93
Hey everyone

I am trying to measure the amplitude of a 1kHz signal (3-5V), from 300mV noises(0-30kHz).

I am planning to use a dsPIC doing FFT to measure the amplitude of the 1kHz sine wave.

The sampling rate will be 32kHz and 256 points FFT will be used.

Do you think the sampling rate is too high? Because under this sampling rate, signal below 16kHz will be sampled, which means the noises will be sampled.
If I use 16kHz sampling rate, then signals below 8kHz is sampled which means the noises 8kHz-16kHz are moved away by sampling....

Any comments on sampling rate?
Any suggestions on the length of FFT? Is 256 point enough?
What if I use a FIR instead of a FFT?

Thank you very much

Best regards
Richie
 

MrChips

Joined Oct 2, 2009
35,296
You need to understand the sampling theorem also known as the Nyquist Theorem, which states that:

The sampling frequency must be greater than twice the highest frequency component in the signal.

Just as important, the corollary states that:

There must be no frequency component greater than one-half the sampling frequency.

Hence, if you choose a sampling frequency of 32kHz, you must filter out everything above 16kHz.

Likewise, if you choose a sampling frequency of 16kHz, you must filter out everything above 8kHz.

It is erroneous to believe that by sampling at 16kHz you will remove noise above 8kHz.

The number of samples taken will determine the record length and hence the resolution in frequency space.

With a sampling rate of 32kHz, 256 samples will give a sample length of 8ms. Hence your resolution will be 125Hz.

At 16kHz, the resolution will be 62.5Hz.
 

MrChips

Joined Oct 2, 2009
35,296
There are better ways to measure a known frequency signal buried in noise such as phase-locked loop, deconvolution or correlation techniques.
 

crutschow

Joined Mar 14, 2008
38,938
As noted by MrChips, any noise above 1/2 the sample frequency will be seen in the sample. It is aliased into the passband and cannot be removed by digital filtering and will be seen as signal by the FFT.

Think about it. If you are sampling at 16kHz and a 32kHz signal is present, the sample will still contain some of that 32kHz signal, which will then appear as part of the sampled signal.

If you signal is only 1kHz then you want to use an analog (anti-alias) filter to roll off all noise above 1kHz with a high order filter as possible. That way you can use a lower sample rate without aliasing the noise into the signal bandwidth. The amount of filter rolloff you need depends upon the amplitude and frequency of the noise.
 
Last edited:

Thread Starter

richiechen

Joined Jan 1, 2012
93
There are better ways to measure a known frequency signal buried in noise such as phase-locked loop, deconvolution or correlation techniques.
Thank you Mr Chips

Could you explain more about why phase-locked loop is better?
If the frequency component could be calculated through FFT...

I will check more about deconvolution and correlation techniques because I have not heard of them before.

Thank you very much.

Best regards
Richie
 

Thread Starter

richiechen

Joined Jan 1, 2012
93
As note by MrChips, any noise above 1/2 the sample frequency will be seen in the sample. It is aliased into the passband and cannot be removed by digital filtering and will be seen as signal by the FFT.

Think about it. If you are sampling at 16kHz and a 32kHz signal is present, the sample will still contain some of that 32kHz signal, which will then appear as part of the sampled signal.

If you signal is only 1kHz then you want to use an analog (anti-alias) filter to roll off all noise above 1kHz with a high order filter as possible. That way you can use a lower sample rate without aliasing the noise into the signal bandwidth. The amount of filter rolloff you need depends upon the amplitude and frequency of the noise.
Thank you Crustschow

I has put a 4th-order active filter before the input of ADC.
The stop frequency is 20kHz, however.

Is it possible to implement a very sharp and narrow passing-band?

Best regards
Richie
 

t06afre

Joined May 11, 2009
5,934
Lock-in amplification is a technique used to separate a small, narrow-band signal from interfering noise. The lock-in amplifier acts as a detector and narrow-band filter combined. Very small signals can be detected in the presence of large amounts of
uncorrelated noise when the frequency and phase of the desired signal are known.
The lock-in amplifier is basically a synchronous demodulator followed by a low-pass filter.​
 

crutschow

Joined Mar 14, 2008
38,938
I has put a 4th-order active filter before the input of ADC.
The stop frequency is 20kHz, however.

Is it possible to implement a very sharp and narrow passing-band?
The filter stop frequency should be slightly above 1kHz.

If your signal is fixed at 1kHz then you can use a narrow-band bandpass filter with a 1kHz center frequency to filter out much of the noise.

An easy way to design active filters is the Filterpro free software from TI.
 

Thread Starter

richiechen

Joined Jan 1, 2012
93
Oh...I may get your point.

It is like comparing the input with A*cos(2pi*1000*t) to find the least square fitting for A?

Regards
Richie
 

THE_RB

Joined Feb 11, 2008
5,438
Your FFT algorithm will extract the 1kHz signal and reject the rest. All you need is a basic low pass filter to cut real high frequencies that might alias with your sample rate, but even then the high frequency content is normally "noise" which contains no strong frequency that will alias anyway. So a simple low-pass RC filter is probably enough.
 
Top