Android Talking to Arduino - #Chetanpatil #Chetanpatil

Embed Size (px)

Citation preview

  • 8/12/2019 Android Talking to Arduino - #Chetanpatil #Chetanpatil

    1/5

    Last Updated on 03rd May 2014

    Posted InANDROID,BLOG,EMBEDDED SYSTEM,LINUX,OPEN HARDWARE

    In this post Ill show how one can useAndroidto send commands toArduinovia a BT module.

    Prerequisite :

    Before getting started download and configure all the applications on Android and ArduinoIDE as given inAmarino Toolkit.

    One should have :Android phone with above applications loaded.1.

    BT Module.2.

    USB Cable to burn program to Arduino.3.

    LED4.

    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 calledAmarino. Amarino has several test data which can be used for data transfer. Here event

    named Test Ev ent 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 :

    DEC2011Android Talking To Arduino

    HOME ABOUT PROJECTS TECHNICAL REPORTS TALKS IDEAS BLOG CONTACT

    roid Talking To Arduino - #chetanpatil #chetanpatil http://chetanpatil.info/1/post/2011/12/android-talking-to-arduin...

    f 5 5/11/2014 1:54 PM

  • 8/12/2019 Android Talking to Arduino - #Chetanpatil #Chetanpatil

    2/5

    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.

    roid Talking To Arduino - #chetanpatil #chetanpatil http://chetanpatil.info/1/post/2011/12/android-talking-to-arduin...

    f 5 5/11/2014 1:54 PM

  • 8/12/2019 Android Talking to Arduino - #Chetanpatil #Chetanpatil

    3/5

    Note : Red LED on BT Module will be constant while Yellow one will blink continuously until it gets configured with other BT device.

    Step :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 :

    roid Talking To Arduino - #chetanpatil #chetanpatil http://chetanpatil.info/1/post/2011/12/android-talking-to-arduin...

    f 5 5/11/2014 1:54 PM

  • 8/12/2019 Android Talking to Arduino - #Chetanpatil #Chetanpatil

    4/5

    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-255is 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 Ev ent. 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 Eventwhich 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.

    roid Talking To Arduino - #chetanpatil #chetanpatil http://chetanpatil.info/1/post/2011/12/android-talking-to-arduin...

    f 5 5/11/2014 1:54 PM

  • 8/12/2019 Android Talking to Arduino - #Chetanpatil #Chetanpatil

    5/5

    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.

    roid Talking To Arduino - #chetanpatil #chetanpatil http://chetanpatil.info/1/post/2011/12/android-talking-to-arduin...

    f 5 5/11/2014 1:54 PM