12

I am just a beginner in the application development industry. I know the accelerometer can be used to return the current acceleration along three axis in meters per second squared (m/s2). But I have come to know that an accelerometer can also be use as speedometer.

I want to know how I can use accelerometer to determine distance traveled by Android device between points of interest. If it is possible, then how can I implement it? I have seen a similar question "how do I measure the distance traveled by an Iphone using accelerometer" How do I measure the distance traveled by an iPhone using the accelerometer?. But I didn't come to a point.

Thank You, Arslan

Community
  • 1
  • 1
Dr. Arslan
  • 1,254
  • 1
  • 16
  • 27
  • 1
    possible duplicate of [How can I find the velocity using accelerometers only?](http://stackoverflow.com/questions/6085583/how-can-i-find-the-velocity-using-accelerometers-only) – Aleadam Jun 15 '11 at 04:31

2 Answers2

35

You get position by integrating the linear acceleration twice but the error is horrible. It is useless in practice.

Here is an explanation why (Google Tech Talk) at 23:20. I highly recommend this video.

Similar questions:

track small movements of iphone with no GPS
What is the real world accuracy of phone accelerometers when used for positioning?
how to calculate phone's movement in the vertical direction from rest?
iOS: Movement Precision in 3D Space

Community
  • 1
  • 1
Ali
  • 56,466
  • 29
  • 168
  • 265
  • Thank you Ali its of great use – Dr. Arslan Jun 16 '11 at 05:15
  • Is it possible to detect motion and wakeup from sleep ? I have mediatek device which has no "significant motion" sensor (according to sensors detect apk), yet, it has built in feature which turn on screen on movement. How can it be ? – ransh Jan 25 '17 at 06:08
  • @ransh Measuring distance is difficult. Detecting movement is easy: You only have to detect that the changes in the output of the sensor is above a pre-configured threshold. You do not need to measure distance to detect movements; it is much much simpler. – Ali Jan 25 '17 at 09:56
  • my problem concerns mainly power save. if cpu does not sleep in between sensors event then it's a problem. – ransh Jan 25 '17 at 10:13
  • @ransh Please look at the title of this question: "How to use Accelerometer to measure distance for Android Application Development". You only want to detect movements, and you are concerned with power save. What you are asking is a totally different question, and we therefore should not discuss this here in comments. If you have a new question then please post a new question. – Ali Jan 25 '17 at 11:13
4

You can combine it with GPS positioning, and filter data with Kalman filter. GPS give rough but stable position, while accelerometer give more accerate but drifting position.

vitperov
  • 1,347
  • 17
  • 20