Autonomous drone that you already have in your pocket!

In this tutorial i want to learn you something, maybe change your mind. And make autonomous drones available for everyone.

Simple question is: What do you need to make your drone autonomous?
– Accelerometer
– Gyroscope
– Telemetry wireless system
– Camera
– Some better micro processor

Its expensive right?

Real answer: Its cheap, and you already have it in your pocket!!!

Modern Android phones provides many possibilities, so we can make drones from them too. All you need is simple frame and simple hardware. And if you are worry about your super modern android phone, you can buy some old one from ebay and use your super modern one to control the drone remotely.Autonomous drone that you already have in your pocket

Step 1: Frame

You can find lot of guides how to make proper frame, buy adequate brushless motor, ESC , prop etc.. The truth is: take some lightweight material (aluminum, wood, glass fiber, carbon fiber etc..) and make tri/quad/hexa/octo from that. Just select material that you are able to work with and keeps same distance between motors.
I had some old parts from my X525 that i bought on goodluckbuy. Don’t buy exact same motors and ESCs, they are pretty terrible quality. I changed them on my x525 for better, so they lay on my table and they are ideal for testing  (it means lot of crashing :)).

My part list for frame:
3x Polaris 20A esc (don’t buy it, thy another)
3x A2212 1000KV motor (don’t buy it, thy another)
3 x Aluminum Square Boom from x525
2x X525 V3 Glass Fiber Main Frame Upper Plate
1x 3,4Ah turnigy nanotech lipo
1x turnigy voltage alarm

I decided to make tricopter, because i have only 3x ESC, you can make multicopter of your choice.

First step is to put the frame together with some bolts. You will need to drill two holes for rear boom.

Second step is to mount motors with motor mounts. If you are interested how i made this fancy motor mounts, you can check my tutorial on flitetest website Or siply use the original once.

Last step is to handle the weak spot of tricopter = yaw control. I recommend you to make something like well known guy do.

And you have very simple and powerful tricopter, weight is about 1,03kg. At this step you can perform frame test with kk board.
And as you can see here it flies.

It was easy? lets check out next step…

Step 2: The circuits

If you want to control something with android phone you will need some outputs. Simplest way is to use Android IOIO or Arduino board. I prefer IOIO in my projects, because it is powerful and easy to use. You can see lot of IOIO examples at my youtube channel

You can use simple shield for IOIO (see in pictures), that break out the PWM pins. I make the shield form universal PCB. Jumper connects power form servo connectors to VIN or 5V pin on IOIO board. Idea is: you can supply servo connectors from IOIO regulator. And on other hand, you can supply IOIO board form servo connectors with UBEC or some ESC.

The wiring is simple, put M1, M2, M3 and servo to IOIO pins If you are good programmer you can finish with this setup. Because i want to test step by step and want be able to control my UAV with my Turnigy 9x i connect receiver to digital pits 3, 4, 5, 6, 7(Stabilization features first and autonomous next).

Good thing is that your phone will by charged by on-board lipo.

For test proposes we will use only receiver connected to digital pits 3, 4, 5, 6, 7, one ESC with ubec (connected to pin10) and one servo (connected to pin 11). You can see bluetooth dongle connected to android ioio USB port, i use bluetooth for simple debugging. Your phone can be still connected to PC via USB and can communicate with ioio over the bluetooth. Its better to use cable connection between ioio and phone during on-board testings and flights (hopefully) 🙂

I made little research about pulse modulation from receiver. I used logic analyzer made from arduino. Modulated signal has 20ms period (50Hz) and HIGH pulse width is 1 to 2 ms (1,5 ms is center). Now we can read and represent signal with this knowledge.

The hardware part is relay simple, isn’t it? Next step is software part. Because this drone depends at software at 99%, everything depends at yours and mine programming skills.

Step 3: Software – analyzing

In this step, we want to analyze if we are able to:
1) read stick position from receiver
3) control servo
2) control ESC

For this propose we will use test setup mentioned on page 2. The components are:
1) Android IOIO with shield from page 2.
2) Receiver connected to digital pins 3-7
3) ESC connected to pin terminal 10
4) servo connected to pin terminal 11
My ESC includes BEC, that mean you can supply IOIO board form connected ESC. In this case, black lumper on our shield will be placed on left side, VIN pin on IOIO board will be connected to servo terminals (ESC will supply IOIO board).

