What is the difference between a 3-axis gyroscope, 3-axis accelerometer and 3-axis magnetometer? How do these sensors work? Why are all 3 used in some devices like smartphones, tablets, quadcopters etc.?

up vote 49 down vote accepted

They are three sensors that are useful for determining position and orientation, but they measure different things.

  • A magnetometer measures magnetic fields. Because the earth has a significant magnetic field, the magnetometer can be used as a compass. As such it is useful to determine absolute orientation in the NESW plane.
  • An accelerometer measures accelerations. This is useful to measure changes in velocity (directly, as the acceleration is the first time derivative of the velocity) and changes in position (by integrating the signal). They are usually used for measuring small movements. Also note that gravity acts like a continuous acceleration upward (via Einstein's equivalency principle), so a multiple-axis accelerometer can also be used as an absolute orientation sensor in the UP-DOWN plane.
  • A gyroscope measures either changes in orientation (regular gyro or integrating rate gyro) or changes in rotational velocity (rate gyro).

The reason these sensors are combined is because they excel at different things. For example, for orientation, a magnetometer has poor accuracy for fast movement, but pretty much zero drift over time. An integrating scheme using gyros on the other hand reacts quickly and accurately to changes, but accumulates vast error over time. It also requires to start from a known orientation, as it only reacts to changes.

Combining the inputs to these sensors allows for quick and accurate position and orientation determination with a low amount of drift over time.

Together, these sensors are also referred to as an Inertial Measurement Unit, or IMU. You can find more information on the wikipedia page for this term. Note that the unit is not strictly speaking purely inertial when you add magnetometers, but this nomenclature is widely used.

  • It makes perfect sense for me that an accelerometer is able to sense gravity, but the link in your answer says that "Linear accelerometers measure non-gravitational accelerations". How is that possible? – GetFree Dec 28 '15 at 14:49
  • Gravitation is usually removed through filtering, either in hardware or in post processing, by feeding the signal through a high-pass filter. – drxzcl Dec 29 '15 at 9:21
  • but if it's filtered out, how do they know if the phone is in portrait or landscape? – GetFree Dec 30 '15 at 8:37
  • Specifically when talking about phones, there are several different version of the measurements that you can access e.g. on Android. Usually they include raw values, filtered values (e.g. "linear") and valued fused with other sensors, such as magnetometers. See for example the answer to this question: stackoverflow.com/questions/7858759/… – drxzcl Dec 30 '15 at 23:03

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.