Currently I am working on one project that includes 24 Bit external MCP3919 and MCP3914 ADCs and Tiva C series 32 Bit MCU. I am trying to calculate harmonic values of input signal.

I am using CMSIS DSP Library in Code Composer Studio. FFT functions are working great I have no problem with implementation of these functions. I tested them with internal generated sin signal and modulated it. Results are expected.

  • ADC_Output : 3255 Hz
  • FFT_Size : 64 point
  • Window_Size : 2*FFT_Size

I have a problem that when I read real world signal from signal generator, my FFT bins are changing with time in n*50Hz signals. When I increase the input signal to 50.9 Hz there is no problem. It is same with 150Hz, 250Hz, 350Hz. It seems like there is fixed frequency error related with 50Hz.

For example : FFT functions work great with 50.9 Hz signal instead of 50Hz (1*0.9Hz) 152.7 Hz signal instead of 150 Hz ( 3*0.9Hz) 254.5 Hz signal instead of 250 Hz (5*0.9Hz)

I am sharing my FFT Bin graphs enter image description here

                       **Fig1 : 50.0 Hz and 250.0Hz**

enter image description here

                    **Fig2 : 50.9 Hz and 254.5Hz**

As a result, with frequency changing FFT bins are true. I need your experiences with this issue.

Thanks in advance


  • \$\begingroup\$ 50Hz multiples sounds suspiciously like power line feedthrough - is your signal generator mains powered? (I am assuming you are in a country with a 50Hz power line). The specific signal generator model might help us understand. \$\endgroup\$ Apr 30 '16 at 13:59
  • \$\begingroup\$ Hello Peter. I am not thinking that It is related with it. Because it is supplied isolated power supply. And I observed from osciloscope too. \$\endgroup\$
    – dredg
    Apr 30 '16 at 14:54

Use a different window shape.

This happens when the input signal is not exactly periodic with input signal length, e.g. because the generated sine and the ADC clock are from different clock sources. Looking at a signal that we expect in bin 2 (\$e^{2ix}\$), and the result for bin 1:

  • If the sampling period contains exactly two signal periods: \$\int_0^{2\pi}\!{e^{2ix}e^{-ix}\ dx} = 0\$

  • If the signal is a bit lower in frequency: \$\int_0^{2\pi}\!{e^{1.99ix}e^{-ix}\ dx} = -0.063 + 0.002i\$, so quite a bit of energy is shown in this bin.

If you use a window function that reduces the weight of the beginning and end of the sampling period, you can reduce this effect.

  • \$\begingroup\$ Hello Simon. Thanks for ur reply. I am little confused. How can I do it ? Could u guide me in this case ? Regards \$\endgroup\$
    – dredg
    May 3 '16 at 8:20
  • \$\begingroup\$ Decide on a windowing function that works for your use case, if you just want to look at the data, Hamming is usually a good choice, then multiply the time domain data with the output of the windowing function before running the FFT. \$\endgroup\$ May 3 '16 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.