2018-06-20 02:57 AM
Solved! Go to Solution.
2018-06-20 03:52 AM
Posted on June 20, 2018 at 12:52
Hello,
FFT works on sinus signal. For 25Hz square, you have (theoretically) unlimited number of frequencies with different amplitudes.
In general, FFT input must be 2^n samples and you will also receive back 2^n samples. These samples are mirrored by center frequency between 0 and sampling frequency, which means that your 'useful' data are only between 0 and Fs / 2. Result of FFT is not frequency number. You have to interpret your result properly to decide where to find your frequency.
Example:
Sampling frequency Fs = 45kHz
Number of samples for FFT calculation FFT_SIZE = 1024
Calculations:
Frequency resolution on output = Fs / FFT_SIZE = 45000 / 1024 = ~44Hz. You can detect frequency of [0, 44, 88, etc..., 45000-44] Hz
Useful data = FFT_SIZE / 2, which means frequency bands from [0, 44, 88, ..., 45000/2 - 44] Hz
If you are interested in result at 88Hz, you have to check output[2] array value. output[0] is equal to DC value in signal.
Very fast and very basic. You have to take care now that your ADC sampling is really 45kHz and then interpret FFT result properly.
Best regards,
Tilen
2018-06-20 03:52 AM
Posted on June 20, 2018 at 12:52
Hello,
FFT works on sinus signal. For 25Hz square, you have (theoretically) unlimited number of frequencies with different amplitudes.
In general, FFT input must be 2^n samples and you will also receive back 2^n samples. These samples are mirrored by center frequency between 0 and sampling frequency, which means that your 'useful' data are only between 0 and Fs / 2. Result of FFT is not frequency number. You have to interpret your result properly to decide where to find your frequency.
Example:
Sampling frequency Fs = 45kHz
Number of samples for FFT calculation FFT_SIZE = 1024
Calculations:
Frequency resolution on output = Fs / FFT_SIZE = 45000 / 1024 = ~44Hz. You can detect frequency of [0, 44, 88, etc..., 45000-44] Hz
Useful data = FFT_SIZE / 2, which means frequency bands from [0, 44, 88, ..., 45000/2 - 44] Hz
If you are interested in result at 88Hz, you have to check output[2] array value. output[0] is equal to DC value in signal.
Very fast and very basic. You have to take care now that your ADC sampling is really 45kHz and then interpret FFT result properly.
Best regards,
Tilen
2018-06-20 07:23 AM
Hello
Majerle.Tilen
,Thank you for the instant help.
Understood & got the output correctly.
2018-06-21 05:43 PM
Hello,
you may want to read post on link below:
https://community.st.com/0D50X00009bMMAwSAO
Best regards,
Tilen
2019-09-17 06:17 AM
hi bro. I'm studying about that. Can you give me your project after fix this problem. Thanks so much !!!