Home > Electronics, Programming, RC Planes > Routing APM communications to Internet

Routing APM communications to Internet

I’ve been wondering, what would be the easiest way to route telemetry and commands from APM to Internet. Using 3G modem, would provide almost unlimited range (I know there has been some discussions about this in DiyDrones forum. Here in Finland the GSM network is very covering, but due the way the cellular towers are optimized, maximum altitude where the connection works is probably less than 200 m.)

In theory, list of required hardware is not long. One just needs to receive messages from APM and encapsulate them to UDP packets and send via 3G modem and vice versa. Unfortunately handling PPP communications is too large task for simple microcontrollers. I ended up using BeagleBoard for the sake of easy development and since I had one at hand. I realize that BeagleBoard (which essentially is full computer by itself) is an overkill, but it’s not very heavy and fits easily inside Maja’s fuselage. Basically any embedded system, capable of running linux and acting as an usb host would do. Maybe in the future I figure out some additional tasks for BeagleBoard to do.




The software that handles the communications is a simple Python script. Since APM has no onboard configuration interface, the program fetches configuration at start-up (and every 5 minutes) from URL, given as parameter. Currently configuration consist on ground station IP-address and port. Since typically ground station is connected to internet with 3G modem, it’s IP-address is not fixed. Current address can be then updated to the configuration file and file uploaded to some known server.

When the script is running, it simply listens to serial port and when it receives valid MavLink packet, it sends to to ground station and vice versa. I made couple of fixes to UDP handling for APM Planner. By the time this text is published, modifications should already be included on the latest version (without the fixes, connection usually fails when Planner queries parameters from APM and expects to get those in a numbered order, but with UDP, packets may arrive in random order)




Testing setup

Hardware wise setup is very simple. Beagleboard needs to be powered from 5v source. Due to 3G modem, power demand is very “spiky”, so regulator must have enough power output (big enough capacitor helps too). I connected APM telemetry port to BeagleBoard main serial port. Since Beagle has standard RS-232 levels and APM uses +3.3v logic, I used common MAX3232 driver between those. The downside is that console on BeagleBoard’s only easily accessible serial port must then be disabled. Be sure to do this only after you make sure, you can connect to Beagle via internet.

It’s also possible to use second serial port on Beagle. It’s however not enable by default and enabling requires compiling new kernel. Second serial port uses +1.8v logic, so level shifter is needed.




  1. Script to connect using 3G modem
  2. Script to bring up interface at boot and reconnect if needed.
  3. Disable console on serial port
  4. Place configuration file on known server
  5. Script to launch MavProxy at boot



  1. Connect ground station to net and check it’s ip
  2. Update ip to configuration file and upload it to specified server
  3. Power-up the plane and wait until it BeagleBoard boots up (Usually 3G modems have some kind of indicator light notifying when it’s connected. You can use this to check when the plane is ready)
  4. From APM Planner, select “UDP” as port and press connect (Plane must be sending data at this point)
  5. Enjoy!




  1. Vitor
    18/01/2012 at 20:45

    Hi nice project
    Wich 3G USB modem did you use?


    • 18/01/2012 at 22:18

      Thanks. The modem I use is Huawei 160E. Seems to work out of the box with Linux.

  2. Suraj Nair
    15/04/2013 at 18:01

    Hi, Great Work. I read on one of ur posts in a forum that u have been using the terratec grabber with the RPI. I am also trying to do the same but it doesnt seem to work. For example when I try to open it with guvcview the device is detected but its not able to grab. Did you do some tweeking to get it running? Help would be much apprecieted đŸ™‚

    • 18/04/2013 at 08:57

      I’m actually using Beagleboard with DC-60+ grabber. Instructing how to get that setup running is worth another blog post, but until then Google is your friend =)

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: