Hello again everybody!! I hope all of you are fine and in good mood and condition always. Today I would like to share my experiment on using the MIT appinventor on controlling servo motor attached to arduino. Well, wait a minute, my experiment before this also use appinventor, sooooo what's the difference?

Well, the difference is that in this experiment I am going to use the slider function in the appinventor as opposed to the experiment before, where I only use button functions.There will be two parts in the instructables, arduino part and the appinventor part. So let's get started shall we?

Step 1: Step 1: the Items Needed

As usual, I am going to list all the items that is needed for this experiment.


1. Arduino UNO

2. Servo motor

3. Bluetooth module ( HC-05 or HC-06)( i am using HC 06)

4. Male to male jumper wire

5. Breadboard

6. Android smart phone


1. Arduino IDE

2. MIT app inventor

Step 2: Step 2: the Appinventor Design and Blocks

Alright in the first image, which is the appinventor design screen, there are the slider object, the list picker and so on.. I would like to stress some information on the slider object.

If you look at the properties panel at the right when selecting the slider, you could see some variables you can edit. In this experiment, I would like my servo to turn from 0 to 180 degrees. That is why i have decided my minValue to be 0 and maxValue to be 180.

You can also customize the width of the slider by adjusting the width variable in the properties panel. I also wanted my initial position of my slider to be at the middle (90) therefore, I adjusted the thumb position variable to 90.

The second image shows the code block for the experiment.Notice that in the code block, I had initialized my global value ( thumb position) to 90.

Step 3: Step 3: Arduino Code

#include< Servo.h >// include server library

Servo ser; // create servo object to control a servo

int poser = 90; // initial position of servo

int value; // initial value of input

void setup()


Serial.begin(9600); // Serial comm begin at 9600bps

ser.attach(7);// server is connected at pin 7


void loop()


while(Serial.available()) //read while data is present


value = Serial.read(); //value = serial read data from phone

poser = value ; //than position of servo motor equals to value of data read from phone

ser.write(poser);// the servo will move according to position

delay(15); }


Step 4: Step 4: Assemble the Circuit and Test It!!

The circuit is assemble as shown in the sketch. The sketch is made is using fritzing. During uploading the code into arduino, make sure the bluetooth RX and TX to arduino were disconnected first from TX and RX of arduino. That's all for the circuit assembly.

Now everything is set up. Download the the code you made in appinventor to your phone (save .apk in computer, then transfer it to your phone). Upload the arduino code and test it!! The link for demonstration video is here:

<p>i allready to the same but it dose not work can you help me please :(</p>
<p>great work</p>
What does the MIT App Inventor do? Is it just a simpler way to get code?
<p> The MIT app inventor is an android app maker. Usually people use Android SDK for developing complex apps for android based smartphones. The MIT simplifies some of the app making by providing block based coding (similar to scratch). So, it can be said that the MIT app inventor enables user to develop some apps easier and faster. There are a lot of tutorials for MIT app inventor. You can go to this website to explore the appinventor:</p><p>http://appinventor.mit.edu/explore/tutorial-version/app-inventor-2.html</p>
However don't you need a motor driver shield to run the servo so you don't damage your arduino?
<p>In my opinion, my friend. the motor driver shield is used to run bare motors(DC stepper motor), while the servo had already been equipped with drive electronics and we need to just give it signal for it to function. You can also refer to the forum here for more info:<br><a href="http://arduino.stackexchange.com/questions/11592/do-i-need-the-motor-shield-to-drive-servo-motors">http://arduino.stackexchange.com/questions/11592/d...</a><br></p>
<p>But however, if you want to use a number of servos, it is better to use the shield.</p>
Nice instructable!! Going to buy myself a hc-06 and some servos now!!

About This Instructable




More by halim930112:Arduino Systems: Simple Bluetooth Door Lock Voice To Arduino: Control LEDs using MIT Speech Recognizer Experiment for Fun: Morse Code Encrypter Using Arduino and Smartphone!!!! 
Add instructable to: