Set up Navio 2 and Raspberry Pi

This guide describes how to set up Navio 2 autopilot and Raspberry Pi computer (or similar) to communicate with web-based ground control station over internet and 4G networks.

Original docs for configuring Navio 2 autopilot board:

To configure your autopilot you need your board computer to be connected to a wifi network with internet available.

Connecting to

After you set up your drone and can connect with it using regular ground control software (such as QGroundControl or MissionPlanner), there are few steps left to control a drone remotely over 4G networks.

How it works

Ardupilot is configured to stream its MAVLink telemetry messages to local (onboard) UDP port. A small script (written in JavaScript) listens to this UDP port and transmits messages to server. When you open in a web-browser, this telemetry is got from server and rendered to a screen almost in realtime. In opposite direction, you press an action button on a web-page, this magically tranforms to a MAVLink message and reaches onboard autopilot to be executed.

SSH to your board Raspberry and follow next steps.

Configure Ardupilot

Depending on what frame you have configured using emlid-tool, the configuration file will be accordingly arducopter, arduplane or ardurover. Not ardupilot! Asuming you have arducopter, open config file:

sudo nano /etc/default/arducopter

Make sure these line are present or make copy-paste from here:

TELEM1="-A udp:"

Save it with Ctrl+X, y and restart Ardupilot

sudo systemctl daemon-reload
sudo systemctl restart arducopter

Check status

sudo systemctl status arducopter

It should be active and running:

Check MAVProxy

MAVProxy is used to be able to connect to autopilot using desktop GCS (over onboard or local WiFi) and our web-based GCS simultaneously. It is already installed in Emlid Raspbian image, just check it: --master=udp: --out=tcpin:

It should looks like this:

Ctrl+C to exit.

Video streaming has a video server which can be used to stream realtime RTSP video to your web-based dashboard. Next steps describe how to configure onboard Raspicam camera module.

sudo apt-get update
sudo apt-get install autoconf automake libtool pkg-config libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libraspberrypi-dev gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-plugins-bad

If you have dependency warnings, try to solve them using following commands:

sudo apt-get install --fix-broken --assume-yes
sudo apt-get autoremove
sudo apt-get install -f && sudo dpkg --configure -a

CD to your home dir and clone gst-rpicamsrc (this is a GStreamer wrapper around the raspivid/raspistill functionality of the RaspberryPi):

git clone

Compile it:

cd rpicamsrc
chmod +x
./ --prefix=/usr --libdir=/usr/lib/arm-linux-gnueabihf/
sudo make install

Test it with Raspicam connected:

gst-launch-1.0 rpicamsrc bitrate=1000000 ! filesink location=test.h264

Ctrl+C after 10 seconds and check if file test.h264 exists and readable. Configuration of video streaming to servers is described in the next steps.

Install additional dependencies


curl -sL | sudo -E bash -
sudo apt-get install -y nodejs build-essential

PM2 process manager

sudo npm install pm2 -g

Download and install board scripts

git clone
cd drone_board
npm install

Inside drone_board directory you can find two shell scripts and which help running MAVProxy and video streaming. If you are sure not to use them, just skip to next step, otherwise make them executable:

chmod +x
chmod +x

Get your drone keys

Sign in to your dashboard, add new drone and get its MAVLink and Video keys.

Then put them in following commands to be readable by scripts. For MAVLink key (replace abcd1234 with one copied from dashboard):

DRONE_MAVLINK_KEY=abcd1234; echo "export DRONE_MAVLINK_KEY=$DRONE_MAVLINK_KEY" >>~/.bash_profile && source ~/.bash_profile

The same for Video key (replace abcd1234):

DRONE_VIDEO_KEY=abcd1234; echo "export DRONE_VIDEO_KEY=$DRONE_VIDEO_KEY" >>~/.bash_profile && source ~/.bash_profile

Start board scripts

Check MAVProxy script:


If it looks good Ctrl+C to exit and then run it in background with PM2 process manager:

pm2 start --name mavproxy

Now run drone.js to check connection with server:

node drone

If it reports that connection is established, Ctrl+C to stop and run it again with PM2:

pm2 start drone.js --name drone

And finally start script for video streaming:

pm2 start --name video

Enable scripts to start on system boot

Enable PM2 to start on boot:

pm2 startup

This will prompt a sudo command which must be copied and executed to enable autostart. Then save list of active processes:

pm2 save

And check it:

pm2 list

Now check your dashboard, you can see you drone's telemetry streaming.

Connect USB 4G modem

Almost all 4G modems work fine with Raspberry Pi computers without any additional configuration. Just check if you have SIM-card with enabled 4G internet option. Otherwise look into modem's manual to find out how to use it with Linux-based systems.