1kHz DDS FFT sub-first harmonic?

Thread Starter

upand_at_them

Joined May 15, 2010
766
I have a microcontroller generating a 1kHz sine. The FFT screenshot is below. There's a peak at 1kHz, of course. And there's a trough at 500Hz for some reason. And there's large content below 500Hz? I'm confused.

-MikeNewFile0.PNG
 
Last edited:

MrChips

Joined Oct 2, 2009
23,531
I have a microcontroller generating a 1kHz sine. The FFT screenshot is below. There's a peak at 1kHz, of course. And there's a trough at 500Hz for some reason. And there's large content below 500Hz? I'm confused.

-Mike
There is no trough.
Try changing your frequency scale to 200Hz/div.
 

MrChips

Joined Oct 2, 2009
23,531
No. The value at the “trough” is higher than the background noise above 1kHz.

Look at the 0Hz level. Now extrapolate as if there were no 1kHz signal. You will see there is no trough.

Your resolution is very poor. You need to sample for a longer period.
One cycle of 1kHz is 1ms. You have only captured half a cycle. Hence the FFT is showing the large DC component.
Reduce your sampling rate to about 10ksps and sample for at least 100ms.
 

Papabravo

Joined Feb 24, 2006
16,157
No. The value at the “trough” is higher than the background noise above 1kHz.

Look at the 0Hz level. Now extrapolate as if there were no 1kHz signal. You will see there is no trough.

Your resolution is very poor. You need to sample for a longer period.
One cycle of 1kHz is 1ms. You have only captured half a cycle. Hence the FFT is showing the large DC component.
Reduce your sampling rate to about 10ksps and sample for at least 100ms.
I sure am glad that you can see that detail on the image. Wish I could.
 

Thread Starter

upand_at_them

Joined May 15, 2010
766
Not much adjustability for the sampling in this entry level scope; scale and sampling rate are linked. I think the issue is due to me using the "Hanning" window? Sorry for the resolution; the scope takes small screen captures.
 

MrChips

Joined Oct 2, 2009
23,531
Show us the waveform of the signal.
Make sure that the amplitude of the signal is not so high that the waveform clips on the screen.
 

MrChips

Joined Oct 2, 2009
23,531
All your pictures look correct. The last one has a scale of 125Hz/div which shows the best FFT so far because the duration is longer (2ms).
You need to increase the sampling duration to 10ms (go to lower sampling frequency) and go to a higher scale (e.g. 500Hz/div) in order to see the higher harmonics.
What is your sampling rate?

Your signal has a large DC offset.
Set your CHAN 1 input coupling to AC to remove the DC component.
 

Thread Starter

upand_at_them

Joined May 15, 2010
766
Hi MrChips,

Thanks for helping on this. I'm trying to understand it so I can characterize any signal generation that I do in the future. For now, the signal is a 50-step DAC sine @ 50kHz steps, so 1kHz sine. It ranges from 0V to 3.6V. I put it at the top of the screenshot for clarity. I've not done any filtering yet and there is, of course, is an FFT peak at 50kHz.

Sampling rates are on the screen captures. Perhaps too small to read?

Switching to AC coupling does remove some of the sub-1kHz stuff, but I'm still confused by this screenshot which shows peaks at 500, 1000, 1500, and 2000Hz. The 1000Hz is the desired signal, and I can understand the 2kHz harmonic, but an confused by the 500 and 1500Hz, which would be "null" points on the sine wave.

NewFile0.PNG
 

bogosort

Joined Sep 24, 2011
674
From your description, it seems like you're using a PWM output and not a proper DAC, but in either case you need to have a low-pass filter after the output. Otherwise, the output signal will be filled with harmonics at integer multiples of the output's sample rate. In turn, these harmonics can cause frequency aliasing in your scope's ADC, which may be what you're seeing. As a first attempt, try putting a 100 Ω resistor in series with the output across a 1 μF capacitor to ground.

Also note that you should be seeing DC in the output, as your signal varies from 0 to 3.6 V. Putting your scope in AC mode is just hiding this fact.
 

bogosort

Joined Sep 24, 2011
674
It's a DAC, not PWM. I know I need an LPF, but I wanted to understand the FFT analysis.
A DAC is not actually a DAC without the LPF, which is an essential part of the conversion. DACs are just fancy switches (digital), and the output of an unfiltered DAC is a stair-step signal. DACs cannot produce smooth curves without a LPF. Each step transition in the output contains very high frequencies that don't exist in the original signal, they are artifacts of the conversion process.

Worse still, your scope has an ADC with a Nyquist frequency determined by the sample rate. At 25 kSPS, the high frequency content in the stair steps of the 50 kHz DAC output will cause your scope's ADC to alias, i.e., produce in-band difference frequencies that don't exist in the original signal.

The FFT of an unfiltered DAC is useless, except perhaps as a demonstration of why every DAC requires at least one LPF on the output. :)
 

andrewmm

Joined Feb 25, 2011
1,473
@upand_at_them This might be of interest to you
https://training.ti.com/sites/default/files/docs/TIPL4705 - DAC Output Response.pdf

It shows the output of a DAC is whats called a sinc waveform, that in theory goes up to infinity,
you need a "sinc" filter to select which of the nyquest zones you want, and normally to compensate for the none flat response of the DAC.

If you want frequencies any where near the nyquest frequency, you need a fairly good filter,
but if you are working up to say 1/4 the nyquest , then a simpler filter can be used.
 
Top