In this article I will explain how to configure hc-05 bluetooth module configuration with arduino. I will also tell you the AT commands that we will use to set the hc-05 bluetooth module to master mode.
- What are the features of the HC-05 bluetooth module?
- HC-05 bluetooth connection with Arduino
- How to configure the HC-05 bluetooth configuration?
- How to use HC-05 AT commands
It allows you to produce remote control projects with Bluetooth module. You can also control any device in your home with a mobile phone or tablet and design tools that you can control with smart devices.
What are the features of the HC-05 bluetooth module?
The HC-05 Bluetooth module, HC-06, is the most important feature that distinguishes the Bluetooth module from the HC-06 module. This means that you can use the HC-05 Bluetooth module to send data to other Bluetooth modules. With this feature you can transfer data via bluetooth between two arduino without the need for smart devices.
Hc-05 bluetooth module is bluetooth 3.0 version because IOS can not use on smart devices installed. For use with the IOS operating system, you need to use the HM-10 bluetooth module that supports the bluetooth version 4.0.
In order to use the HC-05 module as a transmitter, we need to take the bluetooth role to master mode. We need to know the AT commands to use the hc-05 bluetooth module with the master role.
How to connect HC-05 bluetooth module with arduino?
Communication between Arduino and bluetooth is provided by Tx and Rx pins on arduino and bluetooth. We can use the SoftwareSerial.h library in arduino to select the digital pins we want in the Arduino as Tx and Rx pins.
See the diagram below for arduino connection with hc-05 bluetooth.
Now let’s examine the HC-05 bluetooth configuration settings and the HC-05 AT commands.
How to configure the HC-05 bluetooth configuration?
In HC-05 configuration mode, we can change the settings of the bluetooh module using the AT commands. For example the name of the visible bluetooth, bluetooth password, or the role of slave or master.
Install the following codes on the arduino card.
SoftwareSerial BTSerial(10, 11); // TX | RX
Serial.println("Now configuration mode:");
After installing the codes, we disconnect the arduino computer connection cable. Hold down the small button on the HC-05 and connect the arduino cable back to the computer. Now the red light on the bluetooth will flash at 3 second intervals. This means that the HC-05 module has switched to the configuration mode.
Now open the Serial monitor by pressing Ctrl + Shift + M or Tools menu in the arduino program.
After selecting the fields above, close the serial monitor and reopen it. Now that we have typed AT in capital letters, the configuration mode has been successfully passed if OK is displayed.
What are the HC-05 bluetooth AT commands?
AT commands are used to learn some information about the bluetooth module or to change settings.
- AT + NAME ?: With this command, we can see the display name of the module on other devices. HC-05 is the standard name.
- AT + NAME = new_name: With this command, we can change the name of the module.
- AT + PSWD ?: With this command we can see the password of the module. Standard password is 1234.
- AT + PSWD = new_password: We can change the password of the module. You can set a password that you want to place in the new_password.
- AT + ROLE? : With this command, we can see the role mode in which the module is used. Slave: 0, Master: 1, and Loop-Slave: 2. The default mode is the slave mode.
- AT + ROLE = 1: You can change the role mode of the bluetooth module. 1 to the master role mode.
- AT + VERSION? We can see the Bluetooth version.
- AT + ORGL: This command sets the module to the factory settings and resets all settings. You can use it when you forget the Bluetooth module password.
- AT + ADDER? : With this command we can see the address of the bluetooth module.
- AT + UART? : With this command, you can display the bluetooth module baund rate setting.
- AT + UART = 9600,0.0: With this command, we can change the baund rate of the bluetooth module.
In this article, we have learned about the HC-05 bluetooth module arduino connection, switching to HC-05 configuration mode and viewing or changing AT commands and bluetooth settings.