I want to be able to accurately measure the static 3D orientation of a drone I am building.

I understand one way to do this is to use a gyro sensor with continuous integration.

I want to combine this data with magnetic/compass data for improved accuracy and possibly automatic calibration.

I have also heard of "orientation" sensors. Is this the same as a magnetic sensor? As in, does it compute the orientation from the magnetic compass data? Or does it use a different method, e.g. gravity?

  • \$\begingroup\$ it may just be a ball bearing inside a cage, with contacts that sense the location of the ball bearing \$\endgroup\$
    – jsotola
    Sep 21, 2022 at 18:22
  • \$\begingroup\$ Usually there are integrated IMUs, which combine different sensors, such as gyros, accelerometers and magnetometers. Carefully integrating the measurements of all these can give full information about the orientation (but not limited to). \$\endgroup\$
    – Eugene Sh.
    Sep 21, 2022 at 18:38

2 Answers 2


Consider a 3-axis accelerometer in a (fairly) static drone; it will register around 1g acceleration in the z axis as the drone pulls against gravity, and close to zero on x and y. Inevitably there will be some drift of the gyros over time, and the direction of the z axis can be compensated by gravity (integrated over time this will tend to be downward even if there are short-term changes from movement). However, there is no way to compensate for drift in the rate of rotation about the z axis and so if the drone gradually started to rotate there would be no way to detect this. However, with a magnetometer it would be possible to detect and correct for rotation. I’m skimming at a slightly high level here but if you have a grasp of the maths involved it hopefully won’t be hard to follow.


Being called an "orientation sensor" just tells you that it determines orientation but doesn't specify how it does it. So it could be using any combination of gyros, accelerometers, magnetic sensors, or other methods such as electrolytic tilt sensors or light. Any method is fair game as long as it works, but not all methods will work for all applications, nor are all methods necessary for every application.

For example, an UAV might use magnetic sensors, gyroscopes, and accelerometers but a ground-based telescope might only need accelerometers. Or the ground-based telescope might use an electrolytic tilt sensor instead of an accelerometer. A car might only need magnetic sensors and accelerometers.

To know what the methods are being used by an orientation sensor (more accurately called an orientation module) you would need to look at the datasheet.

Note that technically an orientation module doesn't necessarily means it includes some method to track yaw over the long term, or even over the short term, since is often classified under navigation. But if it's called a "navigation module" it should have some method to reliably track yaw over long periods of time. This is not a hard rule, but a generalization of fuzzy terminology.

For example, I don't think anyone would contest that an inertial measurement unit (IMU) is not an orientation sensor, but IMU don't necessarily need to include an absolute yaw tracking method such as a magnetic compass. That means that although the gyroscopes in an inertial measurement unit can theoretically track yaw they can't be used for navigation since there is nothing to stop the yaw from drifting long term. And there are exceptions to this: such as gyrocompasses or nuclear-submarine grade gyroscopes used for dead-reckoning...but you aren't going to run into one of these. Not to mention they probably aren't in "module" form to begin with.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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