Raspberry Pi Setup

This page explains how to set up a Raspberry Pi for use with ArduSub.

Easy Setup With Disk Image

With the simple method, you restore a .img file to the Raspberry Pi SD Card. This provides the operating system and everything already set up for running ArduSub. You can download the most recent disk image here:

Latest Ardusub-Raspbian Image (1.6 GB, Updated 2017-01-12)

(Raspbian Jessie Lite 2016-11-25 w/ ArduSub Companion Computer Setup)

To load the image to your SD card, use the following instructions.


Follow the instructions provided on raspberrypi.org

Mac and Linux

Insert the SD card in a card reader, open a terminal, and run the following command to find the disk identifier of the SD card.

On Mac:

diskutil list

On Linux:

sudo fdisk -l

You can find the disk identifier in the output. It will look something like /dev/disk2 on Mac and /dev/sdb or /dev/mmcblk0 on Linux. Verify the disk identifier of the SD card by checking the disk size listed. If you are still unsure, try running the command with and without the SD card connected to the computer to see which disk identifier appears and disappears in the output. You need to start by unmounting all partitions on that disk. Run the following command using the top level disk identifier for your SD card, not an identifier for one of the partitions on the SD card. (Partition identifiers look like /dev/disk1s1 on Mac or /dev/sdb1, /dev/mmcblk0p1 on Linux)

On Mac:

diskutil unmountDisk /dev/diskX

On Linux (add ?* to unmount all partitions):

umount /dev/sdX?*

To write the disk image to the SD card, use the following command. On Mac, change /dev/diskX to /dev/rdiskX for faster transfers. On Linux, replace bs=1m with bs=1M. Make sure that the identifier after of= is your SD card!:

sudo dd bs=1m if=~/Downloads/ardusub-raspbian.img of=/dev/rdiskX

If the image is still compressed, you can combine the decompression and writing in one command:

gunzip --stdout ardusub-raspbian.img.gz | sudo dd bs=1m of=/dev/rdiskX

Note that the location and name of ardusub-raspbian.img might be slightly different depending on where you downloaded it. Once complete, you can eject the SD card and install it on the Raspberry Pi. That’s it!

Setup From Scratch

These instructions are provided for those who wish to set everything up themselves.

Install Raspbian and Set IP Address

Start with Jessie-Lite image downloaded from raspberrypi.org and follow their instructions to install it to an SD card.

  1. Modify the file /boot/cmdline.txt to have “ip=” to the end of the line. It will look something like this (all one line):

     dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait ip=
  2. Create a new, empty file /boot/ssh (no extension) to enable ssh.
  3. Insert the SD card into the Raspberry Pi, connect the Ethernet directly to your computer (through a tether interface board if desired), and power it up.

Connect to the Raspberry Pi

The host computer needs to be configured with a static ip address of on the ethernet interface. Please see the main host computer setup sections for details.

All of the remaining setup is completed on the command line. You must connect to the Raspberry Pi via SSH, using a client program like PuTTY or the Mac Terminal. The default password is raspberry.

ssh pi@

Connect to the Internet

The Raspberry Pi will require an internet connection to download and install the necessary software. If you are on a Mac and have set up Internet sharing, you are good to go. Otherwise, setup the WiFi connection on the Raspberry Pi as shown below.


Edit /etc/wpa_supplicant/wpa_supplicant.conf on the Raspberry Pi by running:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Add the following to the end of the file:


Save your changes with CTRL+O, and close the editor with CTRL+X. Then restart the wireless interface:

sudo ifdown wlan0
sudo ifup wlan0

Check your Internet connection:

ping ardusub.com

Command Line Setup

First, run raspi-config to expand the filesystem and enable the camera.

  1. Run sudo raspi-config on the command line.
  2. Choose “Expand Filesystem”, then “Ok”
  3. Choose “Enable Camera”, then “Yes”, then “Ok” (The option “Enable Camera” can be found under “Interfacing Options” if it is not available in the main menu).
  4. Choose “Finish” and “Yes” to rebooting.

Next, update the current software and install the prerequisites needed by running the setup script in the Blue Robotics companion repository. Start by downloading the script on the Raspberry Pi:

wget https://raw.githubusercontent.com/bluerobotics/companion/master/RPI2/Raspbian/setup.sh

Make the script executable

chmod +x setup.sh

Run the script


It may take 90 minutes for all of the software to be installed and set up. When the script completes, reboot the Raspberry Pi:

sudo shutdown now -r

When the Raspberry Pi reboots, it will automatically start streaming video if the camera is connected and will automatically connect to the Pixhawk, if connected. If you have issues at this point, try running the setup script again, in case a package was unable to be retreived the first time.


Reentering Mavproxy and Video Processes

The mavproxy and video processes are started in “screen” sessions so that they can be reentered to view output and any errors that may have occurred. To reenter the sessions, open and SSH terminal to the Raspberry Pi and run the following commands:

sudo screen -r video

sudo screen -r mavproxy

To quit the process, press Ctrl-C. To exit without stopping the process, press Ctrl-A, then D to “detach” from the session.

Backing Up Disk Image

On Mac or Linux, first find out the disk number of the SD card using diskutil.

diskutil list

Find the SD card in the output. On Mac it will be something like /dev/disk2 and on Linux it will be something like ‘/dev/sdb’.

On Mac:

sudo dd bs=4m if=/dev/disk2 | gzip > raspbian-ardusub.img.gz

On Linux:

sudo dd bs=4M if=/dev/sdb | gzip > raspbian-ardusub.img.gz

Press Ctrl-T to check on status while this is happening. It can take quite a while.

To restore the image, see the simple setup instructions above.