Configure HC-05 Bluetooth As Master and Slave

by Explorato_Technomentis in Circuits > Arduino

124 Views, 0 Favorites, 0 Comments

Configure HC-05 Bluetooth As Master and Slave

20170707_124941.jpg
hc05.jpg

In some projects, there is need for communication between two Bluetooth Devices so that wireless data can be transferred . For communication between two Bluetooth devices, they must be configured as Master and Slave. This instructable comprehensively covers all the steps required for beginners to configure their Bluetooth modules into master and slave mode.

Components Required

  1. Arduino Uno R3 x 1
  2. USB cable x 1
  3. HC-05 Bluetooth Module x 2
  4. Breadboard x 1
  5. Connecting wires (Male - Female) x 5

Upload the Arduino Sketch

Interfacing the Bluetooth Module With Arduino

Arduino_BT_Master_Slave_bb.jpg

HC-05 Bluetooth Module is a wireless communication module that transmits data serially.

  1. VCC pin of HC-05 is connected to +5V
  2. GND pin is connected to GND of the microcontroller.
  3. EN is the Enable pin.
  4. It is used to configure the module in AP mode.
  5. RX pin refers to receiver
  6. TX pin refers to transmitter.

Circuit Connections:

  1. Connect the Female end of all the Male to Female wire to the VCC, GND, RX and TX pins of the HC-05.
  2. Connect the GND of HC-05 to the GND of Arduino Board.
  3. Connect the RX of the HC-05 to Digital Pin 11 of Arduino Board.
  4. Connect the TX of the HC-05 to Digital Pin 10 of Arduino Board.
  5. Leave the VCC Pin Floating.
  6. Now keep reset of Bluetooth module pressed and connect VCC to Arduino VCC.
  7. The Bluetooth LED should blink every 2 seconds. This shows that the BT is now in AT mode.

Configure Bluetooth As a Slave

Now open the Serial monitor and write following commands:

  1. Type “AT” and Press Enter. This is used to Confirm that we are in AT Mode
  2. You should get a response which says “OK”.
  3. Type “AT+ROLE=0” and Press Enter. With this command, we are Configuring the Bluetooth device as Slave.
  4. You should get a response which says “OK”.
  5. Now Type “AT+ROLE?” and Press Enter. With this command, we are confirming that Bluetooth Device is in Slave Mode.
  6. You should get a response which says “0”.
  7. Now Type “AT+ADDR?” and Press Enter. With this command, we are checking the address of Bluetooth Device.
  8. You should get a response which says something like this. “98d3:32:708b76”.
  9. Save the above address. This address will be used for pairing this Bluetooth device with the master device.

Configure Bluetooth As Master

  1. Connect the other Bluetooth module in AT mode to the Arduino Board with the same connections.
  2. Now open Serial Monitor and again type “AT”
  3. You should get a response which says “OK”.
  4. Type “AT+ROLE=1” and Press Enter. With this command, we are configuring the Bluetooth device as Master.
  5. You should get a response which says “OK”.
  6. Now Type “AT+ROLE?” and Press Enter. With this command, we are confirming that Bluetooth Device is in Master Mode.
  7. You should get a response which says “1”.
  8. Now Type “AT+CMODE=0” and Press Enter. With this command, we are asking the Bluetooth device to communicate with the fixed address.
  9. Now Type “AT+BIND=98d3,32,708b76”. This is the address of Slave Bluetooth device that you have saved. Note:Replace the “:” in the Address with “,”.
  10. You should get a response which says “OK”. Now the Bluetooth Devices are configured as Master and Slave.