Modify The HC-05 Bluetooth Module Defaults Using AT Commands

Picture of Modify The HC-05 Bluetooth Module Defaults Using AT Commands
September 4, 2013: Featured on
September 1, 2013: Featured on


In this guide, I will explain how to use Arduino to change the settings of the ubiquitous HC-05 Bluetooth module using the AT command set. The HC-05 comes with a rich set of AT commands to perform various tasks such as changing the module's default settings including changing the pass code, the device name, and the baud rate. But the process of switching the HC-05 into AT command mode for first time users of the module is not straight forward and the docs takes short cuts. There are a couple of ways to do this. I have picked the one I think is the easiest  I will do my best to illustrate the process in simple to follow steps. You can find the full set of AT commands in the attached datasheet.


The HC-05 Bluetooth module and its siblings are by far the most popular and inexpensive Bluetooth modules used for RF communications by microcontroller hackers. It costs less than $10 on ebay and it's easy to implement. I have published two guides based on the HC-05 Bluetooth module.  The first guide explains how to use the HC-05 with the Arduino. The second is an Android app that simplifies controlling Arduino from your smart phone over Bluetooth using the HC-05. In both cases, the default settings for the HC-05 were fine. 

In the process of using the HC-05 for a project, I ran into a situation where I needed to change the defaults for the module. For example, the default baud rate on the HC-05 is 9600. That's slow for high-speed transmission. The HC-05 can go as high as 1382400 baud rate according to the HC-05 reference. Also, the HC-05 has a default device name of HC-05. Having two or more of those devices in the same area can be confusing. You can use an AT command to change the device name. Also, the pin code default is 1234. You may wish to change that for some projects to ensure basic security.

After spending some time searching the web I realized many people are having a hard time changing the default settings for the HC-05. Switching the HC-05 from data transmission mode to configuration mode, to send AT commands to the HC-05, involves a few wiring and software acrobatics.  Add to the mix all the variations of the HC Bluetooth module family and the various vendor settings and you get the picture. 

This guide only covers the HC-05 module with the breakout board. 


The HC-05 is a 3.3V system but the breakout board offers current limiting resistors for some protection. While it's not advisable to keep the HC-05 connected to the 5V Arduino Uno pins, for this short exercise I decided to skip the voltage dividers which I use to drop 5V to 3.3V. I advise you to use voltage dividers whenever you connect the HC-05 pins to  5V pins such as the Arduino Uno. If you skip the voltage divider, do so at your own risk.
Remove these adsRemove these ads by Signing Up
1-40 of 127Next »
elias475 days ago

hello, thanks for everything you done.

my broblem is the HC 05 is not responding after verifying the wiring the code every thing many times, so could you tell me what could be the problem ???

thanks again .

returner8 days ago

Hi, i have a question and i hope you guys can help me with this. how does the arduino actually know actually know which data it is going to send or receive? in which part of the code does it do that? i want to make two arduinos one having a HC05 as a master sending data over to a HC06 slave on two different laptops. I hope you can answer me.

fansblink9 days ago

HC-05 bluetooth why I did not respond to anything when I type AT? please help, I want to change the name and passwordnyaa

dnwagner10 days ago

I've been searching and searching and I have not been able to find your sketch for this tutorial. (PS: Im new to BT and Arduino) week ago I thought a "sketch" was just a basic drawing of something...but now it also means Arduino code too. :-)

Hello, I'm having a problem. I followed all the instruction and can enter AT command mode. I entered "AT" but it returns like this. The same goes "AT+VERSION?". I try other commands like "AT+NAME=MYBLUE" but HC-05 name doesn't change. What is wrong in this case?


I have already configured my HC-05 as a master. I would like to communicate it with an android app where in this app will be used as the slave. I followed the instruction wherein i configured it at master using AT command. I would like to test if I can send data using HC-05 to android app so i run the program with the same code including BTSerial.write("test") at the last if statement hoping this data willl be send to my app, but it fail to do so. What can I do to test it? Thanks

I tried this tutorial with hc-05, with my arduino MEGA R3, but when i sent AT, the monitor didn't show anything. My module has EN instead of KEY. I soldered wire with Pin34 and gave it 5v But still sam problem.

Had the same problem today, look at for nice tutorial.

(keep in mind those options in serial monitor in arduino ide)

Also it seems that my module communicates ok both ways while in AT mode, and when in normal mode it only sends data to phone. the data i send from phone gets lost some ware, strange.. same issues anyone?

Hi. You need to finish the command with a terminator : AT /r/n or AT ENTER

For somme reasons , it's not the same on the hc-06 .

I've chimed in late. Does "finish the command..." deal with the differences needed for HC-06? Are you saying that 6 days asadsalehhayat is using a HC-06 and not a HC-05? Other than the terminator, is dealing with a HC-06 the same as a HC-05? Thanks...

I'm using an HC05

Hi, i only don't understand one thing. Let's say we want to put HC-05 in master mode and we do that successfully by sending the appropriate device. How does it know with which (slave) device to set up a connection with and how will it pair with it without knowing its password?!

Thanks! :)

Ok, I noticed that there's a bind command. So I should provide the master module with the slave's address. What about the slave's password?

sühab4 months ago

