Sie sind auf Seite 1von 5

Last Updated on 03rd May 2014

Posted In ANDROID,BLOG,EMBEDDED SYSTEM,LINUX,OPEN HARDWARE


In this post Ill show how one can use Android to send commands to Arduino via a BT module.
Prerequisite :
Before getting started download and configure all the applications on Android and ArduinoIDE as given in Amarino Toolkit.
One should have :
Android phone with above applications loaded. 1.
BT Module. 2.
USB Cable to burn program to Arduino. 3.
LED 4.
Target :
Android phone will send random numbers from 0-255 to Arduino every 5 second via BT module. This Will light up the LED attached to port 13 on
Arduino. This is done with the help of an application called Amarino. Amarino has several test data which can be used for data transfer. Here event
named Test Event will be used.
Assuming that one has done prerequisite will proceed.
Step 1 :
Open Arduino IDE and select File->Examples->MeetAndroid->Test

Note : You will see above path only if you have followed prerequisites given at the top.
Since the BT Module and Arduino Im working with is responding at 9600, so tweak the code and change Serial.begin(57600); to Serial.begin(9600); If
you working with other BT Module then change the baud rate accordingly.
Now you need to verify and burn the code to Arduino :
DEC
2011 Android Talking To Arduino
HOME ABOUT PROJECTS TECHNICAL REPORTS TALKS IDEAS BLOG CONTACT
Android Talking To Arduino - #chetanpatil #chetanpatil http://chetanpatil.info/1/post/2011/12/android-talking-to-arduin...
1 of 5 5/11/2014 1:54 PM

Done then move to next step.
Step 2 :
Attach BT module to Arduino as on 9600 Baud Rate :
Pin :
RST : To Reset the BT module. 1.
VCC : 5V Supply. This module works on direct 5V supply. Other module might have different requirements. 2.
GND : Ground. 3.
TXD : To Transfer the data. 4.
RXD : To Receive the data. 5.




Android Talking To Arduino - #chetanpatil #chetanpatil http://chetanpatil.info/1/post/2011/12/android-talking-to-arduin...
2 of 5 5/11/2014 1:54 PM











Note : Red LED on BT Module will be constant while Yellow one will blink continuously until it gets configured with other BT device.
Step 3 :
Attach the LED to Pin 13 :
Step 4 :
Pairing and adding test data to be sent via Android.
1) Open Amarino Application (One should have it as prerequisite explains how to install on Android phone).
2) This is How the Amarino application looks :

Android Talking To Arduino - #chetanpatil #chetanpatil http://chetanpatil.info/1/post/2011/12/android-talking-to-arduin...
3 of 5 5/11/2014 1:54 PM
Click on the Red icon at top left.
Amarino contains sample plugin/event which lets Android send sample data. As written above in post random numbers from 0-255 is what targeted to
be delivered to Arduino. Such data is called Event in Amarino.
3) After clicking Red icon next click on Add Event icon and in next screen scroll until one finds Text Event. This Event does the task to sending data via
BT of Android till BT on Arduino. At the use Save Option.









4) After above step Amarino will be diverted to Home screen. Now use the connect icon. This will pair the Android BT to BT on Arduino. Enter the
passkey if asked.
5) As soon as one hits connect : Android pairs and starts sending data with the help of Test Event which was configured earlier. Now every 5 seconds a
random number is forward to Arduino and it flashes LED for 1 sec and this continues for ever till one disconnects Android from Arduino.
At Amarino home one can see icon named Monitoring. Click that one can see how Android communicates to Arduino.
Android Talking To Arduino - #chetanpatil #chetanpatil http://chetanpatil.info/1/post/2011/12/android-talking-to-arduin...
4 of 5 5/11/2014 1:54 PM
2011 - 2014 Chetan Patil Via Creative Commons Attribution-NonCommercial 3.0 Unported License


Amarino is a very interactive application which one can use to built connection between an Android Phone and an Arduino. It has number of plugins
which are built on top of Amarino and provides easy solution to many problems. Guess what if one wished they go ahead and improve the code. Its
open source and hosted here.
Android Talking To Arduino - #chetanpatil #chetanpatil http://chetanpatil.info/1/post/2011/12/android-talking-to-arduin...
5 of 5 5/11/2014 1:54 PM

Das könnte Ihnen auch gefallen