Cellular Connected Autonomous AR Drone 2.0

Hacking an AR Drone 2.0 to fly autonomously using a Raspberry Pi Zero, and Hologram Nova.

MM

Pi in the Sky

In our arsenal of electronics we've collected we have an AR Drone 2.0 we've really wanted to play with. It is known in the tinkering community that the AR Drone is a pretty hackable drone. There are many repos like this one that allow you to control the AR Drone with a computer. We wanted to make an autonomous drone that would be controlled by a raspberry pi zero. Attaching a camera to the pi would allow us to implement the same YOLO code used in the PoochPak project for object recognition.

The AR Drone 2.0 uses wifi to receive commands for navigation. At first, we wanted to see if we could send those commands through serial communication instead. We found a way to connect the raspberry pi directly to the drone using the drone's serial connections underneath. We used a USB-to-TTL converter to access the drone directly by executing screen /dev/ttyUSB0 115200. We were dropped into the drone's busybox shell. We had full access to all the files on the microprocessor and we quickly tried to see what commands we could execute. We were able to do simple things like reboot the drone via command line. After some more digging around we came to find the file that controls all of the scripts necessary to navigate the drone- the program.elf file. Opening the file, you could see that this was a binary file. The AR Drone's software is unfortunately proprietary, therefore we couldn't see exactly what this code was doing. After stumbling into the AR Drone 2.0 Developer SDK manual, we confirmed that the Parrot company definitely did not want us to see the file. They specify that directly accessing the drone's shell and messing with their files was something they did not support.

We are left to having to control the drone via wifi. Since only one other computer can connect to this network, we'd be effectively cut out from reaching the raspberry pi and overriding the drone's trajectory if necessary. This is where the Hologram Nova comes in. We attached the Hologram Nova to the raspberry pi to provide it with another means of communication. We wrote a script that would send a message directly to the pi, which then can be parsed and execute the action desired, despite the pi being tied to the AR Drone's network. We effectively made a cellular kill switch for the drone! Not only can we override if necessary, the drone can now travel further since the drone sits below the drone, having great wifi reception, and we can always reach it through a cellular network. If you are near some cellphone towers, you will always be able to reach and locate your drone.

In this post we make the drone simply hover until we provide it the kill switch command. The script we provide can be modified to include more complex navigation patterns or repurpose the kill switch to provide other functionality. You can also incorporate the YOLO code found in the PoochPak repo to let the nova send you SMS messages when objects are recognized.

Hardware

The hardware needed for this project is pretty minimal. We spent under $200 to build this modification.

Software

Here is the software we'll be working with. Most of these will be installed using the repo we have built up.

Assembly

The wiring of the pi is very simple for this project. We repurposed the USB to TTL converter to power the raspberry pi through the GPIO pins using the drone's battery, removing the need to pack a heavy battery to the drone. Connect the power and ground pins to pins 2 and 6 of the pi. Connect the usb end to the usb port at the top of the AR Drone 2.0 next to the battery, where you would normally plug in a usb to store video. Other than that, connect the pi cam using the ribbon cable for pi zero and use a microusb to usb converter to plug in the Hologram Nova.

Installation

Compatibility between project dependencies requires python3.4 as default python3. You should burn this specific image for your raspberry pi zero. After making this image and wiring the pi, boot up and go through the first-time boot configuration. Run sudo raspi-config and configure the following:

  • Under Advanced Options, Expand filesystem
  • Under Localization Options change timezone
  • Change User password
  • Under Interfacing Options, enable ssh and camera
After a reboot, git clone our repo

cd ~/
git clone https://github.com/smellslikeml/cell_pwn_drone
cd cell_pwn_drone

Then run the install scripts provided in the repo.

./install.sh
./ardrone_setup.py

Configure

Follow these instructions carefully! The script can be a little finicky to run, we're still working on making the execution more reliable.

  • Position drone upside down to access pi and disable flight mode
  • Set DEVICEKEY in config.py
    
    DEVICEKEY='YOUR-DEVICE-KEY-HERE'
    
    
  • Set /etc/wpa_supplicant/wpa_supplicant.conf to the drone's SSID
    
    country=US
    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    network={
         ssid="ardrone2_#####"
    }
    
    
  • Reboot, connect peripherals, note the time (Pi off wifi on drone network)
  • As root (sudo su), set crontab for the time based on start time
    
    $ sudo su
    $ crontab -e
    #In your crontab,
      * * * /home/pi/cell_pwn_drone/main.py >> flight.log 2>&1
    
    
  • Unplug keyboard, plug in Hologram Nova
  • From Hologram Dashboard, navigate to Devices, click on your device, and in the Send a Message section, in the via Cloud Data tab, prepare for 'land' command to break flight as in the picture above.
  • Unplug HDMI after reboot and position drone
  • Wait for your drone to fly and hit the Send data message button to land!