The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 31st, 2024, 1:23pm
Pages: 1
Send Topic Print
sinusoida ADC output for FFT (Read 2584 times)
singh
Community Member
***
Offline



Posts: 57

sinusoida ADC output for FFT
Jan 06th, 2012, 10:11am
 
i need to calculate FFT of the sinusoidal output of incremental ADC with 16 bit resolution

In order to achieve sinusoidal output vs input samples, i gave ramp input voltage amplitude from 0 to 3V for 20000 samples in sin function with fixed frequency freq =1 and fs = 60K with ADC cycles 257 and veried the phase from 0 to 2pi.

algorithm:

for vin = 0 to 3 with step input v =3/20000
     for phase  = 0 to 2pi
           output = ADCout(vin,freq,phase,fs);
     end
     rmsout = sqrt(mean(output))
end

plot(rmsout)

ADCout is function which has sin wave input function = vin*sin(2pi*f/fs*i/n) where n are number of cycles =257 and i varies from 1 to n

but i dont get the sinusoidal output function wrt samples, so that i can take fft.

Am i doing it the right way?
Back to top
 
 
View Profile   IP Logged
ywguo
Community Fellow
*****
Offline



Posts: 943
Shanghai, PRC
Re: sinusoida ADC output for FFT
Reply #1 - Jan 9th, 2012, 12:45am
 
I don't understand what you are doing. Just apply a sine wave input and measure the output.

Yawei
Back to top
 
 
View Profile   IP Logged
singh
Community Member
***
Offline



Posts: 57

Re: sinusoida ADC output for FFT
Reply #2 - Jan 9th, 2012, 1:58am
 
in order to plot 16000 samples Vs ADC output,do i need to apply sin wave with 16000 different frequencies?

eg

ADC out = adc(amplitude,freq,phase,OSR);

inside adc function
[
for i = 1 to OSR
      input = amplitude* sin(2pi*f*i/OSR + phase)
 
do all ADC stuff
end

filter section
output
]

now when i feed my OSR of 128 ,amplitude =2.8V ,freq of 1KHz phase =0, the sin wave genertaed at input is shown in attached figure.but at the output of digital filter, i just get one value from the ADC output for the whole sin wave input and not the sin wave output Undecided

Back to top
« Last Edit: Jan 9th, 2012, 5:53am by singh »  

sininput.png
View Profile   IP Logged
loose-electron
Senior Fellow
******
Offline

Best Design Tool =
Capable Designers

Posts: 1638
San Diego California
Re: sinusoida ADC output for FFT
Reply #3 - Jan 9th, 2012, 11:52am
 
single sinusoid at one frequency.
Do an FFT of the output.

I believe thats what you are looking for?
Back to top
 
 

Jerry Twomey
www.effectiveelectrons.com
Read My Electronic Design Column Here
Contract IC-PCB-System Design - Analog, Mixed Signal, RF & Medical
View Profile WWW   IP Logged
ywguo
Community Fellow
*****
Offline



Posts: 943
Shanghai, PRC
Re: sinusoida ADC output for FFT
Reply #4 - Jan 9th, 2012, 5:40pm
 
Singh,

Now that OSR = 128, you get one number at the ADC output when you apply an input that is 128×Fs.

If the clock frequency is Fclk, and Fclk = OSR × Fs. Just apply a sine wave at the input. The input signal frequency is
Fsig = Fclk × n / 2m.

n is a odd number so that n and 2m are coprime numbers. Then do 2m-point FFT with the ADC output data.

Choose a big enough number for 2m so that the frequency bin is small enough to identify signal, distortion, and noise.

You need to read a book named Understanding Delta-Sigma Data Converters.
http://www.designers-guide.org/Books/#Schreier-2004

Yawei
Back to top
 
 
View Profile   IP Logged
singh
Community Member
***
Offline



Posts: 57

Re: sinusoida ADC output for FFT
Reply #5 - Jan 10th, 2012, 2:06am
 
ywguo wrote on Jan 9th, 2012, 5:40pm:
Singh,

Now that OSR = 128, you get one number at the ADC output when you apply an input that is 128×Fs.

If the clock frequency is Fclk, and Fclk = OSR × Fs. Just apply a sine wave at the input. The input signal frequency is
Fsig = Fclk × n / 2m.

n is a odd number so that n and 2m are coprime numbers. Then do 2m-point FFT with the ADC output data.

Choose a big enough number for 2m so that the frequency bin is small enough to identify signal, distortion, and noise.

You need to read a book named Understanding Delta-Sigma Data Converters.
http://www.designers-guide.org/Books/#Schreier-2004

Yawei


thanks yawei for detailed explanation  :)

thank you loose electron
Back to top
 
 
View Profile   IP Logged
singh
Community Member
***
Offline



Posts: 57

Re: sinusoida ADC output for FFT
Reply #6 - Jan 10th, 2012, 7:34am
 
ok..i was able to plot output sinusoidal plot for ADC (fig 1 attached)

input f = 15
sampling f = 2^14
no of samples = 2^14
i tried to plot FFT for that but i get too many harmonics (fig 2 attached)..

