UAV - Gyro, Accelerometer or both?


I’ve got a model air craft and right now I’m just trying to get something real basic sorted.

When the airplane starts to roll left or right, sort it. When we start to pitch up or down (climb/nose dive), sort it. Effectively, just something that’ll keep it all level.

Here’s my question, should I use an accelerometer or a gyro to do this?

Accelerometer seems like an obvious answer to me, as it knows which way is down, but I’m led to understand that this would not work very well on a plane (i.e. when in free fall, it reads 0). Is this the case or am I misunderstanding?

At the moment, I’ve got a gyro on it. But this will only tell me when the plane is rolling and when it’s not. It won’t actually tell me when the plane is horizontal.

So what’s my solution? Am I wrong about the accelerometer, that it won’t work in flight (please tell me I’m wrong) or perhaps there’s some solution that incorporates both, i saw a few things that had both built into them but I’ve no idea what for :-S

Looking forward to your replies :slight_smile:

p.s. Here’s a link to the project blog

The reason you're not getting horizontal readings is because your gyro doesn't have enough axis. You'll need a 3-axis gyro to correctly measure everything.

Aha, so if I get myself a three axis accelerometer then I can work out if I'm horizontal?

I'd assumed that even with three axis, no matter what direction the bottom of the plane is facing, if it's not rolling in any direction then it'd just read out as zero.

As it happens, I do have two dual axis gyros. So if I combine these, will I be able to code something that'll know which way up we are?

Both gyros work on X and Z (roll and yaw) though obviously, with some sneaky rotation, I can make one of those Xs a Y (such cunning).


If you have a two axis gyro, you can measure any two axis. If gyro can measure X + Y axis, orient it so that what it thinks is the Y axis is actually the Z axis.

Cool, that's what I'll do then.

Though, I'm still confused as to how I'll actually let the system know which way it's facing. I could hold the entire system very still, as if it's nose diving at a scary angle and it wouldn't know because it's not actually rotating.

So does this mean I will definitely need something like an accelerometer?

In that case you'll want an accel.

Good Luck!


Congrats on 500 posts by the way :)

Anyone able to share knowledge of accelerometers in air craft re: what i mentioned about it not doing well with free fall and if this is going to be an issue?


The idea of an accelerometer is that it measures acceleration. If you use it as a tilt sensor, you are taking advantage of Gravitational acceleration, but it can also sense regular acceleration, i.e. While falling (assuming plane has not reached terminal velocity).

Good Luck!

Wow, what a brilliant article, thanks. That's going to be really useful. I'll post a link to the code I come up with, thanks :)


You may ref some of the code here for the Gyro and accelerometer.