Monday, March 28, 2011

Contraption and Horsefly: Beagle Board, Android, AR.drone

Readers who have followed my articles on my Contraption project, a hack that allows a GNU software stack to run along side the Android software stack under a common Linux kernel on the Beagle Board, may have been wondering about my sudden turn into the world of remote controlled helicopters with the AR.drone, a project I call Horsefly. Here's where I tie it all together.

Step one: I hacked the /bin/ script on the AR.drone so that it uses a different IP subnet,, than that of the Palatial Overclock Estate (a.k.a. the Heavily Armed Overclock Compound), I described how to do this in Deconstructing the AR.drone: Part 3. Yes, this almost certainly voids the warranty on my drone. Given what violence and indiscretions I've already committed on my unit, I was hardly worried about that at this point. Your mileage of course may vary.

Step two: I dug an old Linksys WET54G WiFi-Ethernet bridge out of the vast Estate storeroom (imagine if you will those last scenes from Raiders of the Last Ark or perhaps Citizen Kane). I configured it to work using my AR.drone's SSID and the new IP subnet, and plugged this bridge into the Estate LAN. This creates a bridge between the Estate subnet and the dedicated AR.drone subnet. The former is a crazy quilt mixture of infrastructure WiFi, PowerLine Ethernet over electrical wiring, and CAT5 directly to the router. The latter is the ad hoc WiFi network for which the AR.drone itself serves as a DHCP server.

Step three: I connected to the Beagle Board running Android via its serial console and configured it to support both IP subnets over a single Ethernet port by just doing an ifconfig eth0:1 command. Indeed, I could have configured a USB WiFi dongle on the Beagle Board, but using the WiFi-Ethernet bridge allows any device on the Estate LAN to access the ad hoc network. Below is a screen snapshot of the Android console, made somewhat noisy by the Android stack logging stuff while I was typing.

Configuring Second IP Subnet for Android on Beagle Board

Step four: I brought up the web control panel for the WET54G bridge using the Android browser on the Beagle Board, just as a sanity check.

Linksys WET54G Bridge Configured via Android Browser on Beagle Board

Step five: I powered up the AR.drone, ssh-ed to the Beagle Board from my Mac mini desktop, and from there telnet-ed into the AR.drone, as another sanity check.

SSH to Android on Beagle Board then Telnet to AR.drone

Step six: from my desktop I used adb, the Android Debug Bridge tool that is part of the Android SDK, to install AR.Pro Lite onto the Beagle Board. AR.Pro Lite is an Android app developed by Shell Shrader that controls the AR.drone in a manner very similar to the standard Free Flight iDevice app developed by Parrot, the company that manufactures the AR.drone, and which I have used on my iPad. The Beagle Board was already recognized by the Android SDK USB driver on my desktop, so the install was simply a matter of adb -s 20100720 install 5036861.apk, where 20100720 is the Android serial number of my Beagle Board (which looks suspiciously like a date), and 5036861.apk is the AR.Pro Lite app from the Android App Store.

Installing AR.Pro Lite Android App on Beagle Board from Desktop

Here you can see the AR.Pro Lite icon now in the upper right-hand corner of the Android display.

AR.Pro Lite Android App on Beagle Board

Step seven: I brought up the AR.Pro Lite app on the Beagle Board and administered it to see the AR.drone at its address on the new subnet,, by using the app's Preferences menu whose icon is visible in the lower center of the Android display. (This is a feature the Free Flight iDevice app sadly lacks.) I then used the Connect to Drone button whose icon is visible in the lower left of the Android display.

AR.Pro Lite Android App Running on Beagle Board

Step eight: the AR.Pro Lite app almost immediately showed the cockpit view from the AR.drone through the drone's forward camera. I hit the Take Off button at the bottom of the display and (somewhat to my surprise I must admit), my AR.drone spun up its engines and leaped into the air. Below on the Android display you can see the cockpit view showing an aerial shot of the hallway outside my office, along with the ground view from the ventral camera showing the AR.drone cardboard box I was using as a landing pad, as well as an altimeter, a WiFi signal strength gauge, and a fuel (battery) gauge. Between the big Mac Cinema Display and the Android display you can see the WET54G bridge and the Beagle Board. The AR.drone was hovering just outside the door at the right hand edge of the photograph.

AR.drone in Flight via AR.Pro Lite Android App from Beagle Board

Step nine: celebrate!

Contraption and Horsefly are part of my effort to demonstrate that learning real-time and embedded software development can be exciting, using popular software stacks such as Linux, GNU, and Android, and inexpensive, using platforms like the Beagle Board and the AR.drone. This milestone has been a great proof of concept towards that goal.

(A big Thank You to Shell Shrader, of Shellware, for his support of this project!)

No comments: