Category Archives: Android Development

Downlink Functional!

I have to say, that was much much easier than I thought it would be. A few points about APM 2.5 that I could not find ANYWHERE online but made this whole project drastically easier:

  • APM 2.5 uses a FTDI chip for USB/Serial connections. This is fully supported natively with Android.
  • When Android is plugged into the FTDI port, APM will still fly the plane just fine.
  • APM has long had the capability to “Continue” it’s mission when it loses radio contact. This means it is not going to be necessary for me to modify the  APM code to allow functionality without a radio.

Anyhow, I will discuss my Android-based telemetry in the near future; but here is the innovation:

I am now able to communicate directly with my plane while it is flying from a standard Mission Planner ground station using a HSPA cellular link controlled by an Android smartphone onboard the plane. No 3DR or Zigbee telemetry, no range concerns, it just works. :)

Bridging MAVLink over the Internet using an Android Smartphone


So I’m posting about a neat little trick I am using to hook up to my APM without having to make a physical connection to a computer. What I’m doing is hooking up the APM to an Android phone using an OTG cable and then using a nifty little app to forward the Serial Port connection over the smartphones Wifi radio. Here is the app I am using:

Redirector TCP_SerPort

If you hook it up to your APM’s USB port, you will want to select 115200 baud. You can then open up mission planner, select the “TCP” connection option, and enter the IP address and port from the app when prompted.

Using this trick you basically have telemetry control over your APM whenever the smartphone is within wifi range. And an OTG cable is a lot cheaper than a 3DR radio. :)

This trick most likely wont work on your cell network. The reason is most cell carriers have what is essentially a firewall between your phone and the rest of the internet. You have no control of this firewall so you are basically prevented from hosting any network servers over your cell connection. What you would need to do this is some sort of middleman. I may put something like this together, although I am not sure if it is practical to offer it to the public. I’ll let you guys know.

Interfacing with MAVLink

Now that the plane has been tested and I have a good idea of the components that I am going to need for this project, I’m moving on to development of the Android app that will sit on the plane and interface with the ArduPilot.

Early on, I realized one of the tasks for this project was going to be coding a better MAVLink library for Java. The existing libraries are simple message decoders – useful for taking in a binary stream of data and translating it into something somewhat meaningful, but otherwise just asking for messy spaghetti code to make use of them.

I’ve jumped on this in the past few days. I started with some baseline code that I “borrowed” from the open source Android app droidplanner and have since been tweaking it to create an event-driven, object oriented Java library that can be used to interface with my ArduPilot while maintaining some semblance of good coding practices. :)

The library will be made open source. Here is the Github:

This will be consuming most of my time for this project for the next few weeks.

Project Overview

This site is a design log for a project I am undertaking to design a UAV that will carry an Android smartphone onboard to assist in it’s control logic and communicate with a downlink.

When this project is done, it is my goal to have a UAV that is capable of flying completely autonomously at low level a total distance of at least 30 miles while remaining in contact with the ground controller via a custom interface that interacts with an onboard Android smartphone.

Basic features will include the a full downlink application that will display basic statistics such as altitude, ground-speed, battery charge level, and other essential flight metrics. The downlink software will run in the browser and will be able to adjust the route on-the-fly as well as take pictures and video on command and have it sent to the downlink station.

When a mission is complete, the UAV will circle over a designated mission completion point until an operator turns on a radio transmitter and lands it manually.

The purpose of this project is to improve the state of production UAV’s available to the general public. Currently most UAV’s are at best tied to a high powered RF downlink which has at best a 10 mile range. As cell networks with internet capability spread and cover the planet, the concept of using them to control UAV’s at long ranges and out of line of sight becomes one of the best solutions available to us. Unfortunately, there are currently no easy to use / install systems that utilize both smartphones and mature UAV platforms to give forth a working system.

The work on the project encompasses four major categories:

Airframe – Work on the actual flying vehicle, which will initially be designed as a RC aircraft and slowly developed into autonomy. A COTS airplane will be used (see below) so most of this work will involve electronics mounting and placement.

ArduPilot – Work in tuning and customizing a build of the ArduPilot UAV controller to properly interface with Android in the desired way.

Android Development – Work on an Android application that communicates with the ArduPilot controller over an OTG USB cable. This will presumably only be a middleware that works between the downlink and the ArduPilot.

Downlink Development – Work on a web-based downlink application that allows control and monitoring of the UAV by the above-prescribed means.


The UAV I have chosen for initial development is the HobbyKing Sky Eye. I have chosen this airplane because I am very familiar with and a huge fan of the Bixler, and this is essentially the same airframe but upscaled with a longer wingspan and a bigger compartment up front. The model is very affordable and comes mostly pre-built. While I do enjoy building, this is a desireable quality for this project if I decide I want to produce multiple UAVs.

The Bixler is renowned for its tame flying characteristics and efficiency. I have easily gotten 20 minutes of flight time from them with a cruise of around 25MPH. I have also loaded Bixlers with 3x the battery weight they were designed for. I am hoping that the Sky Eye only improves on these characteristics of a Bixler.

The UAV Controller


I chose to use the ArduPilot UAV controller running ArduPlane for this project. This was mainly done because I had one on hand from previous UAV work and I am familiar with the codebase. DIYDrones is also a great resource for support and help when working on this platform, something other platforms don’t have.

The board I am using is an older APM 2 unit. These days you can buy the controller boards pre-built and packaged from 3D Robotics, but this one has served me well in the past so I will be re-using it. It has a GPS chip, a compass and a barometer built in. I have also customized it with an extension for the telemetry port. These are the wires you see coming off of it.

 The Phone

I will be using an old Galaxy Nexus as the onboard Android smartphone for the project. This is a reasonably powerful phone with a great set of features. Since it is a Nexus, it’s easily rootable and comes loaded with the latest versions of Android (necessary for OTG USB hosting). For whatever reason, Google put a barometer in these phones, which is a boon for my purposes. This will serve as a sanity check for the on-board APM barometer and I will be able to cross-calibrate altitude with it. Being a T-Mobile/international variant, swapping SIM cards in and out to give it cell access is simple.

About Me

My name is James Betker. I’m a 27 year-old software engineer at Garmin in Diamond Bar. I currently live in Tehachapi, which is beautiful, but known for it’s constant, high winds – not so great for model aircraft.

My interests lie in computers and aircraft, plain and simple. I designed my first website when I was 10 years old and wrote my first C++ program a year later.  I began flying model aircraft my first year of college and have been hooked ever since. I received my private pilots license in 2013 and became the proud owner of a full-size airplane in 2014.

My job specialty is low-level embedded development. At Garmin I help in designing and developing software for next-generation automotive applications. On the side, I have developed a set of smartphone applications that utilized sensors built into the latest phones in clever new ways. I believe this project is just an extension of that work.