Ardupilot with Mobile Data Telemetry

Using ardupilot with a telemetry radio to send data to your groundstation is the easiest setup and works very well. It is limited by RF range, which is determined by the radio power (more power gives more range but costs more and may require a ham radio license). The range also depends on good line-of-sight between the radios.

It is tempting to take advantage of cellular networks to increase the range. Can a wireless data hotspot on your ardupilot vehicle give “infinite” range? This article shows how to set it up using a raspberry pi as the wifi bridge. You also need a mobile hotspot (either a standalone device or a cell phone in AP mode).

If you would rather watch, see the youtube video here:

Shortcuts

Telemetry without Wifi

This is how your ardupilot vehicle looks without mobile data telemetry. No raspberry pi needed, just a pair of radio modems that create a serial link.

Radio Modem Telemetry

Here is n3m0 and a groundstation laptop with an arrow showing the radio modems.

Basic Wifi Telemetry

Using a serial connection to a raspberry pi allows the pi to act as a bridge to send telemetry over a TCP connection. There are a few options for the pi software, I like mavproxy. It is easy to set this up on a local wifi network (both groundstation and pi connected to the same hotspot) or using the pi as the hotstpot (AP mode). This form of connection is limited to the range of the local wifi network, however. The image below shows the connections needed.

Basic Wifi Network

The good thing about a local network is that the IP addresses are easy to figure out. The groundstation needs to be able to access the IP address of the raspberry pi on the vehicle in order to make a connection, and if both systems are on the same network there are no issues.

If you connect the vehicle to the internet using a mobile phone or hotspot, the IP addresses become much harder to figure out.

Solution- ngrok

To make the connections easy to find with a mobile network, a central server is used. ngrok is a free program to “tunnel” the TCP connection and map the raspberry pi IP address to an address on ngrok’s servers.

There are other options, but I found ngrok to be a good way to do TCP forwarding. The RealVNC server that comes with raspberry pi does a similar task for remote login without using the local IP address, and there are programs such as uavmatrix that are designed to streamline the ardupilot system for a fee. The image below shows the ngrok network layout.

Mobile Data Network

Raspberry Pi Setup

To setup your pi, you must install some software and connect the autopilot serial port to the pi.

  • Connect pi to internet (mobile hotspot)
  • Use RealVNC server to remote login (optional but really nice)
  • Install ngrok software
  • Install mavproxy
  • Wire Pi serial port to Ardupilot Controller

A good video overview of much of these tasks is by Drone Dojo.

Raspberry Pi Commands

Step 1: start mavproxy

Minimal:

>>mavproxy.py  --out=tcpin:0.0.0.0:14441

Specify serial port input, start 2 outputs (one for ngrok, one for local connection to my python script):

>>mavproxy.py --out=tcpin:0.0.0.0:14441 --out=tcpin:0.0.0.0:14442  --master=/dev/ttyS0

Step 2: start ngrok

>> ~/Desktop/ngrok/ngrok tcp 14441

Path depends on your installation setup, this assumes you put ngrok in a folder called ngrok on your raspberry pi desktop.

Step 3: Connection Info for GCS

The command line will show the ngrok IP address you’ve mapped once ngrok starts up. You can also find it by logging in to the ngrok dashboard (useful if you automate the startup commands).

ngrok terminal window
ngrok dashboard

Step 4: Run GCS

Now connect your ground control station using a TCP connection with the IP address from ngrok and off you go!

Mission Planner Connected to n3m0

Leave a Reply

Your email address will not be published. Required fields are marked *