Difference between revisions of "Bluetooth Module (HC-06) + Arduino"
|Line 31:||Line 31:|
''Video Demonstration of Set-Up''
''Video Demonstration of Set-Up''
Revision as of 23:31, 3 May 2018
The HC-06 bluetooth module is a slave bluetooth module designed for wireless serial communication. It is a slave module meaning that it can receive serial data when serial data is sent out from a master bluetooth device(device able to send serial data through the air: smart phones, PC).When the module receives wireless data, it is sent out through the serial interface exactly at it is received. No source code specific to the Bluetooth module is needed at all in the arduino chip. An app on the phone is used to send out inputs to the module which receives and then transfers this to the arduino. The arduino and actuators in turn responds accordingly, as specified in the source code. When the module is not in a paired state, the LED on the module blinks rapidly whereas when paired with the app on the phone, the LED on the module is a steady red.
This is the HC-06 Bluetooth module that we purchased for our project.
Fig 1. shows the HC-06 bluetooth module diagram.
Connection between the Arduino and HC-06
The HC-06 module has four pins which are all required in order to make a connection with the arduino UNO. The VCC pin is where the module receives its input voltage and is thus connected to the 5V pin on the arduino. The GND on the module is the ground pin which connects to the ground pin on the arduino. In other words, it is the reference point from where all the other voltages are measured. The RXD and TXD are the recieve and the transfer pins respectively on the module. The module receives the serial data from the master device (smartphone) through the RXD pin and then transfers that data to the arduino using the TXD pin. The TXD pin on the module is connected directly to the RX pin on the arduino whereas the RXD pin of the module is connected to the TX pin on the arduino using a voltage divider circuit as the RXD on the module can only support voltage upto 3.3V.
The Voltage Divider Circuit
A voltage divider circuit was set up between the RXD pin of the HC-06 and the Tx pin on the arduino so that the voltage used for the serial communication is 3.3 V. Thus, we used two resistors in series; 15kΩ as R1 and 7.5kΩ as R2. The RXD of the module was connected between the two resistors and the Tx of the arduino was connected across R2.
Fig 2. Shows the connection between the arduino and the HC-06 module (on the right).
Setting up the HC-06 through AT commands
The AT commands mode is used to change the default settings of the HC-06 bluetooth module. Parameters such as the module name, password, baud rate, signal strength can be changed after entering AT commands mode. In order to enter the AT commands mode, the module should not be paired to any of the nearby devices but should be connected to the arduino. Through the serial monitor on the arduino IDE, AT commands can be send to the module. In our case, we changed the pairing password between the app and the module to strengthen authentication.
Typing ‘AT+PIN’ in the serial monitor yields the default password for the pairing between the module and the app. The default password for all the HC-06 modules is ‘1234’. We changed this to ‘7684’. By simply entering AT command mode and sending out the following command through the serial monitor: ‘AT+PIN7684’ and then pressing enter.
- Video Demonstration of Set-Up