Clone wiki

Autonomous4jGA / PiConfiguration

Configuring a Raspberry Pi as the Drone's Positronic Brain

Change Log

12 July 2014 | Mark Heckler | Initial capture


Fully functional.


Here are the steps I followed to configure a Raspberry Pi to serve as a network client (to connect to the AR.Drone 2.0) and a wifi router with DHCP server (to accept connections from a development machine). These steps are captured from memory, so updates/adjustments will likely be required as we discover (hopefully minor) omissions.

Configuration Details

Bill of Materials


ONCE-AGAIN DISCLAIMER: Revisions likely as inadvertent omissions/errors are discovered. :)

  1. Install Raspbian to SD card. The best way to do this is to download the latest version of Raspbian and install it (instructions vary by your dev workstation’s OS).
  2. Plug SD card, ethernet cable, keyboard, and HDMI cable (connected to TV/monitor) into Pi.
  3. Plug in power cable and watch Pi boot.
  4. Expand filesystem, enable SSH, change Pi timezone, change Pi name (I used pidrone), change password if desired, over clock to High (950MHz) - NOT TO TURBO!, and "update this tool”.
  5. Reboot as requested and log into Pi. Type ifconfig -a to examine network settings.
  6. Issue sudo shutdown -h now to shutdown the Pi.
  7. Once it has fully shut down, unplug the power cable and plug in one of the Edimax wifi adapters. Plug in the power to boot the Pi.
  8. Use the Adafruit guide (good, but unusually for Adafruit, problematic; we’ll adjust later) to configure the Pi as a Wireless Access Point (HTML version; PDF guide here). IMPORTANT: Skip the section to “Configure Network Address Translation”, as we won’t be using this to pass packets straight through from dev workstation to drone, only to connect from dev workstation to the Pi. The program we run on the Pi will communicate with the drone.
  9. You may not have to complete the section entitled “Update hostapd”. This is necessary for use of Adafruit’s adapters, which are very similar to the Edimax adapters, and I did complete this step. But the first time through, I’d recommend skipping that step and testing to see if it is necessary. Why add steps and trouble if not absolutely necessary? :D
  10. Perform the steps in the “Finishing up!” section. Additional steps are required to make this consistently work, but this forms the foundation.
  11. Configure the key files below as appropriate. Notes included as well.

Key File Contents



The hostapd.conf file should have been configured while following the Adafruit instructions referenced above.


auto lo
iface lo inet loopback

iface eth0 inet static

#auto wlan0
allow hotplug wlan0
iface wlan0 inet static

#auto wlan1
allow hotplug wlan1
iface wlan1 inet dhcp
wireless-essid ardrone2_mkheck

The interfaces file configures wlan0 for the WAP functionality (static IP), while the wlan1 interface acts as a DHCP client to the drone’s onboard WAP. Note that if the drone isn’t powered up when the Pi boots (or if there is a problem connecting), you may have to issue the following commands to get it to connect (& then verify connection):

sudo su (to log in as su - easier to do this once vs. sudo’ing every command)
ifdown —force wlan1
ifup wlan1
ifconfig -a (to verify connections - but give the previous command several seconds to connect)

ARGS="-q -f -u0 -d10 -w -I"

This is absolutely critical to maintaining multiple simultaneous network connections across interfaces. The first two lines are what must be changed from the default ifplugd file; removing the wireless interfaces from ifplugd control allows us to manage them ourselves and keep two wlann connections alive.


#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.

ifup wlan0
/etc/init.d/isc-dhcp-server start
ifup wlan1

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"

exit 0

You must add the ifup and isc-dhcp-server start directives to “manually" initialize the wireless network connections upon booting the Pi.

Note that if the drone’s WAP isn’t on/accepting network connections when you boot the Pi, you’ll need to issue a sequence of commands to connect once the drone is available (documented above).


Revisions to this document are expected as errors/omissions discovered, but this should be the essence of configuring our drone’s "Positronic brain”. Happy hacking! :D