Interfacing Arduino with Bluetooth Module

Interfacing Arduino with Bluetooth Module

Hello guys! Today in this tutorial I am going to show you how to interface HC-05/HC-06 Bluetooth module.

For this tutorial we need:
                1) Arduino Uno
                2) HC-05/HC-06 Bluetooth Module
                3) An Arduino Cable
                4) PC or Laptop

 

Arduino Uno                                   HC-05/HC-06 Bluetooth Module

Arduino_unoHC-05_robogearsbd

 

The steps are really very simple. Trust me after this tutorial you will say, interfacing this module is much easier than you thought.

Below I attached the diagram how to connect the Bluetooth module with the Arduino.

 

Arduino-Bluetooth Using Soft Swrial

 

Now upload the code below to your Arduino board

#include <SoftwareSerial.h>
SoftwareSerial bluetooth(10, 11); // Connection pins for bluetooth RX & TX. 
//I used software serial so that you can upload the code even with the bluetooth module connected.
int recieved;
void setup() {
pinMode(13,OUTPUT);
Serial.begin(9600);
bluetooth.begin(9600);
digitalWrite(13,0);
}

void loop() 
{
while (bluetooth.available()) { // Recieves Data from bluetooth and stores in recieved variable
recieved = bluetooth.read();

Serial.println(recieved); // Prints the last recieved data.
delay(50); 
}
}

Now download the Arduino Bluetooth Controller from play store. Connect it and try it.
When you press a button it gives a value like 1,2,3 or 4 and when you release the button it shows 255. This settings is done in the app to detect when the button is released.

So, Here you go. You can now send commands from you android to your Arduino Board via Bluetooth.

Still if you have any problem you can comment below.

Thank You

 

 

 


What are your thoughts?