I wanted to use an accelerometer or IMU to measure speed and displacement over a period of about 1 minute or 400m. From this answer I found at stackoverflow, the error propagates at a rate of \$t^2\$ (without considering the rotation), so \$60^2 = 3600\$.

The noise density of the ADXL335 accelerometer is about \$200 μg / \sqrt{Hz}\$, so @500Hz we get $$\dfrac{200}{\sqrt{500}} = 87.67 μg\ (\mathrm{or}\ \ 87.67 \times 10^{-6} m/s^2)$$

Getting the error over the 60 seconds: \$87.67 \times 10^{-6} \times 3600 = 0.32m\$.

This looks suspiciously optimistic, Am I correct, or am I doing bad calculations?

  • 4
    \$\begingroup\$ You have forgotten to take the square root of 500Hz. and 1e-6 g is NOT 1e-6 m/s^2. g is equal to 9.81 m/s^2. \$\endgroup\$
    – Blup1980
    Feb 20, 2015 at 12:34
  • \$\begingroup\$ A little over a year later did you produce any promising results or is it decided that this was a fool's errand? If so I'm on the same errand... \$\endgroup\$
    – Jacksonkr
    May 19, 2016 at 13:33
  • 1
    \$\begingroup\$ @Jacksonkr I've abandoned the idea and just recently returned back at it. For now I'm just using the accelerometer for simple measurements like detecting if a person is active or idle, the acceleration of a puch or kick and counting the number of someone's steps. I'll let you know if I manage to find some way to know the speed or displacement. For now to closest work I could find, open to the public, was this one, using an IMU, a sensor fusion algorithm and correcting the integral drift every time the foot hits the ground (v=0m/s): x-io.co.uk/gait-tracking-with-x-imu \$\endgroup\$
    – Rui Lima
    May 19, 2016 at 14:21
  • \$\begingroup\$ @RuiLima I stumbled on that video in my research and it's the most promising footage (pun) I've seen yet. Impressive! Thanks for the link and I've starred your github code. Certainly I'll reach out to via your website if I find anything promising. \$\endgroup\$
    – Jacksonkr
    May 19, 2016 at 14:27

3 Answers 3


I have tried to do this, with an iPhone’s accelerometer/gyroscope, and can empirically tell you there will be many orders of magnitude more error than that.

Your statement “without considering rotation” is an important one, as this is a huge factor. One of your difficulties will be removing the gravity vector from the integration. If the accelerometer is tilted even slightly, gravity will introduce a large error in each axis.

In my experiment, I was trying to make an iPhone into a 3D cursor a user can wave around in their hand for 3D modelling. It would drift off in random directions at a rate of centimetres per second. Lots of low pass filtering helped this a bit, but it was still way off.

My point is, even if your accelerometer has low noise, in the real world this is a very difficult problem to solve as there are many other sources of ‘noise’.

I recommend you go buy a commercially produced IMU if you want any chance of achieving this over 400m. I will be impressed if you can make an accelerometer work alone, over a distance of 400m with less than ±1km error.

  • \$\begingroup\$ Do I need to preform sensor fusion between the accelerometer and the gyroscope? \$\endgroup\$
    – Rui Lima
    Feb 20, 2015 at 12:56
  • 1
    \$\begingroup\$ @equidna Yes. But noise on sensors will still be horrible. Good accelerometers costs more than whole smartphone. Bundling additional sensors can help, but it will be still limited to obtaining direction with rough estimate of speed. Depending on platform you may have access to ready to use functions, for example Motion API on WP8 (dropped on 8.1 for some reason). \$\endgroup\$
    – PTwr
    Feb 20, 2015 at 13:38
  • \$\begingroup\$ Just to make sure: only using filters to remove the gravity and impact noise from the accelerometer is not workable? \$\endgroup\$
    – Rui Lima
    Feb 20, 2015 at 14:23
  • 1
    \$\begingroup\$ @equidna: For walking there are apparently some good heuristics for doing sensor fusion. See the paper ais.informatik.uni-freiburg.de/publications/papers/… The trick is the ”Zero Velocity Update” (ZUPT) technique: "In each step during normal walking, there exists the so-called still phase, a time period when the foot is not moving relative to the ground. Ojeda et al. showed that the velocity value should be reset when the still phase is detected. We found experimentally that the best indication for the still phase can be obtained by observing the gyroscope data." \$\endgroup\$ Feb 21, 2015 at 1:21
  • \$\begingroup\$ I've read some work about that: youtube.com/watch?v=6ijArKE8vKU. But my intention was to use the sensor for running and not for walking. \$\endgroup\$
    – Rui Lima
    Feb 21, 2015 at 11:47

I have been working seriously (hundreds of hours) on a related problem periodically for nearly three decades now without success - so the "Fool's Errand" description in my case would appear to be empirically apt.

Even if the conditions at both the start and end of the integration are perfectly known, the inconsistent variations in the individual reading errors prevent accurate calculation of the conditions at the intermediate points.

Of course, if the reading errors were constant, or if they occurred in constant proportion to the readings, then their exact calculation (and compensation) could be readily achieved. Even if the readings simply conformed to some known probability distribution, then their close approximation and reasonable compensation could be achieved.

But alas, none of these simplifying possibilities appears to be true. So, like those seeking immortality in pursuit of Goldbach's Conjecture, we relentless investigators into the Double Integration Error conundrum will continue our (foolish) search for its golden key.


At the very least, for horizontal movement your measurement requires that the accelerometer axis be perfectly horizontal. Any vertical deviation will produce an apparent error due to accelerometer measuring part of the earth's gravitational field. And how close does it have to be? Let's take the accelerometer noise number of 87.7 ug as the baseline. Then for a deviation angle A, the measured error will be sin A, and you need to solve for A = arcsin(.0000877). This, of course, is easily done, and the answer is:

.005 degrees.

So trying to make your measurement with a single accelerometer axis requires extraordinary setup precision, and I think you need to find a different approach.

  • \$\begingroup\$ I was considering using a 3 axis accelerometer, then after the measurment, do a vector sum of the 3 axis values along the time frame, use an high-pass and low pass filter to remove the gravitational noise and impact noise (like a foot hitting the ground) and then double integrate the acceleration in order to get the velocity and displacement. From the feedback I'm getting it looks like it's impossible, nevertheless I feel the urge to test this and see it with my own eyes, on the other hand I don't want to be an obsessive tinker working on a dead end. \$\endgroup\$
    – Rui Lima
    Feb 20, 2015 at 17:48

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.