In this short blog series I’m outlining the hardware and software of The Groundhog, my entry into the recent MAAXX-Europe autonomous drone competition held at the University of the West of England, Bristol.

Connecting the Raspberry Pi 3 to the Pixhawk took quite some working out, so I am hoping that by publishing my own step by step checklist, it may help others save a little time.


All code is posted to my GitHub repository.

Connecting the Pi to the Pixhawk

I have previously blogged on how to connect a Pixhawk (running arducopter) to a Raspberry Pi 2 using the UART interface.  The hardware connection is identical for the Raspberry Pi 3.  However, there are some critical differences in setting up the Pi and in the code required to make the connection.

Configuring the Pi

Here is my installation checklist for installing Dronekit on the Pi and making the connection between the Pi and Pixhawk.

Start with Pixel installed on the Pi3 and do basic Pi configuration and updates:

Install Jessie Pixel
sudo raspi-config
Expand filesystem
Disable serial for OS
sudo apt-get update

Now start to set up the development environment:

sudo easy_install pip
sudo apt-get install python-dev
sudo apt-get install screen python-wxgtk2.8 python-matplotlib python-opencv python-numpy libxml2-dev libxslt-dev

Install pymavlink and mavproxy to provide comms protocols between the Pi and Pixhawk.

sudo pip install pymavlink 
sudo pip install mavproxy

Install Dronekit and libraries to simplify control of the Pixhawk.

sudo pip install dronekit
git clone

Now sort out the clash on RPi3 between our need to use the UART and it’s use by the Bluetooth interface.  There are several versions of this config change about but this was the one that worked for me.

In RPI, add 2 lines at the end of /boot/config.txt (it will disable bluetooth and you can use /dev/ttyAMA0 to make the connection):


So now we switch to the Pixhawk, connected to a PC using Mission Planner.  The version needs to be at least 3.4.0 which allows for GUIDED_NOGPS mode.  We also need to make sure Telem2 is properly configured, which we do from the Full Parameters list.

Check pixhawk firmware is 3.4.0
Check Serial 2 parameters:

Now we can make the physical connection between the Pi and Pixhawk and test it out.

Note on power:  At this point, I had the RPi and Pixhawk independently powered, so the 5V connection between the two units was disconnected.  As long as they have a common ground, all is good.

Make physical connection

Test connection.  On the Pi:
sudo -s --master=/dev/ttyAMA0 --baudrate 57600 --aircraft MyCopter
param show ARMING_CHECK
watch HEARTBEAT (You should see mavlink heartbeat messages going both ways, every second)
Cntl - c
Reboot RPi

If you can see heartbeat messages during the test, like those below, all is good!

> HEARTBEAT {type : 6, autopilot : 8, base_mode : 0, custom_mode : 0, system_status : 0, mavlink_version : 3}
< HEARTBEAT {type : 6, autopilot : 8, base_mode : 0, custom_mode : 0, system_status : 0, mavlink_version : 3}
< HEARTBEAT {type : 13, autopilot : 3, base_mode : 81, custom_mode : 0, system_status : 3, mavlink_version : 3}

Setting up the Software in the Loop Simulator (SITL)

Beyond making the basic connection work, I found the SITL crucial to allow the developing software to be frequently tested.  Basically, the RPi needs something to connect to on the desk, and that cannot be the Pixhawk itself.

As a rudimentary test-environment to make sure the control commands are in the right ball-park, I found the SITL to be great.  Any more than that might be being a little optimistic.  I confess there is much configuration possible of the SITL itself which I have not played with (that’s my excuse!).  But for example, don’t expect the SITL to replicate anything approaching the inertia of a 3Kg hexacopter travelling at 40mph.

I installed the SITL on a PC, connected to the Pi3 through a standard home network.  The ardupilot site has instructions for the build and installation here, which worked after several attempts.  However all the issues were down to me not following the instructions precisely.