Wall's Corners Wall's Corners Author
Title: ARDUINO BLUETOOTH INTERFACING – SIMPLEST TUTORIAL ON BLUETOOTH BASICS
Author: Wall's Corners
Rating 5 of 5 Des:
Ever thought of controlling any of your electronic devices with your smart phone? Your robot or any other device? Won’t it be cool to contro...

Ever thought of controlling any of your electronic devices with your smart phone? Your robot or any other device? Won’t it be cool to control them with your smartphone? Here is a simple and basic tutorial for interfacing an Android Smartphone with via Bluetooth. Arduino bluetooth Basic Tutorial!

What are the stuff required to do this project?

arduino bluetooth

Hardware

  1. Bluetooth Module HC 05/06
  2. Arduino & Battery (with cable)
  3. LED
  4. 220Ω Resistor
  5. Android device

Software

  1. Arduino IDE
  2. Android Studio.

 

The android studio is not really required here, since I will provide you with the android application I made. You can install the given .apk file to use the application. :)

How does it work?

There are three main parts to this project. An Android smartphone, a bluetooth transceiver and an Arduino.

arduino bluetooth

HC 05/06 works on serial communication. Here the android app is designed to send serial data to the bluetooth module when a button is pressed on the app. The bluetooth module at other end receives the data and sends it to the Ardunio through the TX pin of bluetooth module(connected to RX pin of Arduino). The code uploaded to Arduino checks the received data and compares. If received data is 1 the turns ON. And it turns OFF when received data is 0. You can open the serial monitor and watch the received data while connected.

STEP 1: Connecting the Arduino Bluetooth hardware

arduino bluetooth

The circuit is so simple and small. There are only four connections to be made between Arduino & Bluetooth module!!

Arduino Pins     Bluetooth Pins

RX (Pin 0)     ———>     TX

TX (Pin 1)     ———>      RX

5V                 ———>      VCC

GND             ———>      GND

Connect an LED positive to pin 13 of Arduino through a resistance(valued between 220Ω – 1KΩ). Connect its negative to GND. And you are done with the circuit! :)

arduino bluetooth

You can connect the Bluetooth module to the Arduino using a set of jumper wires and a connector.

Note : Don’t  Connect RX to RX and TX to TX of Bluetooth and Arduino. You will receive no data. Here TX means Transmit and RX means Receive.

STEP 2: Upload Sketch to Arduino

char data = 0;                //Variable for storing received data
void setup() 
{
  Serial.begin(9600);         //Sets the data rate in bits per second (baud) for serial data transmission
  pinMode(13, OUTPUT);        //Sets digital pin 13 as output pin
}
void loop()
{
  if(Serial.available() > 0)  // Send data only when you receive data:
  {
    data = Serial.read();      //Read the incoming data and store it into variable data
    Serial.print(data);        //Print Value inside data in Serial monitor
    Serial.print("\n");        //New line 
    if(data == '1')            //Checks whether value of data is equal to 1 
      digitalWrite(13, HIGH);  //If value is 1 then LED turns ON
    else if(data == '0')       //Checks whether value of data is equal to 0
      digitalWrite(13, LOW);   //If value is 0 then LED turns OFF
  }                            
 
}

Upload the given sketch to Arduino using the Arduino IDE software, you can also get it from here: Github

STEP3: Install the android application

arduino bluetooth

In this tutorial, I will not be covering Android app development. You can download the android application from here and the source code of the entire project.

  • Download the Application from Amazon App Store or Github
  • Pair your device with HC 05/06 bluetooth module:
  • 1. Turn ON HC 05/06 bluetooth module by powering the Arduino.
  • 2. Scan smartphone for available devices.
  • 3. Pair to HC 05/06 by entering default password 1234 OR 0000.
  • Install LED application on your android device.
  • Open the Application

arduino bluetooth

  • Press paired devices
  • Select your Bluetooth module from the List (HC-05/06)

arduino bluetooth

  • After connecting successfully, press ON button to turn ON LED and OFF button to turn OFF LED.
  • Disconnect button to disconnect from bluetooth module.
arduino bluetooth

And here is how it works!!

This is just basic tutorial on interfacing bluetooth module with Arduino. This project can improved to higher level like Home automation using smartphone, Smartphone controlled robot and much more.

You can watch the video tutorial over here:

 

Share This:

View more at: http://bit.ly/1XReQFr

About Author

Advertisement

Post a Comment

 
Top