In a smart phone, there are three sources of sensory information that seem all telling us something about orientation: accelerometer, gyroscope, and compass. But what’s the difference?
In terms of what information they give,
- accelerometer: if you calculate the resultant force of the phone (using Newton’s second law F = ma), then minus the gravity (mg), and calculate an acceleration value ((F – mg) / m): that is the value obtained from the accelerometer (and usually it is divided by the three axes thus has three component values);
- gyroscope: while in above we assume linear acceleration, angular acceleration can be also sensed by using a gyroscoope. The best way to think of this is: gyroscope tells how a device yaw, pitch and roll;
- compass tells the phone’s orientation relative to that derived from the earth’s magnetic field.
In terms of how they work,
- accelerometer: there are so many ways to make an accelerometer. For example,  introduces one using a crystal structure that is sensitive to acclerative forces, and as a result will causes a voltage to be generated. Basically, accelerometers are pretty much self-contained units that provide ‘primitive’ sensory information pertinent to a device;
- gyroscope: the kind of gyroscope used in a device is usually the MEMS (MicroElectroMechanical System)
gyroscope which uses the Coriolis effect to measure angular accelerations . It is also a self-contained unit;
- compass can be made of a magnetometer that determines the orientation influenced by the earth’s magnetic field . Alternatively, one can also collaborate with the accelerometer to calculate the compass information such as the AK8973 chip used on the iPhones .
I believe knowing the difference between these three popular phone sensors can help us build better mobile applications.