# Quadcopter level? How can I measure it?

I'm an experienced Arduino developer.  But new to Quads.  I hope this is posted in the right place.

What kind of sensor can I use to measure if my Quadcopter is level?  More specifically I'd like to keep it level.  Or measure how many degrees it is tilted.  This is quite different from using GPS to determine it's location or speed.  Wind will make these 2 measurements different.  It could be level but still moving horizontally.  Or still but not level.  I have been experimenting with accelerometers and gyros and logging the data.  Accel do not work because they measure movement on top of the effects of gravity.  Gyros drift so much that after 10 seconds "level" is off by a few degrees.  Because of the vibration?  I would like to measure it within 5 degrees for any extended period of time.  Ideas below:

I've heard about image processing looking at the horizon.  I don't think so.  Looking down won't help because moving and tilting appear nearly the same.

I could look at the sonar distance to the ground if it were a focused beam.  Assuming the altitude was constant using air pressure.

4 arms with an ultrasonic sensor at the end of each.  Would work great at <50cm height!

When you tilt a spinning Quad, the effect of gravity on an Accelmeter, nearly cancels the effect of horizontal movement. They are in opposite directions.  You'd have to use a low pass filter on the data.  This makes the response too slow, a second or more.

I know you can combine the 2 datas A,G like this:
http://www.nuclearprojects.com/ins/arduino_program.shtml
But all I really want is to know the angle in 2D.

There must be a way to combine GPS and 2 gyros.  GPS will cancel gyro drift.  Assuming there is no wind.  I didn't want to assume that.

I thought of a mechanical sensor like a tiny pendulum.  But it too would swing as the Quad moves, just like the Accelmeter.  Damping the movement is like a low pass filter in code.

I have already solved this problem using a compass.  It's a creative and unique solution.  But unfortunately it's all or nothing.  It only tells me the direction it is tilted.  Not how much or if it is close to level.  I have posted it before.  It can detect that it's level within 1 deg.  Yes or no, and it only tells me the direction.

Any new ideas?

Views: 575

### Replies to This Discussion

Hi Steve,
You could use a 2axis inclinometer, such as some of the ones shown at http://www.leveldevelopments.com/inclinometer-sensors.htm

But keep in mind that the better the resolution, the lower the range of
inclination that can be measured. You are right that in flight the only time that the quad can be level is when it hovers in the same place and when there is no wind (such as inside). The Gps, gyros, and accelerometers are position and rotation sensors, not necessarily inclination sensors. Also, in maneuvers the inclinometer will tend to give false readings due to the acceleration forces on it, but this depends on the type of inclinometer sensor. Readings from the other sensors can be used to determine the tilt (inclination) if you know the state equations for your partocular quad (see http://biblion.epfl.ch/EPFL/theses/2007/3727/EPFL_TH3727.pdf, which is one of the best presentations of the quad model, though requires some study...) Good luck.
Joe

@Joe- An inclinometer is just a MEMS accellerometer with some processing of the data.  A low pass filter.  I'd rather do that myself so I can vary the parameters in the code.  It is too slow.  This data must be fuzed with the gyro data.  The sensors you linked seem very accurate and convenient to use for some applications.

The fusion of accel and gyro are what is used.  No sense going back to the stone age.  STmicro and Invensense both make 2 chip 9DOF IMU solutions for dirt cheap.  WAY cheaper than an oldskool inclinometer.

@Jake- I agree!  I got mine for \$30.  The gyro drifts.  Accelmeter is not accurate with all the vibration and movement.  When you fuze them together you must compromise.  Either by waiting while the data goes thru low pass filter.  Or accepting a 10 degree error over time.  I want to do better.  Any new ideas outside the box?

Will reply in a moment, catching up on all the reading.  Your solutions are not so simple, I've tried.

Well, it is not a easy problem you are trying to solve, so the solution (sensor fusion) is complex.

A simpler solution is to use thermophile sensors to watch the horizon, but this solution does not work under certain weather conditions or near mountain/in a valley etc.

Hi Jake & Steve,

Steve's problem with drift in MEMs - Gyro fusion is what I expected, and the only reason I suggested an inclinometer.  Not all of them are MEMs accelerometer based, at least before the MEMs technology, they were not.  Years ago (and I actually predate the stone age) saw some that were based on small 2 axis optical sensors or capacitive types, with almost no drift and resolution of 0.001 degree, but I have no idea if they are still made.  Also the size of them was larger, heavier than the MEMs based sensors.  Output was both digital and analog.  Smallest one I used in 1987 at Missile Command was about 20 grams.  They were cheap too.  That was before we (at the Guidance and Control Directorate) developed the first optical gyroscopes. The MEMs systems were not capable of high accuracy then and drift was orders of magnitude worse than it is now.  Things have changed too much, mostly for the better, but sometimes I like to chip the flakes and chunk my spear.  And like I said, who knows if they are still made, since the new accelerometer and gyros have replaced em.  By the way, back in the stone age (at the end of it, though) we used pools of mercury for the inclinometers.  Thanks God I did not eat too much of it, even though Methuselah was right when he told me it would prolong my life....

Joe

1

2

3

4

5

6

7

8

9

10

## Contests

Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.

A list of all T3 contests is here

185 members

87 members

24 members

18 members