I am trying to measure distances with the 3 axis accelerometer that is part of the LSM9DS1. I measure the acceleration in X-axis and Y-axis every 5ms and double integrate it over the time.

I can already correctly measure the movement along the X- or Y-axis with a precision of +-1cm.

The problem is that when I move the module in which the sensor is contained along one axis, the data shows me that there is also an acceleration along the other axis.

Because of this I get wrong distances when I move the module freely around the table. Has anyone experienced such behavior before and knows an answer?

The data sheet of the LSM9DS1

  • 2
    \$\begingroup\$ Have you constructed an appropriate and calibrated accelerometer response transform to deal with non-orthogonality? \$\endgroup\$
    – jonk
    Sep 26, 2017 at 22:11
  • \$\begingroup\$ Sounds like the mount is misoriented \$\endgroup\$ Jun 28, 2020 at 12:01
  • \$\begingroup\$ I’m voting to close this question because measuring distance with an accelerometer is not physically practical with cheap consumer sensors and naive integration. \$\endgroup\$ Jun 28, 2020 at 14:50

2 Answers 2


Sensors will not always provide ideal behaviour. Each accelerometer that is manufactured would give slightly different results for the same scenario, due to the unique physical characteristics of each. To get accurate results you really need to calibrate each sensor individually. This requires testing under different conditions.

The issue you are facing is due to what is called cross-axis effect. This is the tendency of a value on one axis to affect the output of another. This is generally caused by an imperfect alignment of the sensor axes during manufacture. This is inevitable, as perfect orthogonality is nearly impossible to achieve. There is no way to correct this by modifying the sensor - the only way to compensate for this is to perform calibration testing to determine how much values on each axis impact one another and adjust the outputs accordingly.

You may also want to look at another method of obtaining displacement rather than simply double integrating, as this can produce extremely large errors over time and distance and can result in a large velocity and displacement drift.


Start by calibrating your sensors, rotate the sensor around all 6 orientations to correct the span and zero, you can also use the 45 degree marks if you feel there is an odd curve, this will remove drift and reduce gain errors

Next up a partial solution is usually making use of a gyroscope to subtract any accelerations imparted by rotation, or at minimum to keep track of which way is down for your vector sums, so even if the sensor is rotated slightly, you still can calculate the actual displacement over a given axis

Last part would be some kind of yard stick, the MEMS sensors are accurate over short time frames, but have to rely on other means over time frames close to a minute, as the small errors all integrate to one big error, some solutions make use of multiple accelerometers to allow for confidence based drift and noise cancellation.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.