Showing results for 
Search instead for 
Did you mean: 

Hi, I am using MotionDI library to acquire linear acceleration of my device. However, I do not get zero acceleration even when my device is at rest. Does the linear acceleration in MotionDI library includes the effect of gravitational acceleration?

Associate II
Petr S
ST Employee


  1. What values do you get?
  2. What values do you expect?
Associate II

Hi Petr,

In the image attached, I get non-zero accelerometer values till sample number 491. This makes sense as I have kept the sensortile kit in motion. However, after sample # 491, the acceleration values are not correct because my sensortile kit is stationary (expecting no acceleration) and I still get non-zero acceleration along the 3 axis. Why is that so? Please throw some light on this issue.


Petr S
ST Employee

Could you please send me your datalog for simulations? The one you displayed in graphs would be perfect.

Associate II

Hi @Petr S_O​ ,

Sorry for the late response. I have re-plotted the graphs with the same type of movement. I rotated the sensortile kit both clockwise and anticlockwise and then left it stationary after 400th sample. Please see attached graphs and corresponding datalog given in excel file. I look forward to your response. Thank you.


Associate II

Hi Community Members,

Any guidance related to the issue will be appreciated. Looking forward to your responses.

Petr S
ST Employee

Thanks for the datalog, but I need also the timestamp, accelerometer and gyroscope output data, not only the calculated values. Attached is the example of datalog format that would help.

Hi @Petr S_O​ 

I am using Motion_DI Library for ISM330DLC sensor and getting some output. How can i validate that data and could you please log the data for longer period by changing it's positions and send us for reference. As in the above data is logged for less than 1 second. 0693W00000Nrhd9QAB.jpg In above pic i have logged the Yaw,Pitch,Roll. data when the sensor is in steady position.

Thank you.

Martin B
Associate III

MEMS accelerometer sensor is based on sensing mass micro-element movement and position inside sensor component body. Movement of micro-element is caused by acceleration of sensor component.

This means, while in still position, only gravitation acceleration does apply to sensor component and thus the total acceleration vector is equal to gravitation acceleration of typical value:

1 g == 9.81 m/s^2

Rotation itself does not change acceleration vector size only its direction (with respect to sensor component). On contrary the linear movement adds linear acceleration vector to total acceleration vector and changes size and usually direction of resulting acceleration vector.

Looking to Datalog.xlsx data you have sent it seems XYZ acceleration data are raw accelometer data converted from [mg] units to [m/s^2] units.

Calculating magnitude of acceleration:

acc = sqrt(acc_x ** 2  +  acc_y ** 2  +  acc_z ** 2)

for all values the results are as follows:

  1. For sample number <= 400 the acc differs from expected typical value 9.81 m/s^2. This is most probably caused by manual rotation of sensor component, where any parasitic linear movement adds to total acceleration. Linear movement can be result of any unwanted linear movement while manually (by hand) rotating device, but it can be also caused by pure rotation, where sensor compoment is not positioned on axis of rotation.
  2. For sample number > 400 the acc is close to expected typical value 9.81 m/s^2. The device is in still position and this is correct value.

In case real linear acceleration results (i.e.: without gravity vector) are needed, there is output of 

MotionDI library - linear_acceleration:

typedef struct
  float rotation[MDI_NUM_AXES];            /* 6 axes yaw, pitch and roll */
  float quaternion[MDI_QNUM_AXES];         /* 6 axes quaternion */
  float gravity[MDI_NUM_AXES];             /* 6 axes device frame gravity */
  float linear_acceleration[MDI_NUM_AXES]; /* 6 axes device frame linear acceleration */
} MDI_output_t;

See also results from DynamicInclinometer application based on MotionDI library (screenshot taken from Unicleo-GUI:(


  • Device is tilted and placed on desk
  • Linear acceleration is close to zero