What exactly does the iPhone accelerometer measure?

gigahari picture gigahari · Feb 15, 2012 · Viewed 7.1k times · Source

The apple documentation for UIAcceleration class says,

"When a device is laying still with its back on a horizontal surface, each acceleration event has approximately the following values:
x: 0
y: 0
z: -1
"

Now, I am confused! How can the acceleration be non-zero, when you clearly say the "device is laying still"?

UPDATE

Judging by the responses, I think this should be called something like 'forceometer' or 'gravitometer' and not accelerometer!

Answer

bensnider picture bensnider · Feb 15, 2012

You get a -1 on the Z axis because gravity is acting on the device, applying a constant acceleration of 1G. I assume you want user acceleration, which you can get from the DeviceMotion object using a device motion handler as opposed to an acceleration handler. The userAcceleration property filters out the effects of gravity on the device and only gives you how much the user is accelerating it.