***THIS PAGE IS STILL A WORK IN PROGRESS***
This tutorial describes the process of configuring the Raspberry Pi as a quadcopter autopilot using the Navi+ daughter card. The initial configuration (flashing of the MicroSD card) was tested using Mac OS X 10.11.1. Commands may vary from system to system.
Raspberry Pi 2 Model B and MicroSD card (for example, this bundle)
Navio+, GPS antenna, and Wire pack (available here)
Micro USB cable and power source
Download the real-time Raspbian image from EMLID here.
Determine the mount point of the MicroSD card. For example, use df -h
. For me, this was /dev/disk2
.
df -h Filesystem Size Used Avail Capacity iused ifree %iused Mounted on /dev/disk1 233Gi 211Gi 22Gi 91% 55321127 5657687 91% / devfs 330Ki 330Ki 0Bi 100% 1142 0 100% /dev map -hosts 0Bi 0Bi 0Bi 100% 0 0 100% /net map auto_home 0Bi 0Bi 0Bi 100% 0 0 100% /home /dev/disk2s1 30Gi 2.4Mi 30Gi 1% 0 0 100% /Volumes/NO NAME
Ensure that the MicroSD card is unmounted, but not ejected.
diskutil unmount "NO NAME"
Write the image to the MicroSD card. I use pv
to monitor the copy, but this is not necessary.
dd if=~/Downloads/emlid-raspberrypi2-raspbian-rt-20150401.img | pv | sudo dd of=/dev/rdisk2 bs=1m
Boot the Raspberry Pi using the MicroSD card. The username is pi and the password is raspberry.
***From this point forward, all commands are executed on the Raspberry Pi***
Update the installed packages.
sudo apt-get update && sudo apt-get dist-upgrade
Reboot the Raspberry Pi. Verify that the real-time kernel is in use.
uname -a
Linux navio-rpi 3.18.9-rt5-v7+ #1 SMP PREEMPT RT Thu Mar 26 10:31:34 UTC 2015 armv7l GNU/Linux
Edit the sources list.
sudo nano /etc/apt/sources.list
Make sure the file contains all of the following listings.
deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi deb http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi # Source repository to add deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi deb http://archive.raspbian.org/raspbian jessie main contrib non-free rpi # Source repository to add deb-src http://archive.raspbian.org/raspbian jessie main contrib non-free rpi
Open the preferences file.
sudo nano /etc/apt/preferences
Insert the following lines.
Package: * Pin: release n=wheezy Pin-Priority: 900 Package: * Pin: release n=jessie Pin-Priority: 300 Package: * Pin: release o=Raspbian Pin-Priority: 200
Update the package list.
sudo apt-get update
Install gcc/g++ 4.8 from the jessie repositories.
sudo apt-get install -t jessie gcc-4.8 g++-4.8
Set the default compiler to be gcc 4.8.
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 20 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 20 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50 sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/gcc-4.6 20 sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/gcc-4.8 50 sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-g++ arm-linux-gnueabihf-g++ /usr/bin/g++-4.6 20 sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-g++ arm-linux-gnueabihf-g++ /usr/bin/g++-4.8 50
Clone the source.
cd git clone git://github.com/diydrones/ardupilot.git
Check out the Copter-3.3 branch
cd ardupilot/ArduCopter git checkout Copter-3.3
Build the source.
make -j4 navio
Move the executable out of the source code.
sudo mkdir -p /opt/apm/bin sudo cp ArduCopter.elf /opt/apm/bin/ArduCopter-quad
Make a symbolic link in the executable path.
sudo ln -s /opt/apm/bin/ArduCopter-quad /usr/local/bin/ArduCopter-quad
Building for NAVIO+ on RPi2. Accessed 2015-12-21. http://dev.ardupilot.com/wiki/building-for-navio-on-rpi2
GCC 4.8 On Raspberry Pi Wheezy. Accessed 2015-12-21. https://somewideopenspace.wordpress.com/2014/02/28/gcc-4-8-on-raspberry-pi-wheezy
Real-time Linux for RPi2. Accessed 2015-12-21. http://docs.emlid.com/navio/Downloads/Real-time-Linux-RPi2
Last modified: 2015-12-21