Dear Hazim, thank you for this very useful application. I have an EN pin instead of KEY pin on my HC05 and it does not seem to be connected to PIO11 (Pin34) (I have checked it with an AVO. Do you think short circuiting the EN pin with Pin34 will solve the problem?

My second question is, how can I pair the HC05 connected to an Arduino uno with an HC06 connected to an ATTiny 85?


Same problem. Do you got the solution???

Having same problem. Did u get any solution..?
VivekP4 months ago

How do we successfully connect two Bluetooth modules with each other (till the level of data transmission and reception)?

I have been able to link the two Bluetooth modules and connect them. But having pulled out the config pin (making the devices in the working mode), data transmission is not happening.

Some expert, Please help.

JayKai VivekP4 months ago

1. On both blue tooth devices, put the in AT mode, and type this command in the serial monitor: "AT+BAUD?". This should give you the current baud rate of the devices. The default for mine said it was 38400, but it was actually set to 9600. If it's not set to 9600, do so. Make this change in the code as well "BTSerial.begin(9600)". If you ever need to go back to the AT command, just do "BTSerial.begin(9600).

2. Make sure one of the Bluetooth is a master, and the other is a slave via the AT commands.

3. If you want to tell the Bluetooth device to only find each other. Find the address of both devices (write them down). Make sure that AT+CMOD is set to 0 for both devices. Finally use the AT+BIND command to apply eachother's addresses.

4. To send data from master to slave, use:

BTSerial.write(number or character);

To receive the data on your slave, use:

If (BTSerial.available())


Serial.println( );


Hope this helps and somewhat answers your question.

KemalB1 JayKai4 months ago

you are right about baudrate. normally hc-05 is baudrate 9600 but in this code wrote 38400 then I change to 9600 but program wasn't work. I was try to work along 3 hours as a 9600 baudrate but I didn't. then I didn't touch any code, just copy/past from original code, it was work. now I can use AT Commands with 38400.

There's no such thing as 'normally hc-05' - different manufacturers put different firmware with different commands and different capabilities.

JayKai JayKai4 months ago

I also made a typo. I say "If you ever need to go back to the AT command, just do "BTSerial.begin(9600)". That number should say 38400.

thanks.....nice information.

i have a question many bluetooth modules (HC-05) can be connected to bluetooth dongle?


Peter Weiss1 month ago

I have a HC-05 question : Can I use the AT Command "AT+PIO=2,1" to set the pio port 2 to High state "over the air"? I can set the pio 2 port to HIGH via UART (Rx-Tx) and it works fine, but not when HC-05 is wireless connected to a remote device.

You can't issue any AT commands over the air, only via the built-in UART.


I have a CZ-HC-05 Bluetooth module that I've wired to an Arduino UNO Rev3 per the instructions on this website. I have successfully gotten the LED to blink slowly (2 seconds on, 2 seconds off) indicating to me that I'm in AT command mode. However, when I open the serial monitor and type AT I don't get an OK response from the HC-05. I copied and pasted the code from this website into the Arduino IDE so I'm certain it's correct. My serial monitor is set to 9600 to match the serial port baud rate. I also set the serial port to Both NL & CR. I have tried typing AT\n\r as well and still no response from the HC-05. Can anyone help me?

The default rate for the BT module is 38400.

jean-lucG1 month ago


Thank you for the tutorial pdf and video, it worked fine.

I was wondering is it posible to connet the HC-05 to a speaker audio amp or do i nead a bluetooth audio module ?

There is a PCM outpout on the HC-05 but idon't know if it work.

Thank you


sagar.salwe1 month ago



Perhaps your HC-05 has a different default baud rate than 38400? Try changing the value in "BTSerial.begin(38400);" to one of the other possible baud rate values.

This is the program i written after that the HC 05 module will respond the x x x

and when i used baud rate of 9600 at that time it will respond the typed command as it is .

sagar.salwe1 month ago



Very useful set of instructions.

I have the same module but found that you could enter AT mode by disconnecting power to the HC-05, pressing the reset button on the module and reapplying power.

When initially connected the red LED would flash quickly. When in AT mode, the LED flashes much more slowly.

Thank you, this worked for me.

To clarify, you must:

1) disconnect power from module

2) press and hold the little button on the module

3) reconnect power and continue holding the button until you see the light blinking slowly

This is the module I'm using:

UFODesk3 months ago

HC-05 is not replyin... when it send AT it sends back nothin... please help

mak24 UFODesk1 month ago

Select the baud rate correctly, the baud rate should be 38400 for new modules for which baud rates have not been modified, also see if you are connecting the RX and TX pin correctly, Rx of the module should be connected to Tx of the Host and TX of the module to the RX of the Host. also keep in mind that Vcc and Key(or STATE) have to be pulled high at the same time, a 2Second blinking pulse signifies AT command mode, if now you send AT the module should respond, else either the module or the serial terminal has some problem

mak24 mak241 month ago

Sorry, its not the State pin it is the Key or the Wakeup pin

bahmed43 months ago

are you sure about connecting 5 volt directly to module, because as far as i know it operates at 3.3 volt???

mak24 bahmed41 month ago

There are different versions available, i have got 5V tolerant ones, work on both 3.3 and 5v

WhizzWr11 months ago

One IMPORTANT thing, Newline feed (\n) and Carriage return (\r) are needed on every AT command entered. So if you're using Arduino's serial monitor make sure you select "Both NL and CR" on the dropdown.

1-40 of 127Next »