« The Long Tail of Brand Marketing | Main | Worlds's cheapest aerial video platform »

March 13, 2007



To get the full control you are looking for you will simply need 3 gyros. The MIMU (Mini Inertial Measurement Units)that control many spacecraft as well as many comercial aircraft are not much more than 3 gyros (one for each axis).

David Weight

I don't know if this works with Lego, but the easist way to get the altitude is with a barometric altiteter, preferably calibrated before you launch. However, I found that for landing I also needed an ultrasonic "radar" to get the required accuracy.



You might just ditch the compass and go completely GPS for direction and elevation with some statistical algorithms. It would not be as finite as a compass, but should be a workable solution.

matthew wollenweber

I'd say the best way to get your altitude is via the gps. You could always try to find more sensors but that adds costs and weight so why bother? For landing you'll likely need one of the sonic distance add ons.

If you want a rough approximation of the altitude the Integral of the vertical acceleration (velocity), multiplied by time gives the vertical displacement (altitude). You can do this with nothing more than the sensors you already have.


Couldn't you use the NXT sonar sensor for the precise altitude control right at the end of your soft landing?

IE: Bring it down as far as you feel safe under GPS control, or whatever, and then switch to measuring the distance to the ground with the sonar sensor for that last little bit.


I have written some GPS software that displays among some obvious stuff the current altitude and displays it in a graph.
Having a quick look at the graph learn me that you don't want to land a plane with a GPS like mine, or perhaps not at all. A small proximity radar like in the parkdisatnce of your car can be crancked up to do the last bit.
Nice project by the way!


Ehm ah GPS is not good enough to retrieve height information for flights. Or you have to build something that can do parachute landings.
It just inform you because it would be sad if a first flight would kill your future to build drone...
But why not make a baloon drone, or zeplin then you wont have less of these problems as you can then decent more slowly downwards.
Or you have to think about building a Lego barometer :)


IMHO one of the most important tasks of an UAV is ... to fly :)
To achieve this task you need 2 informations: speed and rate of climb.

While speed is relatively easy to measure, the RoC needs a variometer. Here you can find a project which might be an overkill, but a good starting point

btw. forget measuring speed via GPS. This will give you the ground speed of the vehicle. What you need is the indicated airspeed in flight direction, otherwise you'll never be able to maintain a steady flight


Last I knew 2 way communication to R/C airplanes is illegal without proper FCC licencing. The reason obviously... Terrorism! The government doesnt want someone loading up an RC plan with nerve gas and be able to fly it into a target someplace over the horizon.

You might want to be careful with who knows you got this.



gps' can be faulty on the Z axis (altitude). i'll second the suggestion for a barometric altimeter, at least in addition to a gps.


That's a negative on the FCC thing. First of all, it's not two way communiction. It's a drone taking over flight control. At no point does the drone communicate back to the ground. Secondly, you can do whatever you want as long as you keep it under 1 watt. Pretty much every commercial device you can buy, especially R/C devices has to be FCC certified already, and you need NO license. I've had experience with this as I'm FCC Certified. Great project by the way, I think we all want to see this come to fruition!


Correct me if I am wrong, but a R/C plane has four servos for control: Roll, Pitch, Yaw, and Throttle. You should be able to connect a Lego control to each one, similar to what you did above to control any aspect of the flight. The trick will be getting the program to complete coordinated turns. It should be easier to have a left and right turn routine, where the turn angle is determined by how long the aircraft stays in "turn mode".

You could always install an accelerometer vertically to measure how fast and how long your aircraft moved in the z-axis. As long as your software monitored the output for change, you should have a rough idea of how far above the takeoff altitude you are.

Good luck!

Steve J

For further information on navigation using GPS, you might want to look at John Carmack's Armadillo Aerospace site, www.armadilloaerospace.com.

For interesting and useful information on potential applications of this technology, you might want to read Donald Kingsbury's 1987 book, The Moon Goddess and the Son, ISBN-10: 0671653814

ron flory

RC helicopter gyros have been available for many years now, the lego offerings are nothing new.

The FCC code is not so much your problem as FAA regulations and AMA rules.

"No model aircraft shall be equipped with devices which allow it to be flown to a selected location which is beyond the visual range of the pilot." and "No model aircraft shall be equipped with devices that would allow for autonomous flight."

Be careful, state/federal authorities could get weird about this and take all the fun out of it, and really hose things for the rest of us.

