• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Accelerometer Problem.

Hi Friends,

I am doing some stuff with accelerometer. I am able to access this sensor using Sensor Listener service.As you all know it gives three values X,Y and Z. Now what this values are.
I got some info from google. But still I am not sure about it.

Can anyone elaborate those three values to me? I want to detect that user is walking or not? I want to detect the distance the user has walked.

Please Help.
No, it values is linerar accelerations witout earth gravity. So, if devise lie in surface, it make the reaction force (RF). RF=-gravity. Accelerometer calculate this force. If user is walking (speed of device changed), values has changed too. You can integrate it values and get device speed in any time. You can get moving distanse (get integral of speed).
Math workflow:
1)Get accelerometer values
2)Calculate total accelerate: T=sqrt(x*x+y*y+z*z)
3)Get additional total accel. : A=T-gravityEarth (also, gravity_earth is total accelerate, if device don't move)
4)Integrate A and get speed
5)Integrate speed and get distanse
Upvote 0
Physics also states that when an object has a constant velocity, it's acceleration is zero.
Yes, but accelerometer detecting all forces without (!) gravity force. If device sits on surface, then
(RF+Rubbing force)=-gravity force and total acceleration is 0. But for acceleromets situation looks otherwise: it don't detect gravity force and calculate only other forces, that != 0.

Look at this 2D draw for undestrand accelerometer values meaning:
Upvote 0


We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.