cancel
Showing results for 
Search instead for 
Did you mean: 

MEMS ACCELEROMETER LSM6DSV16X Remove Gravity

FilipeLourenço
Associate II

I am using steval mkbox-pro with FP-SNS-DATALOG2 to get acceleration from the subway train.

How can i remove the gravity effect in measurements from the LSM6DSV16X accelerometer?

 

1 REPLY 1
Andrea VITALI
ST Employee

The simple but inaccurate way is to apply an high-pass filter which removes the DC component (the mean value), usually associated with gravity. This works very well if motion is high frequency. Less well if motion is low frequency and near DC.

High-pass filtering can be achieved by subtracting the output of a low-pass filter, a moving average would work fine. Moving average is the mean of the samples in a sliding window. It can be efficiently implemented with constant complexity independent of the window length - see attached implementation example - a circular buffer is maintained and output is updated by just subtracting the sample going out of the window and adding the new sample entering the window.

The more complex but very accurate way is to use sensor fusion and subtract the estimated gravity vector. Check the MotionFX library in the X-Cube-MEMS software package.