I'm working on a basic airplane flight stabilization system, as the precursor to a full autopilot system. I'm using a salvaged Wii Motion Plus and Nunchuk to create a 6DOF IMU. The first goal is to keep the wings level, then mix in the users commands. Am I correct in saying that this would not require a gyro, just a 3 (2?) axis accelerometer, to detect pitch and roll, then adjust the ailerons and elevator to compensate?

Secondly, if we extend my design goal from "keeping the wings level" to "flying in a straight line" (obviously two different things, given wind and turbulence), does the gyro become necessary, insofar as this can be accomplished without GPS guidance?

I've tried integrating over the gyro values to get roll, pitch & yaw from that, however (as evidenced by this question), I'm at a level in my knowledge on the topic where I'd prefer simpler mathematics in my code. Thanks for any help!

  • $\begingroup$ Do you plan on using the accelerometer to measure orientation relative to gravity or by integrating to get velocity? $\endgroup$
    – Joe Baker
    Commented Feb 4, 2013 at 17:50
  • 1
    $\begingroup$ @JoeBaker Orientation relative to gravity. In essence, the plane should fly itself level to the ground, and be resistant to roll changes caused by wind. $\endgroup$
    – Chris
    Commented Feb 4, 2013 at 19:23

2 Answers 2


Am I correct in saying that this would not require a gyro, just a 3 (2?) axis accelerometer, to detect pitch and roll, then adjust the ailerons and elevator to compensate?

No. The opposite is true. The accelerometer will be almost useless to detect rotations on a platform that's experiencing unknown accelerations. Your plane will be subject to two force vectors: gravity and lift+drag. Lift+drag will vary hugely as a function of the plane's pitch.

But here's a more general way you can know this is impossible, and you can use this method in many other cases than just IMUs. A sensor, or set of sensors gives you N values. You can't interpret this into a space with more than N dimensions.

A trivial example: You want a sensor to measure someone's position within a room. Would a single ultrasonic range finder be sufficient? No. A position in a room requires two values, (X, Y) coordinates. But an ultrasonic sensor gives you only one value, a length. There is no way to set up this sensor to solve your problem. But if you had two sensors, then it might be possible.

Now let's look at the plane. A non-accelerating plane is subject to one force only, gravity. The direction of gravity relative to the plane is a 3D vector, but luckily (if you're on Earth) you know its magnitude. That's 1 value, leaving 2 unknowns, so you could theoretically get away with a 2-axis accelerometer to make up those 2 unknowns and calculate the vector of gravity.

What about a plane in flight. Gravity and lift+drag are both 3D vectors, giving you 6 numbers. OK you know the magnitude of gravity, so 5 numbers. You'll need some kind of sensor that gives you at least 5 values. Therefore a 3-axis accelerometer cannot be enough.

While neither a 3-axis gyro nor a 3-axis accelerometer will be enough on their own, the gyro would be much more useful. This is because it's directly measuring rotations, which is the very thing you're trying to control.

Likewise, the accelerometer will be more useful for detecting and correcting deviations from travel in a straight line.


As the name of the accelerometer implies, you measure the acceleration on your system excluding that from the gravitational force. When your sensor is at rest, you measure the acceleration from the force that you use to counteract the gravitational force. This is how you can fix your orientation vs the gravity vector. When the sensor is accelerated, as would be the case when other external forces (like e.g. wind) are applied it gets mixed with the forces counteracting the gravity, and you can not uniquely identify the gravity vector anymore. When averaged over time you can smooth out the dynamic acceleration components, and this is for example what is used in an AHRS to compensate the gyro drift. For short term estimation - which is what you are asking for - an accelerometer is not likely to provide you the information that you need to keep your craft stable, and you need some other method to estimate your orientation (e.g. gyros, horizon sensor, etc...).

Effectively you can not differentiate between a level craft which is accelerated by a wind gust and a craft which is tilted, but otherwise not accelerated.

  • $\begingroup$ Thank you, I'll take a look at that! I've found a complimentary filter on the Arduino forums that I've inserted as I don't have the math to code it myself, we'll see how that goes. I think I can flight test tomorrow... $\endgroup$
    – Chris
    Commented Feb 5, 2013 at 20:04

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.