I have used a HC-05 Bluetooth module which can be a master or a slave depending on the mode and a HC-06 Bluetooth module which is a slave.
Steps for HC-05 module:- The connections are shown in the schematic diagram. The Pin 34 should be kept high (3.3v) to ensure that the module enters into AT mode.
- In the Serial monitor type the command AT+ROLE=1. This sets the HC-05 in master role.
- The communication mode baud rate (9600 bauds) has to be the same on both the devices.
- We have to ensure that the passwords of both the devices should be same. This can be checked by typing AT+PSWD in the AT mode.
- For HC-05 in AT mode, we should send the command AT+RMAAD which clears any previously paired devices and after that, by entering AT+RESET, the HC-05 is reset. Then enter the command AT+CMODE=0 which allows the HC-05 to connect to any device. Now enter the AT+INQ command which searches for Bluetooth devices. For my HC-06, the HC-05 module returned +INQ: 7683:10:171179, 1F00,7FFF which has the address of the HC-06 module.
- For pairing the HC-05 to the HC-06, I used the command AT+PAIR=7683, 10, 171179,10. The pairing was successful and got an acknowledgement: OK.
- For binding, I used the command AT+BIND=7683, 10,171179 and then entered the command AT+CMODE=1 which makes the HC-05 connect to only paired devices. Entering the command AT+LINK=7683, 10,171179 in the HC-05 links the HC-05 to the HC-06.
- Now remove the pin34 to use the HC-05 communication mode and upload the code and test the chat.
This is the video URL: https://drive.google.com/open?id=0By8j-l_LkCjDelZONmJRWjJCYUE
Comments