Your Altitude is Wrong
May 26, 2012
Next-Gen backup AI avionics
October 26, 2012
Show all

So That’s How It’s Done!

Most of what you see below is what I have sort of figured out from working through it all, bit by bit, to turn my iPad into a synthetic vision system I can carry in the cockpit (X-Avionics on the AppStore).

So, without further ado: I just figured out how an attitude indicator works!

This may seem like a stupid thing to say, but if I bet ever person reading this $100 that I know how it works, and that they do NOT, then at the end of the day I will be in some serious money! Because most of you do NOT know how it works… because simply saying: “The gyro holds it steady” is NOT a complete answer!

I mean, you already know that these old-school mechanical artificial horizons have gyroscopes in them that spin rully-rully fast to hold them steady.. but how do those old mechanical gyros hold steady… RIGHT SIDE UP??!!

I mean, if you start the plane, and the gyro is flopped off to the side 45 degrees, why doesn’t it STABILIZE at 45 degrees off to the side?


Remember: No instrument has ever been made that can tell the difference between gravity and g-load from inertia in a turn.

In other words, imagine a pendulum in the cockpit of an airplane that you use to tell what is right side up (say the pendulum always hangs straight DOWN, right?) If you make a perfectly coordinated turn, then that pendulum will ALWAYS POINT STRAIGHT DOWN AT THE COCKPIT FLOOR, NO MATTER WHAT THE BANK ANGLE OF THE AIRPLANE! In other words, a hanging weight in the cockpit is COMPLETELY USELESS in figuring out which was is up.

No accelerometer, no matter how sophisticated, is any different than that hanging weight in trying to figure out which was is up. So any accelerometer made is useless to determine which way is up in flight.

Put another way, in a coordinated 2-G turn, the INERTIA of your imaginary pendulum has it swinging out wide of the turn, and this inertia is TOTALLY IMPOSSIBLE TO TELL FROM GRAVITY.

One way to think of this is to realize that no airplane ever flown has ever induced a single force on the pilot due to gravity. Only standing on the ground does that. In flight, the only force acting on you is in simple and direct opposition to the thrust and lift generated by the engines and the wings!!!!! Don’t believe me? Then rip the engines and wings off of your airplane in flight. In the resulting zero-G freefall, I guarantee that you will NOT feel gravity at all.. since you will be weightless in the cockpit in the resulting free-fall plummet. At some poimt on the way down, as you float totally weightless in the cockpit doe to the lack of thrust or lift, you will say: “Gee, I do not feel any gravity at all! I guess Austin was right when he told me that the only forces I feel in flight are due to the lift and thrust of the airplane, and have not a thing to do with gravity at all!” As long as you text me on your way down, admitting that I was right before you hit the ground, I will be perfectly happy.

