I didn’t have my children to justify playing with Legos, but it certainly didn’t hurt. Yet after a while, we (OK, mostly I) wanted to do something with Lego that had never been done before. But what?
The answer came to me while out on a run, and it combined three geeky things that were on my mind: Lego, R/C airplanes, and gyro sensors. Suddenly it came to me. Gyros are what you use for autopilots. An R/C plane with an autopilot? That’s an unmanned aerial vehicle (UAV), or drone. Bingo.
We were going to build the world’s first Lego UAV.
HiTechnic sent me a gyro sensor, and I got my first dose of reality. The sensors use tiny “rate gyros,” which don’t measure absolute position. To get them to actually keep a plane flying straight and level, you’d have to combine them with acceleration sensors and do a ton of gnarly math to get around inertial forces, drift, and other complications.
Then came the second flash of insight. Keeping a plane flying straight and true is a solved problem — companies such as FMA Direct sell “co-pilots” for around $100. So that just left navigation for the Lego. I found a plane (a Hobbico ElectriStar) that was big enough to hold the Lego Mindstorms controller, gears, sensors, the R/C system, and a Mindstorms motor geared to move an entire rudder servo back and forth.
When I started, there was no good way to read GPS data with Mindstorms. So I went with a proof of concept that used HiTechnic’s compass sensor, and helped my then-9-year-old write a program that would just tell the plane to fly a square pattern. So far, so good. Fortunately there were several groups working on the Bluetooth GPS problem on Mindstorms. So we ported all the code from Mindstorms NXT-G to RobotC, which turned out to be pretty easy.
Today we have a fully functional Lego UAV. You give it GPS waypoints, take it off manually, then flick a switch on the R/C transmitter, and it flies to the coordinates you’ve entered. That’s pretty awesome, but we want more. So the next job will be to integrate an onboard cellphone that communicates with the Mindstorms via Bluetooth. Cool, huh?
Full story at makezine.com/12/homebrew.
ADVERTISEMENT