Skip to main content
Visitor II
November 17, 2021
Solved

FIR filter for MEMS

  • November 17, 2021
  • 1 reply
  • 1457 views

Hello,

Are there any examples for implementation FIR filter on accelerometer and gyro data with programmable cut-off frequency? It would be better if CMSIS DSP functions are used.

    This topic has been closed for replies.
    Best answer by Eleon BORLINI

    Hi @JDave.4​ ,

    In the FP-SNS-ALLMEMS1 function pack for the MEMS&Sensors, there is an example of the implementation of a FIR implementation (via CMSIS DSP on ARM Cortex), that removes high frequency signal components from the input using an FIR lowpass filter. The example demonstrates how to configure an FIR filter and then pass data through it in a block-by-block fashion. You might feed this function with the accelerometer raw data (acquired via one of the Sensors projects) instead of the sinewaves used in the example.

    You can find it in the Drivers folder, path: \Drivers\CMSIS\DSP\Examples\ARM\arm_fir_example.

    If my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster. 

    -Eleon

    1 reply

    ST Employee
    November 18, 2021

    Hi @JDave.4​ ,

    In the FP-SNS-ALLMEMS1 function pack for the MEMS&Sensors, there is an example of the implementation of a FIR implementation (via CMSIS DSP on ARM Cortex), that removes high frequency signal components from the input using an FIR lowpass filter. The example demonstrates how to configure an FIR filter and then pass data through it in a block-by-block fashion. You might feed this function with the accelerometer raw data (acquired via one of the Sensors projects) instead of the sinewaves used in the example.

    You can find it in the Drivers folder, path: \Drivers\CMSIS\DSP\Examples\ARM\arm_fir_example.

    If my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster. 

    -Eleon

    JDave.4Author
    Visitor II
    November 20, 2021

    Hi,

    I found the example. I need to calculate tilt angles from acc. values. Should the filter be applied to raw acc. values or after calculation of tilt angles?

    ST Employee
    November 22, 2021

    Hi @JDave.4​ ,

    If you need the raw data only for the tilt calculation, you should apply the filter before the data processing.

    I suggest you to follow this design tip for the formula to be used:

    You can have a look also to this example on Github for the precision inclinometer IIS2ICLX, that implements the Tilt detection via FSM.

    -Eleon