Connect Arduino with Android using BT Communication

In this article I'll show you how to use the Bluetooth Module with the Arduino Uno.

In my previous article I explained working with Ultra Sonic Sensor, and in this article I'll show you the connection between Arduino and Android using Bluetooth Module.
  • Arduino Uno
  • Bluetooth Module HC-05
  • Android Phone
  • Mit App Invertor 
  • Led
Bluetooth Module to Arduino:
  1. Vcc to 5v
  2. Gnd to Gnd
  3. Rx pin to Tx Pin
  4. Tx pin to Rx Pin 
  5. Led to Digital Pin 5
MIT App Invertor:
  1. Go to MIT App Invertor 2.
  2. Start new project.
  3. And the design the app for our BT Connection.
  4. In the left side corner we have the palette windows in that we have the reqired tools just drag and drop and complete the desing process .
  5. After that we want to make the code for our design part go to Blocks section and make the following code that shown in the figure2.
                                          Figure 1: Designer
               BLOCKS WINDOW
                                                    Figure 2: Blocks  
Arduino BT Program:
  1. int ledpin = 5;  
  2. String readString;  
  3. void setup()  
  4. {  
  5.     Serial.begin(9600); // Baud Rate  
  6.     pinMode(ledpin, OUTPUT);  
  7. }  
  9. void loop()   
  10. {  
  11.     while (Serial.available()) //Send data only when you receive data  
  12.     {  
  13.         delay(4); //delay time  
  14.         char c =;  
  15.         readString += c;  
  16.     }  
  17.     if (readString.length() > 0)  
  18.     {  
  19.         Serial.println(readString);  
  20.         if (readString == "ON")   
  21.         {  
  22.             digitalWrite(ledpin, HIGH); // LED ON  
  23.         }  
  24.         if (readString == "OFF")   
  25.         {  
  26.             digitalWrite(ledpin, LOW); //LED OFF  
  27.         }  
  28.         readString = "";  
  29.     }  
  30. }  
Intialize the variable ledpin=5 declare the string as readString.
void Setup()
In the Setup() function set the baud rate 9600 it sends the data bits per/sec and set the pinMode to led as OUTPUT and.
void loop():
In the loop() function we want to make the conditions of how BT works based upon our conditions of how the bluetooth will act.
  • Serial.available is the one type of the function.
  • Serial is used for the communication between the arduino and the other devices like computer,mobile phone etc.
  • All the Arduino board have RX pin and the TX pin.
  • Based up on these pin the BT make communication between the Arduino .
  • And Serial.Read() it reads the Incoming serial data from the bluetooth.
  • If(readString =="ON") this condition is true the led will ON.
  • If(readString =="OFF")  the led is OFF.
And finally, we conclude that we made the Connection between Arduino to Android using a Bluetooth Device.