Introduction: Androino! Control an Arduino From Your Android Device Using a Cheap Bluetooth Module.

Picture of Androino! Control an Arduino From Your Android Device Using a Cheap Bluetooth Module.

This instructable shows you how to read sensor values from an Arduino with your Android device using a cheap bluetooth serial device you can order for under $10 on dealextreme or ebay.
This example uses Python as the scripting language for the Android scripting layer (SL4A) but you can choose from other languages like Perl, Lua, JavaScript etc. see:

Step 1: You Need:

Picture of You Need:

1. JY-MCU bluetooth wireless serial port module.
or search for "bluetooth module" on ebay
I've bought mine for $8.20 on dealextreme.
2. An Android device with bluetooth.
3. An Arduino board.
4. Some sensor or potentiometer to read values from.

Step 2: Setup the Arduino Hardware

Picture of Setup the Arduino Hardware

The BT module comes preprogrammed with the following settings:
Device name: linvor
Baud rate: 9600
PIN: 1234

You can leave the settings as they are or change them with a serial adapter.
For more info see:

Connect the bluetooth module to your Arduino.
BT module Rx-> Arduino Tx
BT module Tx-> Arduino Rx
VCC to 5v

Connect a sensor or potentiometer to analog pin A0.

Upload this sketch to your Arduino:
The onboard LED at D13 is toggled everytime a sensor value is requested from the Arduino.

Step 3: Setup the Android Device

Picture of Setup the Android Device

Install Android Scripting Layer and Python for Android:
(This instructable is based on SL4A r4)

Copy the code from
and name it androino.html
Copy the code from
and name it
Change the BT_DEVICE_ID in to the address of your BT module.
If set to None, Android will ask you at program start which bluetooth device to use.
Upload both files to the /sdcard/sl4a/scripts/ directory on your phone.

Step 4: Have Fun

Picture of Have Fun

Turn on Bluetooth on your Android and pair the device using the pin 1234.
Start SL4A on your Android device.
Select and then the gear symbol to start the application.
The SMD LED on your BT module should stop blinking at this point.
A WebView is started and when you click on the button, the sensor value gets read and displayed.

It's really that easy :)

SL4E API reference:

I've added this script which simply dumps anything that is send via serial out from your arduino.
Select and then the console icon in SL4A to start.


SadanandT (author)2015-05-16

find the code given in below link and troubleshooting techniques and circuit diagram

BBMSuiDeatH (author)2014-08-09


janley.molina (author)2014-07-28

What do you mean by "sensor" ?

mmmatjaz (author)2014-03-06

The bluetooth module does not work with arduino micros's RX and TX pins, but I does work with software serial. Any advice on that, anyone? I can't use software serial as I need the PWM pins for other stuff...

Diego_Aquino (author)2013-09-10

Hello Friend, I am doing a mechanical arm, and I wonder how I control the servos via Bluetooth? Has a model Tutorial?
thank you

Mohammad_mm (author)2013-09-03

can I test this application with hyper terminal in windows ?
i make a connection between mobile bluetooth and my labtop
and select the com port of the Bluetooth in hyper terminal

but when i open the mobile application to send any thing from the terminal as a test before connecting the arduino
The application cannot start
it gives me w white screen with no thing else

I installed the sl4a r4 and python interpreter

but the problem still exists ?

akeonly (author)2013-04-16

Hi metanurb,

I have the exact bluetooth module that you have but I can't send anything to this module. Below is simple echo code that I use. Have I missed anything?

Thank you.

Arduino mega 2560

const int LED_PIN = 13;
boolean toggle = true;