is it fine becoz wen i calculate SNR of output it comes around 4.416 dB.sometime i think i am calculating it wrong becoz by seeing the picture it doesnt seem bad? please let me know the script to calculate power and SNR?
and also how to suppress the first  bin before the fundamental as i had to put dc offset in my input sin function due to which thr is one peak before fundamental peak?
Back to top
« Last Edit: Jan 10th, 2012, 10:08am by singh »  

fftout_noiseflag_enable.png
View Profile   IP Logged
loose-electron
Senior Fellow
******
Offline

Best Design Tool =
Capable Designers

Posts: 1638
San Diego California
Re: sinusoida ADC output for FFT
Reply #7 - Jan 10th, 2012, 3:38pm
 
The noise floor is 120dB down from the carrier.


Why do you say that the harmonics are too large?
Back to top
 
 

Jerry Twomey
www.effectiveelectrons.com
Read My Electronic Design Column Here
Contract IC-PCB-System Design - Analog, Mixed Signal, RF & Medical
View Profile WWW   IP Logged
Dan Clement
Community Member
***
Offline



Posts: 95
Salt Lake City, Utah, USA
Re: sinusoida ADC output for FFT
Reply #8 - Jan 10th, 2012, 6:47pm
 
Maybe if you zoom in you see some spectral leakage that looks like distortion?  Maybe play around with different windows?

It's hard to tell since all the frequencies are there. Maybe include one with a zoomed in region near the fundamental.

Matlab has some built in functions for calculating SNR doesn't it?  If not most circuit textbooks explain the theory.
Back to top
 
 
View Profile   IP Logged
singh
Community Member
***
Offline



Posts: 57

Re: sinusoida ADC output for FFT
Reply #9 - Jan 11th, 2012, 1:49am
 
loose-electron wrote on Jan 10th, 2012, 3:38pm:
The noise floor is 120dB down from the carrier.


Why do you say that the harmonics are too large?


i was calculating SNR wrong (4.046 dB) which is weird seeing this fft plot....thats why i was wondering..now i have fixed that and got SNR around 98 dB for 16 bit with 255 OSR

now i have one doubt regarding measuring total harmonic distortion  as from the definition given in (page 6) :
http://www.analog.com/static/imported-files/tutorials/MT-003.pdf

suppose my fundamental peak bin is 7 ,so do i need to measure sum of five highest harmonic (distortion D) power values after fundamental or  i need to measure harmonics at bin 14,21,28.... and then get it divided by signal power?
Back to top
« Last Edit: Jan 11th, 2012, 5:18am by singh »  

FFT_001.png
View Profile   IP Logged
raja.cedt
Senior Fellow
******
Offline



Posts: 1516
Germany
Re: sinusoida ADC output for FFT
Reply #10 - Jan 12th, 2012, 1:34pm
 
seems all your harmonics are in the same level (more or less)??
Back to top
 
 
View Profile WWW raja.sekhar86   IP Logged
ywguo
Community Fellow
*****
Offline



Posts: 943
Shanghai, PRC
Re: sinusoida ADC output for FFT
Reply #11 - Jan 15th, 2012, 10:22pm
 
Hi Sing,

You need to sum all harmonics at bin 14, 21, 28 ...

There are not any distinguishable harmonics in the FFT plot, I mean that all harmonics are below the noise floor. But it is correct to sum all harmonics which are integer multiples of signal frequency. Of course only the sum of the first few harmonis, saying 10 or 20 harmonics.

Yawei
Back to top
 
 
View Profile   IP Logged
singh
Community Member
***
Offline



Posts: 57

Re: sinusoida ADC output for FFT
Reply #12 - Jan 17th, 2012, 8:03am
 
Hello,

i was just wondering how i can see the power spectral density of the output of ADC...i mean signal and noiseshaping spectrum from the output of the ADC ( signal at low frequency and noise curve thrown at high frequency)

if i apply FFT tothe output code,i get the picture posted above.

how shud i do that?
Back to top
 
 
View Profile   IP Logged
ywguo
Community Fellow
*****
Offline



Posts: 943
Shanghai, PRC
Re: sinusoida ADC output for FFT
Reply #13 - Jan 18th, 2012, 10:36pm
 
I thought there was a decimation filter in your ADC. Could you please show a block diagram of your ADC? -- Yawei
Back to top
 
 
View Profile   IP Logged
singh
Community Member
***
Offline



Posts: 57

Re: sinusoida ADC output for FFT
Reply #14 - Jan 19th, 2012, 6:24am
 
ywguo wrote on Jan 18th, 2012, 10:36pm:
I thought there was a decimation filter in your ADC. Could you please show a block diagram of your ADC? -- Yawei



i am using ADC architecture attached in the link. yes there is filter (accumulator + counter). it is initialized before every conversion.
suppose y is filter output and xx(i) contains comparator outputs for n cycles
y = 0;
for i = 1 to n
  y = y + xx(i);
end
output_ADC = y;

now how i check my output spectrum if i remove this filter function? if i remove my filter functionality, I will just have compartor output values and output voltages of the integrators? how i see the spectrum of both signal and noise together?
Back to top
 
View Profile   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.