For software development, you will need to install standard Android development environment and include IOIO libraries to your project. You can find tutorial here: and doc umentation for Android IOIO project here:

Our test application have simple gui, we will need:
2x slider to control servo and ESC (control PWM pins 10, 11)
5x label showing values from receiver (reed pulse width on pins 3-7)

Android IOIO offers Pulse Input. This type of input allows you to read width of incoming pulse, so its ideal for reading pulses form receiver. IOIO have 6 available ones (3 single-precision, 3 double-precision) you cant use 6 single or 6 double precision, you must split them. We will use PWM for driving ESCs and Servos. You can find functions for each individual pin here

This test app have relay simple code:

public class MainActivity  extends IOIOActivity  {
private TextView ch1, ch2, ch3, ch4, ch5;
private SeekBar seekBar1, seekBar2;
private int seekBar1_val, seekBar2_val;

protected void onCreate(Bundle savedInstanceState) {


seekBar1 = (SeekBar) findViewById(;
seekBar2 = (SeekBar) findViewById(;

seekBar1_val = 1000;
seekBar2_val = 1500;



seekBar1.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
public void onStopTrackingTouch(SeekBar seekBar) {
public void onStartTrackingTouch(SeekBar seekBar) {
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
seekBar1_val = progress + 1000;

seekBar2.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
public void onStopTrackingTouch(SeekBar seekBar) {
public void onStartTrackingTouch(SeekBar seekBar) {
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
seekBar2_val = progress + 1000;

public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(, menu);
return true;

class Looper extends BaseIOIOLooper {
private PulseInput pulse_ch1;
private PulseInput pulse_ch2;
private PulseInput pulse_ch3;
private PulseInput pulse_ch4;
private PulseInput pulse_ch5;

private PwmOutput M1;
private PwmOutput Servo;

public Float ch1_val;
public Float ch2_val;
public Float ch3_val;
public Float ch4_val;
public Float ch5_val;

private DigitalOutput led_;

protected void setup() throws ConnectionLostException {
pulse_ch1 = ioio_.openPulseInput(3, PulseMode.POSITIVE);
pulse_ch2 = ioio_.openPulseInput(4, PulseMode.POSITIVE);
pulse_ch3 = ioio_.openPulseInput(5, PulseMode.POSITIVE);
pulse_ch4 = ioio_.openPulseInput(new DigitalInput.Spec(6),
pulse_ch5 = ioio_.openPulseInput(new DigitalInput.Spec(7),

M1 = ioio_.openPwmOutput(10, 50);
Servo = ioio_.openPwmOutput(11, 50);

led_ = ioio_.openDigitalOutput(0, true);
Autonomous drone that you already have in your pocket Schematic
public void loop() throws ConnectionLostException {
try {
ch1_val = pulse_ch1.getDuration() * 1000;
ch2_val = pulse_ch2.getDuration() * 1000;
ch3_val = pulse_ch3.getDuration() * 1000;
ch4_val = pulse_ch4.getDuration() * 1000;
ch5_val = pulse_ch5.getDuration() * 1000;


} catch (InterruptedException e) {
runOnUiThread(new Runnable() {
public void run() {
ch1.setText(String.format(“%.2f”, ch1_val));
ch2.setText(String.format(“%.2f”, ch2_val));
ch3.setText(String.format(“%.2f”, ch3_val));
ch4.setText(String.format(“%.2f”, ch4_val));
ch5.setText(String.format(“%.2f”, ch5_val));

protected IOIOLooper createIOIOLooper() {
return new Looper();


Our analysis went well, we can:
1) read stick position from receiver via digital inputs
3) control servo
2) control ESC


For more detail: Autonomous drone that you already have in your pocket!

Clip to Evernote

Leave a Comment

(Spamcheck Enabled)

Read previous post:
Temperature Recording Arduino Robot
Temperature Recording Arduino Robot

My son and myself made a little arduino robot that records temperature. He wanted me to draw a robot, I...

Scroll to top