I think you will find the GPS data to be too jittery and inconsistent for accurate flight control.

Chris Anderson


The line you quote -- "No aircraft shall be equipped with devices that would allow for autonomous flight" -- is from the AMA insurance rules. The only consequence of violating it is that the AMA won't cover you in case of injury. And as for the visual range element, we have no plans to exceed visual range at the moment, and when we do we'll be in good company. The thermal soarer guys have been using Out-of-Sight control systems for years.

I'll be doing a post in the next few days on all FAA and FCC regs and how they apply to this. But the short form is that for the light balsa and foam planes we're talking about with sub 1-watt radios and flight patterns below 400 ft, it appears to be pretty much left to good judgment.



Agreed- technically not applicable to non AMA folks and the FAA guidelines are still "voluntary". Still its good that you mention the 400ft limit. All of this stuff is in flux and I fear the FAA will come down on us hard if/when a single well-publicized "incident" goes bad.


I think most of your issues have been addressed, with the exception of jittery data from the GPS. For ground work, I have read of people averaging across multiple GPSes to get a smoother plot. This will add weight and complexity, not to mention expense, but may be the way to go for smoothing.


Scott Ullrich

This is very NEAT... But isn't that setup quite heavy??


If you have compute power a Kalman filter will sort out data from several sensors into a best estimate of real position and velocity. Add ultrasound and intetials to GPS and it'll really fly!


Regarding the compass, my garmin etrex vista switches to gps data for the compass once you are moving faster than 5km/hour. I use this when paragliding as it gives a near perfect bearing as opposed to a magnetic compass which needs to be relatively level and steady for an accurate reading. Your gps unit likely wont do this but it should be fairly easy to code. Then, you could possibly ditch the compass as well for some weight savings.

The only downside is in strong headwind when the ground speed is less than 5km/hour (not often) this method wont work. Although, if you coded your own routines you could set this to a lower value (say 2km/hour) and it may still work well, Im not sure where garmin got their 5km/hour figure.

anyway, good work, I hope your successful with it.


To what depth does GPS signal penetrate water?


So geek. So cool.


Sonic radar is... Sonar. The new automotive "front bumper sonar" might be small enough for what you want to do. It's short range stuff. There's another type for back bumpers, might be even shorter range. Also thinking infra-red circuit might work, for short range distance measurement. Not sure if it could defeat bright sunlight. And there's always the laser range finder. Some of those are very small. The sonar is pretty much fault proof, and not prone to interference or failure.

J Pody




A couple things:

Gyro sensor for pitch?
You don't discuss your pitch control, but I am assuming that you intend to use the gyro to measure/control the pitch axis, and you are relying on the static stability of the plane for roll stabilization (e.g. it will naturally maintain wings level flight). I also don't see any details about what this gyro sensor is, but I am guessing that it is a solid state rate gyro. If so, it outputs a value proportional to the rate of rotation. This is not a direct measurement of the pitch angle, but it can be integrated over time to keep track of your actual pitch angle. However, without any correctional input, small errors will accumulate and your pitch estimate WILL be subject to drift errors. Depending on the quality of gyro, ADCs, sampling rates, pitch rates, etc, you are talking somewhere between seconds and 20 minutes before the pitch estimate is completely unusable. Commercial Inertial Measurement Units (IMUs) typically have rate gyros along with accelerometers and possibly magnetic sensors to measure attitude (yaw, pitch, roll) angles.

GPS Altitude
With regard to some GPS altitude comments, it is true that the GPS altitude estimate is typically more noisy than the Lon/lat estimate. However, my research group has successfully used GPS altitude for UAV altitude control many times using both uBlox and Trimble GPS receivers. I can't speak for other brands, perhaps they are less accurate (output rate is also an issue here, 1Hz updates can prove to be a pretty big limitation on the longitudinal controls).


use the gps sensor from the microsoft streets and trips 2007 package. it's an SIRF III and it's about 2/3"x2/3"x1/4". it uses serial if that helps

Gary Mortimer

Looking forward to seeing it flying. Does look a little heavy, but heck get a bigger plane!

Will be a great reason for me to buy one of those lego setups for my boys!!



Chris, given the FAA's recent attempts to clarify the current regulatory landscape for UAVs[1], and their crackdown on local law enforcement agencies' attempts to use the model airplane guidelines as justification for flying small UAVs, I think you'll need to figure out how to get the FAA to feel good about any kind of competition.

