Skip to main content
Visitor II
May 5, 2021
Solved

How to calculate bin frequency after FFT?

  • May 5, 2021
  • 3 replies
  • 3653 views

The ODR of vibration sensor iis3dwb is 26667 Hz. If I set 2048 of FFT size, is the below calculation correct? Or we need to use the bandwidth 6 kHz to calculate the bin frequency. Please advise. Thanks!

0:  0 * 26667 / 2048 =    0.0 Hz

 1:  1 * 26667 / 2048 =   13.02 Hz

 2:  2 * 26667 / 2048 =   26.04 Hz

 3:  3 * 26667 / 2048 =  39.06 Hz

 4: ...

 5: ...

1024: 1024 * 26667 / 2048 = 13333.5 Hz

    This topic has been closed for replies.
    Best answer by niccolò

    I would say that, if you are working with 26kHz ODR the right calculation is the one from @Javier Muñoz​ :

    0:  0 * 13333,5/ 2048 =    0.0 Hz

     1:  1 * 13333,5/ 2048 =   7.51 Hz

     2:  2 * 13333,5/ 2048 =   13.02 Hz

     3:  3 * 13333,5/ 2048 =  19.53 Hz

     4: ...

     5: ...

    2048: 2048* 13333,5/ 2048 = 13333,5 Hz

    Niccolò

    3 replies

    Explorer
    May 5, 2021

    Should be about right : https://en.wikipedia.org/wiki/Discrete_Fourier_transform

    > Or we need to use the bandwidth 6 kHz to calculate the bin frequency.

    Not sure what that means.

    I suppose 6kHz is the BW limit of the sensor, and thus would not enter the calculation.

    JTam.1Author
    Visitor II
    May 5, 2021

    Hi Ozone, you meant that the calculation would be stopped after reaching 6kHz (460: 460 * 26667/2048 = 6kHz), right? Please advise. Thanks!

    Graduate II
    May 5, 2021

    @JTam.1​ 

    >The ODR of vibration sensor iis3dwb is 26667 Hz.

    Then youre sampling the vibration 26667 times per second,

    Nyquist law tells us : that makes your bandwidth (max rfecuency of signals you will be able to detect in theory) 26667/2=13333,5hz

    If your FFT has 2048 bins your table would be: (bins are the number of discrete divisions the fft is going to make out of your bandwith)

    0:  0 * 13333,5/ 2048 =    0.0 Hz

     1:  1 * 13333,5/ 2048 =   7.51 Hz

     2:  2 * 13333,5/ 2048 =   13.02 Hz

     3:  3 * 13333,5/ 2048 =  19.53 Hz

     4: ...

     5: ...

    2048: 2048* 13333,5/ 2048 = 13333,5 Hz

    >Or we need to use the bandwidth 6 kHz to calculate the bin frequency. Please advise. Thanks!

    why 6khz

    JTam.1Author
    Visitor II
    May 5, 2021

    Hi Javier, the datasheet of iis3dwb sensor said that it is capable of measuring accelerations with a bandwidth up to 6 kHz with an output data rate of 26.7 kHz.

    Graduate II
    May 5, 2021

    okay i got confused there, i think the datasheet missuses the word bandwidth....

    If 6khz is the sampling rate, your FFT´s Nyquist bandwidth is 3khz.

    0:  0 * 3000/ 2048 =    0.0 Hz

     1:  1 * 3000/ 2048 =   1.46 Hz

     3: ...

     4: ...

    2048: 2048* 3000/ 2048 = 3000 Hz

    Anyway at this point you should test the vibrations you read maybe with a small motor spinning at a certain speed.

    There is a LOT of different deffinitions of bandwith , thats why i think the datasheet meant sampling frecuency.

    ST Employee
    May 5, 2021

    Hi @JTam.1​ , @Javier Muñoz​ ,

    the acquisition band is actually 26.667kHz, while the "mechanical flat band" is actually 6kHz.

    This means that, modelling the accelerometer as a first order low-pass filter, the mechanical cut-off frequency is around 6kHz. You can however acquire at higher speed, mostly for a reduction noise purpose (when you perform averages on the oversampled data).

    The reason is mostly related to the mechanical characteristics of the sensor, whose flat bandwidth is determined by the internal mechanical structure of the MEMS.

    Signals above 6kHz can be acquired but will result in an appreciable attenuation.

    -Eleon

    Graduate II
    May 5, 2021

    @Eleon BORLINI​ so 6khz is the maximum rate you can sample the accelerometer before noise and non linear stuff happens?

    ST Employee
    May 5, 2021

    It's most related to the sensitivity of the signal: above 6kHz, it drops at about 20 dB/decade (linear, but not flat and decreasing). The noise attenuates too, but the overall S/N will be lower due to the drop of the sensitivity.

    -Eleon