3

I want to find distance traveled and velocity from accelerometer events. Like iphone's gMeter application is doing.

Any suggestion, by which value or formula I should use for that?

Thanks in advance.

Ruchir Shah
  • 898
  • 3
  • 13
  • 31

1 Answers1

9

You can use the acceleration values from the accelerometer to measure the velocity and distance. There is really good paper (Implementing Positioning Algorithms Using Accelerometers) which explains the errors you get from the accelerometer and the techniques to get the velocity and position from the acceleration values.

Some pseudo code:

velocity[i] = (acceleration[i] + acceleration[i-1])/2 * interval + velocity[i-1] distance[i] = (velocity[i] + velocity[i-1])/2 * interval + distance[i-1]

interval is the time between acceleration/velocity[i] and acceleration/velocity[i-1] which is related to the update frequency of the accelerometer.

To increase accuracy you have to filter the acceleration values in the forehand. I've implemented such an algorithm on an iPhone 3GS and it worked pretty good. The accelerometer let's you measure distances of 30 cm with an error of approximately 1 cm. I didn't tested longer distances yet.

brutella
  • 1,597
  • 13
  • 26
  • If I understand this properly, you'd have to keep track of static acceleration from Earth's gravity since the device's physical orientation could change. Throwing it through the air would cause it to tumble, changing "down". I'm not sure if my interpretation of this is right, but I think the single "calibration" described in the paper assumes a constant orientation of the device. – Joshua Nozzi Oct 19 '11 at 21:14
  • That's right, this approach assumes that the device's orientation doesn't change during the movement. – brutella Oct 20 '11 at 17:49
  • @brutella could you please provide your algorithm? – David Seek Apr 26 '16 at 13:39