(Note for people that love to argue: Of course, as you build speed on the way down, the DRAG of the airplane fuselage will build up, and you will indeed feel 1 G at terminal velocity… but that is because of the drag of the fuselage… NOT GRAVITY! If the fuselage had no drag, then you would be in zero-G all the way down to the ground.

Put another way, there no instrument ever made by man that can tell the difference between gravity and inertia. No gyro, no hanging weight, no accelerometer, no computer. Inertia and gravity feel exactly the same, and no instrument ever made can tell the difference between the two. And as well, no airplane has ever put a force on the cockpit due to gravity, but instead due only to it’s lift and thrust and drag that it’s various engines, wings, and landing gears have managed to exert! Put another way, no instrument has ever been made that can tell which way is UP in an airplane in flight! It has NEVER BEEN DONE!

So how off earth do we fly these things?

Here is the answer: What if we could tell what way is right side up WHILE THE AIRPLANE IS SITTING LEVEL ON THE GROUND? Well, THAT is easy. We just look at a hanging weight. For the mechanical gyro in an old mechanical artificial horizon, there are a few little valves at the bottom of the gyro that are attached to a HANGING weight (much like the PENDULUM), and if the hanging weight is off to the side a bit (because the gyro is flopped off to the side), then that hanging weight OPENS UP A VALVE THAT PUFFS AIR OFF TO THE SIDE TO FOCE THE GYRO UP TO THE PERFECT VERTICAL!!

That’s right: Little puffs of air are emitted side the gyro based GRAVITY, due to a hanging weight inside the gyro, and if that weight is ever held off to the side by the gyro being flopped over, puffs of air are emitted to push the gyro right perfectly up to a proper orientation, as indicated by GRAVITY. (And, we can measure gravity for exactly one critical reason: We are sitting on the ground! This is the only time that we can be sure that the gravity we fell really is pointing towards the ground!) Then, in flight, as the plane swings all about in maneuvering flight where gravity cannot be measured because the perceived gravity in the cockpit is always changing due to the crazy g-loads of turns and the like, the SPINNING GYRO gives the stability to HOLD the artificial horizon in place, even though the gravity vector sensed by the hanging weight is all messed up by centrifugal force and the like! This dynamic continues in level flight as well, since the wings at that point are doing a perfect job opposing gravity, since that is the way we normally fly.

So, it works like this: When we are NOT turning, the air-puffers on the bottom of the artificial horizon center the thing up like a pendulum, and the gyro spins fast enough to HOLD the thing steady so that reference is maintained in the manuevers and turns, even though the pendulum at that point is confused. Once you understand this, you understand that if you stay in a 2-G turn for a rully-rully long time, the attitude indicator will eventually start to indicate closer to level, and when you level the wings, the horizon will indicate off to the side a bit. Why? Because the pendulum-driven air-puffers mistakenly pushed the gyro off to the side, since the pendulum that drives the air-puffers was (of course) perfectly confused by the turn!

OK, so you got the mechanical gyros. Go get a Starbucks while that settles in your mind and when you get back we will do the electric EFIS attitude indicators which are maybe more complicated.

So, now imagine an iPad, which has many of the same sensors as any EFIS artificial horizon.

The iPad has accelerometers. They measure the gravitational (or inertial!!!!!) accelerations acting on the device in each of it’s 3 axis (you know: vertical, side-to-side, and fore-and-aft), totally unable to tell one from the other. They indicate what way a pendulum would swing in the cockpit. (great for finding which way is up on the ground or in perfectly level flight… but useless in a turn for the reasons described above).

The iPad has GYROS. These are solid-state thingies (no moving parts! They are microscopic and solid-state!) that indicate how fast, and in what direction, the iPad is ROTATING. These gyros have no idea of what is up or down… only that the ipad is rotating at a certain number of degrees per second about each of it’s three axis.

The iPad has a GPS. Only a measly one time per second, this tells you more or less where you are, with pretty questionable accuracy and consistency. Almost useless at high speed! Here is why speed messes up GPS (at least for me when I read the GPS on my iPad): The GPS takes some TIME to triangulate your location based on your distance from a bunch of satellites. One problem with taking time to do stuff when you are moving fast: By the time you finally get your answer, it is wrong, since you have MOVED since then! It’s sort of hard to balance your checking account when you just can’t stop making deposits and writing checks WHILE you are trying to balance it, and it is sort of hard to tell WHERE you are when you have moved a long ways since your last measurement, since you are going so fast. Now, if you at least knew exactly WHEN you got your location fix, then you could figure out where you are now based on how fast you are going and in what direction… BUT (!) I never seem to be able to get from the GPS exactly WHEN the fix was made! So, since I am only to read from the GPS APPROXIMATELY when the GPS fix was made, and I am moving fast, I cannot tell where I am NOW, An interesting point, though, is that OVER TIME, all of these timing errors will cancel out (because each error is maybe half a second in one direction or the other, so they will average out over time) enough that you CAN determine your SPEED and COURSE over time very accurately… you just have to be happy to use a running average over 10 seconds or so… so the GPS will NOT response in rapid manuevering… it has to run on a slow, 10-second running-average, in my experience!

So, you have accelerometers that tell you which way a pendulum would swing in the cockpit (useless for measuring bank in flight!) You have gyros for measuring rotation rates in flight (useless for knowing which way is up!) You have a GPS that gives course and speed over 10 seconds or so, and sort of approximates your location (useless for quick response of manuevering flight!)

How do you turn that into an attitude indicator that knows, quite simply, which way is up?

Beuler? …. Beuler? …. Beuler?

I don’t know how anyone else does it, but here is how >I< figured out to do it. (…and, if I was a delusional patent-troll, then I would surely patent this idea as if I was the FIRST person on earth to think of it, even though I guarantee that thousands of people have though of this before me! The scary part: I would have no problem getting a lawyer to make my bogus claim of originality to the patent office!!! This is one reason that many patents are bullshit.) Anyhoo, here is what I have discovered by test-flying my iPad in my light airplane many times, working through the process of determining attitude from the available sensors, even though countless other people unknown to me have already done the exact same thing: (Before you read on, try to figure it out yourself… you see the 3 tools you have: accelerometers, gyros, and GPS… how do you use those to figure out which way is up in flight? Think about it and try to guess before reading on).

OK, maybe you guessed, and here is the answer I have come up with on my own, though doubtless I am the ten-thousandth person to do so:

While on the ground, use the ACCELEROMETERS to see which way is up. They are fine if you are not turning, speeding up, slowing down, or otherwise accelerating! As long as a pendulum in the cockpit is pointing right to the center of the earth (any speed and altitude are actually fine, as long as you are not speeding up, slowing down, turning, or otherwise accelerating: Those are the things that will cause the pendulum to bob to and fro, and have an identical affect on confusing the accelerometers, which read only the g-forces acting on them, having no idea of those g-forces from from gravity or steep turns). So, when not turning (and preferably when level stopped on the ground to be sure of it) simply use the accelerometers to see which way is straight up. If all of the acceleration is dropping out the bottom of the iPad, and none to the side or front or back, it is a good bet that the iPad is standing vertical, right? So, when the plane is stopped, look at the accelerometers to see what way gravity is dropping out of the iPad, and straight up is the opposite direction as that. Now you have calibrated the thing during engine-start! Now, for the rest of the flight, watch the GYROS very carefully! They are always telling you the rotation rates of the airplane, so I have a pretty good idea that if you are rotating right at 30 degrees per second for 3 seconds, then you are at 90 degrees to the right! In other words, simply read the gyros to see how much the airplane has rotated off of the level that you calibrated on the ground during engine-start! Do this, and you will always know your exact attitude! EASY!

Except that it is not.

Did I mention that the gyros are not super-accurate? They only read rotation rates to a certain degree of accuracy, and worse than that, the rotation rate of the airplane will NOT be constant over the length of time that that you are using the gyro data!! For example, if I read the gyros 30 times per second (about as fast as I can), then we are saying that for each 30th of a second, the plane must be rotating at the rate that is reported by the gyro for that 30th of a second. BUT, as you may already be thinking, the rotation rate of the airplane is NOT the constant across that 30th of a second! And, by the time we have read the accelerometer and checked the time between readings to imagine how much the plane must have rotated, the aircraft could have changed rotation rates, and the timing we use is of very limited accuracy. So, in my experience with my coding on the iPad, the attitude of the airplane could be in error by 10 degrees over 10 seconds of quick manuevering in flight. This means: THAT THE ATTITUDE INDICATOR AS DESCRIBED WOULD BE GOOD FOR 5 OR 10 WHOLE SECONDS OF USE AFTER TAKE-OFF! YAY!!!! Then the error from gyro-measuring in-accuracy could build up to a large enough amount that you cannot fly the airplane.

SO, what do we do? The answer is that we need to CONSTANTLY UPDATE our attitude with the accelerometers! So, the GYROS give the short-period response (which is good for showing rapid manuevering of adequate accuracy to use for a little while) and continuously correct the gyros (a little bit every thirteeth of a second) to match the accelerometers, which are useless in rapid manuvers, but good when the plane is steady.

Doing this, we have a system that can work in turbulence and quick manuevers indefinitely: The gyros show the dynamic changes, calibrated to the pendulum which will average out to pointing down over time, and point down in the parts of the flight where you are not manuevering. In fact, I have just described the same thing for these electronics as I started by describing for the mechanical gyros at the beginning of this article! Cool!

So we got it now?


Because the last time I checked, and airplane can turn for more than 10 seconds, and 10 seconds is about as long as I can trust those gyros before their error builds up.

So, to re-phrase: The gyro can track our manuevering for maybe 10 seconds. So we calibrate to the accelerometers for seeing which way is up over a 10-second running average, but a turn can last LONGER than 10 seconds, so a turn would confuse our accelerometers (just like a pendulum) into thinking that straight down to the center of the earth is always the cockpit floor! In other words, this system would indicate that we were in LEVEL flight, even if we were in a turn, as long as the turn lasts more than about 10 seconds. SO, what do we do?

The answer is (and this is so cool) we need to CALIBRATE THE ACCELEROMETERS FOR THE TURN! In other words, we need to know if we are turning, so we can factor out the lateral acceleration (or centrifugal force) from the turn! And, we need something that works on about a 10-second running average to get it. SO, how do we do that? The answer is: GPS. We simply memorize each GPS fix, and see, over the course of about 10 seconds, what our average speed is over that seconds (by seeing how far apart the GPS sitings are!) and how much our course has changed over that 10 seconds (by simply seeing how that running-average speed and direction has changed over the last 10 seconds!)

So, in other words: We look at the GPS to see if we are in a turn, and calculate how much centrifugal force that turn would generate! Then, we simply SUBTRACT that centrifugal force from what the accelerometers are measuring in the cockpit, and what do we have?





Again: We took the accelerometer readings from the accelerometers in the iPad, realized that they are also showing centrifugal force from the turns, calculated our centrifugal force from the turn-rate showed on the GPS, and subtracted that calculated centrifugal force from what the accelerometers measured. The result is: GRAVITY. FREAKING GRAVITY. FREAKING STRAIGHT DOWN.

Now, THAT is what you use to calibrate your gyros.

DO that, and you have your attitude indicator for the entire flight.


OK so let’s go through this one ore time to be sure we have it (I have thought through this countless times to be sure I got it right):

  • We use our GYROS for short-term manuevers, figuring where the plane must be based on how fast it has been rotating, and for how long.
  • We realize that errors in measuring rotation rates, and how long those rotations lasted, will give as an error after 10 seconds or so, so we ease our attitude over time to an imaginary pendulum that is figured based on our accelerometers.
  • We measure our turns by GPS to see what our centrifugal forces are so we can correct the swinging of the pendulum to the outside of the turn, so that the pendulum we use to calibrate our gyros is one that really does always point straight down to the center of the earth.

SO there you have it! The limited accuracy of the gyros and GPS (or, perhaps, my knowledge of how to READ them!) really limit the accuracy of this solution a LOT, so I have found in flight-test that I still commonly see errors of 10 degrees or more in the attitude indication (the gyros drift.. the GPS sitings are irregular and of limited accuracy) but, if I lost the higher-quality attitude-indicator on my panel in flight, I think I could get on the ground with this thing, IFR at night in most weather!

OK I had so much fun working through all this and test-flying it myself that it is crazy, and I hope you had fun working through it with me in text as well!

PS: I am well aware that I cannot now, and never will, be able to spell the word ‘manuever’. PPS: I am well aware of the difference between centrifugal force and centrifugal acceleration, and do not care about the technical in-accuracies of interchaning the 2 words in conversation. If anyone thinks that they are revealing new information to me by telling me the difference between centrifugal force and acceleration, I will fed-ex a crazed baboon that is high on crack to their house.

And, below, some shots of this technology in action in my Columbia-400… not at the AppStore… YET.
(Google “VP-400′” to see what the hoops and paths are)

IMG_4148 IMG_4169 IMG_4267 IMG_4298