Vous êtes sur la page 1sur 5

Food Living Outside Play Technology Workshop

Androino! Control an Arduino from your Android device using a cheap


bluetooth module.
by metanurb on March 10, 2012

Table of Contents

Androino! Control an Arduino from your Android device using a cheap bluetooth module. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Intro: Androino! Control an Arduino from your Android device using a cheap bluetooth module. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Step 1: You need: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Step 2: Setup the Arduino hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Step 3: Setup the Android device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Step 4: Have fun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

http://www.instructables.com/id/Androino-Talk-with-an-Arduino-from-your-Android-d/
Intro: 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:
http://code.google.com/p/android-scripting/

Step 1: You need:


1. JY-MCU bluetooth wireless serial port module. (search dealextreme.com or 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.

http://www.instructables.com/id/Androino-Talk-with-an-Arduino-from-your-Android-d/
Step 2: 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: http://wiki.openpilot.org/display/Doc/Serial+Bluetooth+Telemetry

Connect the bluetooth module to your Arduino.


BT module Rx-> Arduino Tx
BT module Tx-> Arduino Rx
VCC to 5v
GND to GND

Connect a sensor or potentiometer to analog pin A0.

Upload this sketch to your Arduino: http://paste.pocoo.org/show/563769/


The onboard LED at D13 is toggled everytime a sensor value is requested from the Arduino.

Step 3: Setup the Android device


Install Android Scripting Layer and Python for Android:
http://code.google.com/p/android-scripting/
http://code.google.com/p/python-for-android/
(This instructable is based on SL4A r4)

Copy the code from http://paste.pocoo.org/show/563745/


and name it androino.html
Copy the code from http://paste.pocoo.org/show/563743/
and name it androino.py
Change the BT_DEVICE_ID in androino.py 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.

http://www.instructables.com/id/Androino-Talk-with-an-Arduino-from-your-Android-d/
Step 4: Have fun
Turn on Bluetooth on your Android and pair the device using the pin 1234.
Start SL4A on your Android device.
Select androino.py 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 :)

http://www.instructables.com/id/Androino-Talk-with-an-Arduino-from-your-Android-d/
Related Instructables

Android talks to
iAndroidRemote Android RC Car
Arduino by Android G1 Super Nintendo
- Control by a1r
circuit_breaker Use your Android mobile Serial To on Android with
android phone using an Apple Arduino Robot original
sensors on the Remote by sudar by mranalytical controller
arduino ! by a1r (video) by
bsoares

http://www.instructables.com/id/Androino-Talk-with-an-Arduino-from-your-Android-d/

Vous aimerez peut-être aussi