Skip to main content
Visitor II
April 25, 2022
Question

LSM6DSM gravity calculation

  • April 25, 2022
  • 1 reply
  • 911 views

Hi,

I am testing the accelerometer and can see that it also measures the acceleration caused by gravity.

Is there a setting or way to filter gravity out from the reading?

If there is any calculation, could you please share us the same for with gravity and without gravity?

Thanks,

Akshay

    This topic has been closed for replies.

    1 reply

    ST Employee
    April 29, 2022

    Hi Akshay @ANaik.2​ ,

    you can remove it in post processing, or by apply internal HP filter (or in reference mode, being sure to be flat at time0 to read the correct gravity vector), if you are not interest in your application in the DC component of the acceleration.

    For the reference mode, see the AN4987 application note at p.14:

    The reference mode feature is available for the accelerometer sensor: when this feature is enabled, the current X, Y, Z accelerometer sample is internally stored and subtracted from all subsequent output values. In order to enable the reference mode, both the HP_REF_MODE bit and the HP_SLOPE_XL_EN bit of the CTRL8_XL register have to be set to 1, and the value of the HPCF_XL[1:0] field has to be different than 00b. When the reference mode feature is enabled, both the LPF2 filter and the HP filter are not available. The first accelerometer output data after enabling the reference mode has to be discarded.

    -Eleon

    ANaik.2Author
    Visitor II
    May 4, 2022

    Hi Eleon,

    "you can remove it in post processing"

    As mentioned in the above response, could you please explain on how can we do it post processing?

    Could you please explain the steps for the same?

    Regards,

    Akshay