Introduction: HOW TO? HC-05 Bluetooth MODULE AT Commands. With Button & No Button.
Hello world! Today i made a Tutorial about the HC-05 Bluetooth Module from multiple sources.
Because there are different types of HC-05 modules. And for some it works and for some it doesn't.
So i try my best to make one that works for everyone.
I will put the links to the sources at the end of the instructable.
I used a TTL USB programmer & Tera Term to do the JOB
Step 1 is about how to use it with a USB TTL and reset button.
Step 2 is about doing it with an arduino and No Reset button.
Step 3 is about The HC-06 Bluetooth module and some links to some good sources about the HC-05 & HC-06
Step 1: Setting Up a Master or Slave Module Using a USB TLL Progammer
NOTE: This might not count for everyone, but i had to unplug the 5v between the USB-TTL and HC-05 and hold the reset button on the HC-05 while plugging back the 5v wire. This way the led went flashing with a interval of 2 seconds indicating it went into AT command mode. If you don't have a reset button go to the next step.
HC-05 USB-TTL
VCC —–> +5V
GND —–> GND
Tx ——> Rx
Rx ——> Tx
KEY ——> +3.3V
We make use of a Terminal Software TERATERM to configure the MASTER.The advantages of this Terminal software are – It supports CR+LF Carriage Return and Line FEED after each command , which is a must for the HC-05 – It sends commands with zero Transmit delay , as the HC-05 module interprets commands immediately.
You can Download TERA TERMHere
Open the TERA TERM terminal & select SERIAL & the port number where the USB-TTL module is connected.
Under SETUP –> Terminal & select CR+LF at TRANSMIT, Also Enable Local echo.
Under SETUP –> SERIAL PORT select:
Baud Rate as 38400 ,
Data: 8bit
Parity: None,
Stop: 1bit
If you type in AT you should get an OK response.
Reset the module by issuing AT+ORGL which restores the module to original state.
You can change the name by typing AT+NAME=YOURDEVICENAM
AT+NAME=YOURDEVICENAME will change your HC-05 name to YOURDEVICENAME (fill in whatever you like)
AT+RMAAD will release the module from any previous PAIR.
AT+PSWD=1234 to set the password as 1234
AT+ROLE=1 changes the ROLE of the module to MASTER, 0 will set SLAVE
AT+UART=9600,1,0 Changes baud rate to 9600, 1 stop bit, 0 parity:
Read more here
Step 2: Setting AT Commands With a Arduino and No Reset Button on the HC-05
There are different HC-05 modules, but it works with all of them. On the picture you can see a bare HC-05 module, a 5V HC-05 module and a 6V HC-05 module with a button. I prefer the last one, as the button makes changing the settings easier.
To change any settings, the module should be in “AT Mode”. To do this, the “Key Pin” of the module should be set to “High”. This means you need to apply voltage to this pin at the same time you power the module.On the 6V HC-05 module, the button does this job. Just press it while powering the module with 5V. On the module without button, you need to supply 3.3V to the “Key Pin” while powering on.
How to connect:
First connect the Arduino to the PC over USB. Then connect the cables in the following way:
TX Bluetooth –> TX Arduino
RX Bluetooth –> RX Arduino
GND Bluetooth –> GND Arduino
5V Bluetooth to 5V Arduino by keeping the button of the Bluetooth pressed.
Or on the module without a button, connect the “Key Pin” to 3.3V on Arduino.
Note: bridge the GND and RST pins with a jumper. The Arduino should have a FTDI chip on it.
Now start TERATERM to configure the MASTER.The advantages of this Terminal software are – It supports CR+LF Carriage Return and Line FEED after each command , which is a must for the HC-05 – It sends commands with zero Transmit delay , as the HC-05 module interprets commands immediately.
You can Download TERA TERM Here
Open the TERA TERM terminal & select SERIAL & the port number where the USB-TTL module is connected.
Under SETUP –> Terminal & select CR+LF at TRANSMIT, Also Enable Local echo.
Under SETUP –> SERIAL PORT select:
Baud Rate as 38400 ,
Data: 8bit
Parity: None,
Stop: 1bit
If you type in AT you should get an OK response.
Reset the module by issuing AT+ORGL which restores the module to original state.
You can change the name by typing AT+NAME=YOURDEVICENAM
AT+NAME=YOURDEVICENAME will change your HC-05 name to YOURDEVICENAME (fill in whatever you like)
AT+RMAAD will release the module from any previous PAIR.
AT+PSWD=1234 to set the password as 1234
AT+ROLE=1 changes the ROLE of the module to MASTER
AT+UART=9600,1,0 Changes baud rate to 9600, 1 stop bit, 0 parity:
Read source here
Step 3: Setup the HC-06 Module (Slave Module by Default)
What is needed?
1 x USB to TTL microcontroller programmer to connect to your HC-06
How to connect the Programmer?
VCC to VCC
GND to GND
RXD to TX
TXD to RX
Lets get started...
connect the USB TTL programmer to the HC-06
Plug in the USB and open up The Arduino IDE
Open the serial monitor.
Type "AT" without quotes. You should see a respond in the Serial monitor saying "OK"
Type "AT+NAMExyz" Sets the module name to “xyz” (Replace xyz with the name you want.) response should be OKsetname.
Type "AT+PIN1234" Sets the pin to 1234 (replace 1234 with your desired pin) respond should be OKsetPIN For more info on changing baudrate etc. i included a PDF file. Good luck!
Great wiki documentation about the HC-05 + Datasheet at the bottom of the page : Find it here
http://wiki.iteadstudio.com/Serial_Port_Bluetooth_Module_(Master/Slave)_:_HC-05
Another documentation about the HC-06: Find it here
http://wiki.iteadstudio.com/Serial_Port_Bluetooth_Module_(Slave):_HC-06