void setup() {

void loop() {
if (Serial1.available()) {
digitalWrite(LED_PIN, toggle);
toggle = !toggle;

4ntoine (author)2013-04-13

With ArduinoDroid ( you can develop for Arduino on Android:

anand91 (author)2013-03-23

HI ..
please tell the program for arduino to transfer accelerometer sensor value serially using a bluetooth ttl interface

rikil (author)2013-02-21

My bluetooth module is discovered by Nokia feature phone but Samsung Galaxy Ace can't find it. FYI, Ace is running on Android GingerBread 2.3.6. Is there any problem with class parameter of Bluetooth module?

My module's documentation goes here :

I think this will be helpful to lot of other undocumented module owners cause I have similar module.

Is there any idea how to make it discovered by Android?

F4LLCON (author)2012-12-20

I have done everything in the tutorial, but I don't get any values. The bluetooth does connect because the blinking led on the bluetooth module stops blinking and stays on. But I do not get any values. I have the HC-06 2.0 bought from ebay. Any ideas of what might be wrong? Am a total noob at this. Thanks anyway

F4LLCON (author)F4LLCON2012-12-20

I used the code below with the programs and scripts you provided. It should work right? What am I doing wrong? Please someone help, I really want it to work. I am using:
"HC-06 Bluetooth V2.0 RF Wireless Transceiver Module Interface RS232 TTL"

This is my code:

#define trigPin 13
#define echoPin 12
const int LED1 = 8;

int sensorValue = 0;

boolean toggle = true;

void setup() {
  Serial.begin (9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(LED1, OUTPUT);

void loop() {
  if (Serial.available()) {;
  long duration, distance;
  digitalWrite(trigPin, LOW);  // Added this line
  delayMicroseconds(2); // Added this line

  digitalWrite(trigPin, HIGH);
//  delayMicroseconds(1000); - Removed this line
  delayMicroseconds(10); // Added this line
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration/2) / 29.1;
  if (distance >= 200 || distance <= 0){
    Serial.println("Out of range");
    digitalWrite(LED1, LOW);
  else {
    Serial.println(" cm");
    digitalWrite(LED1, HIGH);
    sensorValue = Serial.print(distance);;
    digitalWrite(LED1, toggle); // toggle the LED
    toggle = !toggle;

AndroidWallies (author)2012-12-03

Great stuff! Thank you so much! :)

adagio15 (author)2012-11-29

Is there any way to just send serial command to arduino like the serial monitor in the IDE?
Anyway, Pretty neat instructable....

Tone341 (author)2012-11-25

I am using Samsung galaxy note 2. when i run i get a black screen and then crashes,"unfortunately, SL3A has stopped." any solution?

loscat (author)2012-11-06

Nice instruct able. I do have one issue, when I run it doesn't open the html in a WebView, I see it in plain text :(. Any ideas?

stretcho (author)2012-11-04

Excellent, thanks for this - managed to tx/rx data dynamically between my website and my pad and the Arduino - fantastic - thanks again!

One question, as my Python scripting is not that hot - if I wanted to connect multiple bluetooth modules e.g. 2+ and route them all through my pad to my website how would I poll each module? something like this?.....

For x = 0 to (amount of bluetooth modules)
If BT(x) connected/success Then .....
End If

instrumentek (author)2012-09-25

Thank you for this. I have a problem, I loaded everything as per your instructions including the device I. When i load the androino.html it just opens the html file in text form. Is my android O.S. to old? Thanks

mb1793 (author)2012-09-09

hello i have been having trouble with youre code . every time i run the code i get this Message
[SyntaxError: can't assign to operator (, line 13)]

line 13 is the line where i am assigning the BT_DEVICE_ID.

Melbfella (author)2012-08-17

Thanks for such a straightforward tutorial - I feel like an idiot having issues, where everyone else seems to have succeeded!

When I open SLA4, all I see is the html file, not the py file, which is defininately in the same directory as the html one...

Any thoughts on where I've gone wrong?

Thanks in advance :)

smaw51 (author)2012-08-02

Check out for an easy way to make an android app for use with your bluetooth communication arduino stuff. It is a pretty easy interface and free!

Great for making buttons to send what you want for your commands. message me if you want an example of what I did for my android controlled car. easier in my opinion than a keyboard with small letters and big fingers.

davefish88 (author)2012-07-16

Thanks for the project. I found this after making a BT module work with a Picaxe14M2 and a little Android app called the Rocket Controller
from -- -- This worked fine and returned
either an 8-bit or 10-bit value (depending on the call in the axe firmware) that
matched voltage on a pot (turn the pot, get a new value).

So now I am trying to use your Python approach. I have the BT only connected as a transmitter from the Picaxe and it just loops and sends a value out. When I run the Python code I see the connection light work but nothing happens when I click "get sensor data". I also tried the "" code. It also connects and gives back a couple of lines --

Result(id=2, result=u' .. very long what look like a MAC address ...', error=None)
Result(id=3, result=u'linvor', error=None)

-- and then nothing else. From some looking around, it looks like 'linvor' may be the default name for the module. Any ideas? Is there someplace where I can find documentation on ... droid.bluetoothReadLine() ...? Thanks for any help.

davefish88 (author)davefish882012-07-16

Posted too soon -- changed "bluetoothReadLine()" to "bluetoothRead()" and it works !! Also found -- API reference --

beverageexpert (author)2012-05-25

When I goto bluetooth settings it finds linvor and I can pair with 1234 but it says paired but not connected. When I run the script it says service failed to start. then it goes to the html and when i hit get sensor data it says sensor value null

any thoughts

that was it. works like a champ
Now I would like to reverse it and have the android phone send a signal to the arduino to turn a led on and off

metanurb (author)beverageexpert2012-05-26

did you change the line:
BT_DEVICE_ID = '00:11:11:18:62:60'
to the id of your module?

russomanno15 (author)2012-05-02

How do you find the address of your BT Module? Also, for some reason, I cannot detect my BT module (w/ my Android) when it is hooked up to my Arduino as described above. Do I need to change the settings to make it findable?

metanurb (author)russomanno152012-05-03

You see the address in the android system settings -> bluetooth.
Did you pair the module with your android?

russomanno15 (author)metanurb2012-05-03

Is the address that goes into the .py file the bluetooth address of the Android or the BT address of the module? When my module is powered it is recognized w/ the device name "OBDII", not linvor. I am able to pair with it using the pin 1234 but then when I run the .py file in sl4a and press the gear, nothing happens.

If the address that goes into the .py file is from the BT module, I'm not sure how to find it. As far as I can tell, I cannot find it just by looking at the module in the list of devices shown on my phone. Could this be that I am using an older phone (Nexus One), or the 2.3.6 operating system?

So you know, I ordered my piece from Ebay but it looks almost identical to the one shown above from dealextreme. It's my theory that the settings were changed by whoever the vendor was. The only physical difference I can see in the parts is that the gold strip that "zig-zags" at the top of my module has one less "zig-zag". I don't know what it does though. See the image I attached of my own module.

metanurb (author)russomanno152012-05-03

The device id of your BT module goes into the .py file. You don't have to enter it at all, if the parameter is missing android shows you a dropdown menu where you can select the paired adapter: droid.bluetoothConnect('00001101-0000-1000-8000-00805F9B34FB')
For changing the module name, baud rate etc.:

armonfire (author)2012-04-25

I ordered from dealextreme, taking forever, 3 weeks and I had to email them twice about the status to get them to ship it.
Advice to anyone else in the USA, use a North American seller on eBay.

metanurb (author)armonfire2012-04-27

Yeah.. I'm too waiting for stuff that I ordered 3 weeks before :/
And sometimes the orders get stuck in customs for over a week here in germany :(

slackbuster (author)metanurb2012-04-30

I ordered an Ethernet shield from DX almost 2 months to the day and have not seen it despite it being "shipped". I'd recommend sending others to a more reputable site like Maplin (UK) or Sparkfun (US) before sending them to dealextreme.

Thanks for the writeup - I'll be trying this soon. :-)

(CH3CH2)2O (author)2012-04-26

This is awesome! I just got mine up and working. There is one thing I wanted to point out for others trying to do this.
In the python script, the following line of code opens the webview.


In my case I had to modify the code to exclude "/tulpe". So it now reads


Without this change, I was getting a blank screen that did nothing because couldn't find the html file.

Anyway, Thanks metanurb for this instructable! I can't wait to start making awesome bluetooth telemetry stuff!

metanurb (author)(CH3CH2)2O2012-04-27

Oops.. I've updated the code.. thanks!

armenvegas (author)2012-04-09

hi this is my first time hear and im soo excited! can i use a bluetooth dongle and wire the into my arduino? in other words is there much difference in a bluesmirf and a d link bluetooth dbt-120?

EmmettBrown (author)2012-04-02

This looks really cool.

Question re the bluetooth: How does the JY-MCU compare to the BlueSmirf modules? It's a lot cheaper and so I was going to order one, but why is this one 8 bucks and the others are 40-60?

Also, what baud rates can you get through this module? If I had a python module talking to the bluetooth, how many commands could I issue per second?

metanurb (author)EmmettBrown2012-04-02

I don't have a BlueSmirf so I can't compare them.
Baud rate goes up to 230400 and I have mine running reliable at 115200 (7m indoor).
More info about the baud rates can be found here:
As for the rate: 115200 / (8+1) = 12800 byte / second (if I get this right).

AtomSoft (author)2012-03-13

This is way better than using the full android dev! i didnt know they had a simpler way. Thanks!

Do you by any chance know of a barcode scanner using the Android Scripting Layer and/or Python for Android ?

metanurb (author)AtomSoft2012-03-13

this way->

AtomSoft (author)metanurb2012-03-13

You are officially the man! in my book at least. :) Thanks a ton!

AtomSoft (author)AtomSoft2012-03-13

Had to alter his code but works nice!

import android
droid = android.Android()
code = droid.scanBarcode()
isbn = int(code.result['extras']['SCAN_RESULT'])
url = “” % isbn
droid.startActivity(‘android.intent.action.VIEW’, url)

AtomSoft (author)AtomSoft2012-03-15

import android
droid = android.Android()
isbn = droid.scanBarcode().result['extras']['SCAN_RESULT'])
url = “” % isbn
droid.startActivity(‘android.intent.action.VIEW’, url)

patcc2 (author)2012-03-13

Could you make some python script to transmit the androids data to the arduino rather than the current design. I know it's fairly unrelated on the Android I could make the arduino bit but the Android is a bit tough since I don't know what functions print the androids built in sensor values.

quemazon (author)2012-03-13

The specs say that this module runs a 3.3V max. How long have you been running it at 5V, and have you had any problems?

metanurb (author)quemazon2012-03-13

The HC-03/05 board (green) that sits on the breakout board runs at 3.3V but the complete module runs at 5v.

quemazon (author)metanurb2012-03-13

Whoa, that's awesome. I have one and was worrying about level shifting. Good to know that it's already taken care of. Do you know if this is documented anywhere? Thanks.

metanurb (author)quemazon2012-03-13

I haven't found any data sheets but all the ebay offers say:
Power input: 3.6V-6VDC(Can not higher than 6V).

phoenix62_80 (author)2012-03-13

I have done pretty much they same thing using an android bluetooth serial terminal...this does look better though....well done!

About This Instructable




More by metanurb:Add a little two analog axis thumb joystick to your existing joystick.Androino! Control an Arduino from your Android device using a cheap bluetooth module.
Add instructable to: