Question

I'm testing the DeviceMotion event on Android and I plot the values on a graph. Since they are values of acceleration (without gravity), if the device is at rest then the values should technically be zeros. However when I plot them out on a graph it doesn't seem to be the case:

enter image description here

http://jsfiddle.net/DerekL/Hgxde/17/show

As you can see, accz is most of the time -0.7 while the others are near 0. Also they don't seem to be the correct acceleration values. If you look at the values near t=0 they are not at 0 while the device isn't actually moving. Why is this happening and how can I "fix" this?

Was it helpful?

Solution

I assume that Z axis is -0.7 because the software makes the assumption that Earth's gravity is 9.8 (which is true on average at sea level). However the sensor is measuring 9.1 so the difference is 0.7 less (roughly 7% less).

Though it's true that Earth's gravity varies (see: http://en.wikipedia.org/wiki/Gravity_of_Earth) the maximum variation is around 0.7% comparing the very low gravity on top of mountains against the unusually high gravity at the Arctic Ocean.

From that wikipedia page we find the equation:

gh = g * square(r/(r+h))

/* gh = gravity at h
 * h = height
 * r = earth's radius
 * g = earth's gravity
 */

Rearranging the formula we get:

h = r/sqrt(gh/g) - r

Calculating for your measured gravity (after fiddling with braces) I plugged this in to google:

(radius of earth / sqrt((9.1m/(s^2))/earth gravity)) - radius of earth

And google returns the result: 243.012479 kilometers

For comparison, LEO satellite orbit starts at 160km. So you're either in space or your Android device is not calibrated. I'm guessing the second because if you are in space you'd be in free fall and your device should read close to zero gravity instead of 9.1.

As for the small movements. Well, unless you've isolated your device completely from the ground most modern MEMS accelerometers are sensitive enough to pick up the traffic of cars outside or people walking in the room. Then again if your Z axis is not calibrated I wouldn't be surprised if your other axis are reporting errors as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top