Even after the clarification, it's still not clear to me what rules apply. There's some language in [1] that implies that maybe non-commercial use of small UAVs would be OK. Whether a robot competition would be considered non-commercial, I don't know.



Gps IS good enough, but probably not as raw data.
If i would have done this (and i soon will ;)) i would use a flight control computer and a positioning computer (separate) and use average-points with multiple gps readings to get a fairly accurate position.

Also, with a flight-control computer, you could set it up so in case you have radio failure, the flight computer takes control and fly´s back to last known-good location (and on safe altitude)

My first attempt will be with a electric sailplane with alot of v-shape on the main wing for roll stability and use only rudder and elevator for attitude control. (for simplicity)

As for autonomous landing, i think its a good idea to use a sonar system for the remaining few metres as the accuracy gets better with shorter distances, but i would strongly recomend using 2 of those, one pointing directly downwards (for elevation) and one slightly forward/downward to identify uphill-slopes, trees and other hazardous objects.

Overall, the idea is sound, and as far as my calculations go, it would be sufficient with aprox $300-400 worth of hardware, including airplane frame and electronics.

There is alot of work to be done, especially in the programming department, so i suggest we start a group, try to use same or similar hardware and make it opensource project.

...and Fuck the FAA! ;)


must this be done with lego? you could ditch the lego block and use an inexpensive micro. with more room and more processing power you could even add more sensors for other vital data and still be lighter. are power lines and overhanging tree branches a concern for this project? just curious to know what obstacles you can detect and how the autopilot would handle them


i also like the idea of a groop as i had a similar project in mind... i could contribute to firmware, and maybe a two stroke tiny petrol engine for rc planes, got in with the intention of building a S.P.A.D, that was two years ago...don't know much about planes so that would b a learning curve for me


I have a few years worth of experience with rc aircraft and helicopters, and i would suggest using electric motor and a trainer/sailplane type body.

You do NOT want to crash because of engine failure and since glow engines require external starter, youre kinda fucked if your engine stalls on you..
also, i think you want to turn the motor on/off depending on need for the longest possible flight witch is impossible with glow.

The trainer or sailplane is best simply because of its flight caracteristics, with larger v-shape on the main wing to create roll stability and preferably the sailplanes sleak lines with low wind resistance and great glide-numbers.


Powerlines, tree´s, bushes, rocks and other solid objects are ALWAYS a threat to thease types of projects.

Some are avoidable with altitude, but you still have to watch out at takeoff and landing.

A sonar sensor can sense larger obstacles as tree´s, large rocks, houses and so on, but will not pick up on smaller objects like electric wire, fences and so on.

As i previously suggested, a slightly forward-looking sensor is probably the easiest way to achieve this.

With gps and memory-bank for a plotted course, you can of course use flight altitude of more than 100 metres to clear 99% of the obstacles and only use known-good landing sites (open fields with limited to no obstacles) and use the accuracy of the sonar instead of gps height data for the last few metres.

I would assume that you could calculate vertical speed with both gps and sonar and therefore program the landing-phase of the flight-control to only allow 0,2m/s or whatever number you feel apropriate depending on plane construction and field used.

You can program the flight control (FC) to avoid objects in a specific way, to always pull up when it senses a obstacle for example. it would be hard, if not impossible, to have it turn the "best way" and would probably demand higher resolution distance mesurement unit such as lasers and therefore not practical (and not neccicary) for airplane use.


It is interesting to read this article it is outstanding and Some correlated sentence with may have related this matter. he easiest way to download audio books, audio books on CD, MP3 audio books. No clubs to join. No monthly fees. No software to install.
for more details visit this site: http://www.audiobookheadquarters.com/

Download Audio Book

evden eve nakliyat

very very nice blog.thank you for your informations...

wow power leveling


I like it very much,could u plz leave some more details?
lord of the rings power leveling maple story powerleveling wow power leveling


good comments



kuzey rüzgarı

Viagra Online

very nice post about Two words: Lego Autopilot, thanks!! i really like it

The comments to this entry are closed.


The Long Tail by Chris Anderson

Notes and sources for the book

FREE was available in all digital forms--ebook, web book, and audiobook--for free shortly after the hardcover was published on July 7th. The ebook and web book were free for a limited time and limited to certain geographic regions as determined by each national publisher; the unabridged MP3 audiobook (get zip file here) will remain free forever, available in all regions.

Order the hardcover now!