Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Input Frequency Calculation using ADC Samples

Status
Not open for further replies.

naseer_39

Newbie level 4
Joined
Sep 6, 2010
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Hyderabad
Activity points
1,325
Hi all,

In our application , we are using a A/D Converter of resolution 18-bit with a sampling frequency of 400 Ksps
and Voltage range is +/-10V. We want to find out the input frequency of A/D Converter.Is there any way to
know the input frequency using number of ADC samples.1 LSB resolution of ADC is 156.52 uV.

Thanks and Regards,
S.Naseer
 

Your question is not clear add some detail.


400k samples per second & 18 bits per sample
Hence,
output data is at 400k*18 Hz (if it is what you are asking for).

Input data freq ? (I assume you want to know max input frequency, considering that)
you have 400ks & nyquist rate requires 2 samples per second, this gives a maximum input frequency of 200kHz.
 

Maybe a little more about the application would help. Is the signal periodic or are you asking just in general how to detect it? Obviously you need to be able to mark a part of the input signal and scan for it while sampling later on and find the time.
 

You can acquire the signal then do the FFT. You will have one or more peaks each indicating the frequency content and the associated amplitude.

Your sampling time is 1/400k=2.5 us.
The maximum frequency you can measure will be 400k/2=200 kHz. The minimum will depends from the length of the data stream you will take. It has to be long enough to contain a period of the lowest frequency you want to measure.
 

Thanks for the reply....

Let me explain with example

Suppose My A/D converter is fed with 50Hz frequency.With the 400K sampling rate , i need 8k number of samples to build one cycle. Is there any formula for finding out input frequency is 50 Hz in FPGA with 8k ADC samples.

Thanks and regards,
Naseer
 

If you do the FFT of you signal (using matlab or scilab, for instance: remember to use also fftshift) you will have a vector starting from -fs/2+0.5 to fs/2-0.5, that is -199999.5 to 199999.5 Hz in your case. The step will be so that there will be N points (8000 in your case). Then simply build the frequency vector as f=[-199999.5:400000/8000:199999.5];
The FFT will return a complex result; you need the modulus, that is abs(FFT)


To recover the amplitude you will have to multiply the FFT by 2/N, that is 1/4000 in your case.

If your signal is "s", then use plot(f,abs(fftshift(fft(s))/4000); you will see two peaks (one at a positive and another one to the same but negative frequency) for each of the frequencies that are belonging to your signal
 
Thanks for the reply....

Let me explain with example

Suppose My A/D converter is fed with 50Hz frequency.With the 400K sampling rate , i need 8k number of samples to build one cycle. Is there any formula for finding out input frequency is 50 Hz in FPGA with 8k ADC samples.

Thanks and regards,
Naseer

If I understand your question correctly you could multiply your input signal, which is supposed to be 50Hz, with an "ideal" 50 Hz sin signal. The results would be a DC component if the input signal frequency is really 50Hz. In principle: a*sin(w1)*b*sin(w2)=1/2(a*b*cos(w1-w2)-a*b*cos(w1-w2)). This is just an idea.

BR Jerry
 

If I understand your question correctly you could multiply your input signal, which is supposed to be 50Hz, with an "ideal" 50 Hz sin signal.
In terms of digital signal processing, a Goertzel filter does the same.
 
You can measure the frequency of a sinewave by counting the number of sampling intervals between zero crossings. As this interval is an integer, you can increase the resolution by averaging many measurements and by estimating the actual zero crossing time, taking into account the values of the samples around the zero crossing, the sine amplitude and the fact that the sine is linear with respect to time near the zero crossing.
If you are interested in a small range of frequencies, you can use a filter ahead of the zero crossing detector to reduce noise.
 
If you do the FFT of you signal (using matlab or scilab, for instance: remember to use also fftshift) you will have a vector starting from -fs/2+0.5 to fs/2-0.5, that is -199999.5 to 199999.5 Hz in your case. The step will be so that there will be N points (8000 in your case). Then simply build the frequency vector as f=[-199999.5:400000/8000:199999.5];
The FFT will return a complex result; you need the modulus, that is abs(FFT)


To recover the amplitude you will have to multiply the FFT by 2/N, that is 1/4000 in your case.

If your signal is "s", then use plot(f,abs(fftshift(fft(s))/4000); you will see two peaks (one at a positive and another one to the same but negative frequency) for each of the frequencies that are belonging to your signal

Ok now i get it by doing FFT we can know the frequency and Amplitude......Thanks for all replies....:)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top