Introduction: How to Control Servo Motor From Android App

If you are looking to make Android app to control a servo motor, this is a perfect instructable for you, here you can follow a step by step procedure video to know how to make an android app using MIT app inventor and to control a servo motor.

Step 1: Circuit Diagram

Picture of Circuit Diagram

I've used 3 components here

1. Arduino uno

2. HC-05 Bluetooth Module

3. Servo motor

Connect the components according to the circuit diagram.

Step 2: Program Your Arduino



Servo myservo;

int bluetoothTx = 10;

int bluetoothRx = 11;

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

void setup()



//Setup usb serial connection to computer


//Setup Bluetooth serial connection to android



void loop()


//Read from bluetooth and write to usb serial

if(bluetooth.available()> 0 )


int servopos =;





Step 3: Create Android App

Picture of Create Android App

Follow the video below and complete the program for creating your app.

After completing the Program in MIT app inventor, go to Build and select App( save .apk to my computer)

Transfer the file to your android mobile phone or tablet.

Step 4: Follow These Steps If the App Not Install on Your Android Device

Picture of Follow These Steps If the App Not Install on Your Android Device

go to setting in your android mobile select security and move to Device administration and give access to allow install app from unknown sources.

IF you like this ible, please also check other projects using MIT app inventor here :

subscribe to my YouTube channel here:


CraigB172 (author)2017-11-18

Hey guys. I just got my HC05 in the mail after failing to get the HC06 to work.

Now, I can't get the HC05 to work, and I'm very discouraged. I've uploaded the code, and downloaded the App.

In short, the App doesn't show I'm connected to the HC05.. The HC05 was blinking red quickly, then when I paired with it using 1234 as the PIN it slowed to only blinking red once every 1-2 seconds..... My phone shows I'm paired, but the App doesn't show I'm connected so I get error 515...

My e-mails are


if someone could help walk me through this I would be forever grateful, I can not express how indebted to you I would be. I have a major project that is complete, except for not being able to turn my servo on and off, once this is worked out I'll be finished and it will make my son very happy. Please help.

chetan.jaganure.14 (author)2017-02-10

Can anyone make a step by step video and upload it cause we are not able to connect our mg 958 hi torque digital servo motor.

PatrikQ (author)2017-01-25

Thanks for nice projekt. I got it to pair with the phone. the first buttonpress send value to the Arduin, i checkt in the serialmonitor, and the servo moved. But the second or more buttonpress send values but the servo didnt move? any idies?

LemD (author)2015-09-19

Arduino: 1.6.5 (Windows 7), Board: "Gizduino (mini) w/ ATmega328"

Build options changed, rebuilding all

sketch_sep20a:1: error: #include expects "FILENAME" or <FILENAME>

sketch_sep20a:3: error: #include expects "FILENAME" or <FILENAME>

sketch_sep20a:5: error: 'Servo' does not name a type

sketch_sep20a:11: error: 'SoftwareSerial' does not name a type

sketch_sep20a.ino: In function 'void setup()':

sketch_sep20a:17: error: 'myservo' was not declared in this scope

sketch_sep20a:25: error: 'bluetooth' was not declared in this scope

sketch_sep20a.ino: In function 'void loop()':

sketch_sep20a:35: error: 'bluetooth' was not declared in this scope

sketch_sep20a:43: error: 'myservo' was not declared in this scope

#include expects "FILENAME" or <FILENAME>

This report would have more information with

"Show verbose output during compilation"

enabled in File > Preferences.

mannu667 (author)LemD2016-12-10

i think,only god can save u

mannu667 (author)LemD2016-12-10

hey bhagwaan

jpmannrich (author)LemD2015-12-25

Hello! I think you need to include this bibliotheques:

#include <SoftwareSerial.h>

#include <Servo.h>

JosefM2 made it! (author)2016-10-01

Hello Magesh! Thank you for this tutorial. After some noob mistakes (HC-05 not paired with phone) I was able to make this work. I went with your slider control version of APP.

For other begginers:

1) After starting bluetooth, pair phone with HC-05 module, it will ask you for PIN. Mine was "1234" without quotes.

2) After that I could see the MAC adress of HC-05 in application and connect with success.

Otherwise I got ERROR 507 in app.

Also little upgrade - because of buzz/jitter of servo motor (MG90S) I used capacitor paralel with positive and ground lines (2200uF (or higher was recommended->3300uf), had only big 35V one laying around, if you use 5V power supply 6,3V should be enough). This solved the issue.

Often got disconnected with ERROR 516 ("broken pipe") and APP crashing, on some forum found this solution, that disconnects bluetooth in app without crashing. See 2nd picture for blocks, that need to be added.

jpmannrich (author)2015-12-25

I build this circuit and the program. The android find bluetooth device HC-05, but my app give always "non connect". I did exactly as the video tutorial. Someone had the same problem? Tanks for help-me!

JosefM2 (author)jpmannrich2016-10-01

Hello, had also problem with connection:

1) After starting bluetooth, pair phone with HC-05 module, it will ask you for PIN. Mine was "1234" without quotes.

2) After that I could see the MAC adress of HC-05 in application and connect with success

LucianB6 (author)2016-06-27

hi! i can't connect the bluetooth to my phone. it says :

"error 515 not connected to a bluetooth device" . can you help me please with a advice?...

HafizY2 (author)2016-01-06

do you know how to do it with wifi?

HafizY2 (author)2016-01-06

do you know how to do it with wifi?

all4alex (author)2015-12-15

can I ask ? what is the purpose of the timer in the android app ?

im newbie to this, i want to make this kind of project for my school project.

pls help

KleviP (author)2015-10-18

Hi. Can you please upload an App to control more than one?

SherifE (author)2015-09-13

where is this link of the web site that had used to make your program!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1

george17 (author)2015-05-16

ok sweet thanks

george17 (author)2015-05-16

how would i control 2 servo motors at the same time with this this is my blog, I have updated an app there for controlling 2 servo, check it out.

jayathextronik (author)2015-05-07

I get the result in the serial monitor:"255 255 255 255 255 255 255....."only and so it can't to be controlled, pls help. check thia aia file ..

fansblink made it! (author)2015-01-11

cool, i made it name "Resertooth" :D

Thanks for sharing checkout other ibles :)

Veda88 (author)2014-12-18

Cool for once a tutorial on how to create the android app. Instead of selling the app or puttling lots of ads in it.

About This Instructable




Bio: I make hobbyist stuffs and play with electronics follow me to know more
More by Magesh Jayakumar:Quick Start to Nodemcu (ESP8266) on Arduino IDECourse on MIT App Inventor and ArduinoHat for the Party
Add instructable to: