Skip to main content

Arduino interfacing with Bluetooth module HC05 and HC06

Bluetooth (HC05) and Arduino project: -

In this project i will teach you how to connect a Bluetooth module with Arduino and how to control each pin of Arduino with using your Phone.

Bluetooth HC05 or HC06: -

 A Bluetooth module is a short range communication device which are capable of sending any kind of data in range of 15 to 20 meter and it's operating frequency band is 2.4GHz ISM band.Both are easily available things and can be obtain from near electronic shop or online stores.




1.1 Bluetooth HC-05 Pin-Out: -
·         KEY: If brought HIGH before power is applied, forces AT Command Setup Mode. LED blinks slowly        (2 seconds)
·           VCC: +5 PowerSupply.
           GND:  System / Arduino Ground.
           TXD: Transmit Serial Data from HC-05 to Arduino Serial Receive. 
           NOTE: 3.3V HIGH level: OK for Arduino
·            RXD: Receive Serial Data from Arduino Serial Transmit
           STATE: Tells if connected or not


1.2 Bluetooth HC-05 Specifications: -
·         2.45Ghz Frequency
·         Asynchronous Speed 2.1Mbps (max) .160Kbps
·         Security: Authentication
·         Profile:   Bluetooth Serial Port
·         Power Supply: +3.3 V DC
·         Working Temperature: >20C
·         Cost:  Around Rs. 300



2.    Component required in this project: -

·         Table of Component required: -
             
S no.
Component
Quantity
1
Arduino board
1
2.
Bluetooth HC05
1
3.
1k and 2k resister.
Each of one
4.
Android phone with ArduiDroid app
1











Figure 2: Component required in this project. 

3.    ARDUINO interfacing with Bluetooth HC-05: - A Bluetooth model HC05 is device which can work in both master and slave mode. Pins connection of Arduino to Bluetooth is shown below.

Table of connections: -

S no.
Bluetooth pins
Arduino pins
1.
Vcc.
+5v dc
2.
Gnd.
Gnd
3.
Tx.
Rx pin 0
4
Rx
Tx pin1


here are the link for component and other important things: -
Bluetooth HC05: - Bluetooth HC05 Data sheet pdf

Note: don't forget to use the resister in circuit, otherwise your Bluetooth module may get                   damage.

here is your code for controlling any digital pin of Arduino with you phone. copy the below code and enjoy it with you Bluetooth hc05.


void setup() 
{
  Serial.begin(9600);
  Serial.println("HEllow frome Bluetooth");
  Serial.flush();
}
void loop()
{
  Serial.flush();

  int pin_num = 0;
  int pin_value = 0;
  int get_char ='0';
  
  
  if (Serial.available() < 1) return; // if serial empty, return to loop().
  get_char = Serial.read();
  
  pin_num = Serial.parseInt(); 
  pin_value = Serial.parseInt();  

  set_digitalwrite( pin_num, pin_value);

 }

void set_digitalwrite(int pin_num, int pin_value)
{
  switch (pin_num) 
  {
  case 13:
    pinMode(13, OUTPUT);
    digitalWrite(13, pin_value);  
    // add your code here      
    break;
  
  case 12:
    pinMode(12, OUTPUT);
    digitalWrite(12, pin_value);   
    // add your code here       
    break;

  //case 11:
   // pinMode(11, OUTPUT);
   // digitalWrite(11, pin_value);         
    // add your code here 
   // break;
  
  //case 10:
    //pinMode(10, OUTPUT);
   // digitalWrite(10, pin_value);         
    // add your code here 
   // break;

  case 9:
    pinMode(9, OUTPUT);
    digitalWrite(9, pin_value);         
    // add your code here 
    break;
  
  case 8:
    pinMode(8, OUTPUT);
    digitalWrite(8, pin_value);         
    // add your code here 
    break;
  
  case 7:
    pinMode(7, OUTPUT);
    digitalWrite(7, pin_value);         
    // add your code here 
    break;
  
  case 6:
    pinMode(6, OUTPUT);
    digitalWrite(6, pin_value);         
    // add your code here 
    break;
  
  case 5:
    pinMode(5, OUTPUT);
    digitalWrite(5, pin_value); 
    // add your code here       
    break;
  
  case 4:
    pinMode(4, OUTPUT);
    digitalWrite(4, pin_value);         
    // add your code here 
    break;

  case 3:
    pinMode(3, OUTPUT);
    digitalWrite(3, pin_value);         
    // add your code here 
    break;
  
  case 2:
    pinMode(2, OUTPUT);
    digitalWrite(2, pin_value); 
    digitalWrite(2,HIGH); 
    delay(2000);
    digitalWrite(2,LOW); // add your code here       
    break;      
  
   default: 
    return ;
    // if nothing else matches, do the default
    // default is optional
  } 
}

Further extension of this project:

in this project i have just introduce you to Bluetooth but there are some kind of different project can be made with you Bluetooth module and it capabilities are much more than this.
1. Serial massage and data can be send from phone to Arduino and Arduino to phone.
2.Any sensor can be connected to Arduino and could be control it with you phone with help of ArduiDroid app. like Servo, LED, motor, and any kind of Actuator and sensor.

Comments

Popular posts from this blog

Smart Home Door lock system project.

RFID MFRC522  Door lock system Project summary: RFID system radio frequency identification in which Information is written in the card or tag is get read by RFID module when they get in contact. In this project we are making a home lock system which would open only when an authorized card will be available and access will be denied on wrong card. Component require: - In this project we are interfacing Arduino board with RFID MFRC522 and servo motor. RFID system would send data to Arduino board and according to that data action would be taken by Arduino board. Components are listed below:         ·          Arduino board.         ·          Arduino software.         ·          RFID MFRC522 board.         ·        ...

Arduino interfacing with capacitive touch sensor

  Arduino interfacing with capacitive touch sensor 1.     Digital touch sensor     A capacitive touch sensor is same as our android phone screen.  C apacitive touch sensing is a way of human touch sensing, that requires little or no force to activate. It may be used to sense human touch through more than a quarter of an inch of plastic, wood, ceramic or other insulating material (not any kind of metal though), enabling the sensor to be completely visually concealed.     Specifications of touch sensor:  - This touch sensor is a capacitive touch sensor which                 works on active capacitor which get create when any person touches it, just like our phone                   screen.                                           ...

RFID-MFRC522 with Arduino Board.

1.     RFID MFRC522:        A normal RFID kit is just like our ATM card which can send a specific data to controller when it gets in touch with its reader module.       MFRC522 is name of controller which is being used in this RFID kit.   Figure 1 : RFID MRFC522      1.1 Specifications of RFID MFRC22 Module Name:MF522-ED Working current : 13 - 26mA / DC 3.3V Standby current : 10 - 13mA / DC 3.3V Sleep current : <80uA Peak current : <30mA Working frequency : 13.56MHz Card reading distance : 0 ~ 60mm ( Mifare1 card ) Protocol : SPI. Data communication speed : 10Mbit/s Max. Card types supported: Mifare1  S50, Mifare1 S70, Mifare UltraLight, Mifare Pro, Mifare  Desfire Dimension : 40mm × 60mm Working temperature : -20—80 degree Storage temperature : -40—85 degree Humidity : relevant humidity 5%—95% This RFID kit works on the...