Instructables

Modify The HC-05 Bluetooth Module Defaults Using AT Commands

Picture of Modify The HC-05 Bluetooth Module Defaults Using AT Commands
UPDATES
September 4, 2013: Featured on Hackaday.com http://goo.gl/qxvWkd
September 1, 2013: Featured on DangerousPrototypes.com http://goo.gl/K4kH9g

INTRODUCTION

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.


BACKGROUND

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. 

WARNING

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 79Next »
kapilk14 minutes ago

Hi,I am new in working with bluetooth modules.I bought JY MCU v1.06 HC05 module.I need to configure the baud rate,i tried the wiring done by you in video.but there is no response from module.where as i am able to pair it with PC and also my android phone.but not able to get in AT mode.I am using ATmega32..is it mandatory to connect TXD and RXD of module?..also can you pls tell me how AT commands are responded by BT module

VivekP2 days 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.

I try this tutorial with btbee pro hc-05,with my arduino leonardo,but when i sent AT, the monitor didn't show nothing,;i m so certain that my wiring is correct.I changed another new btbee pro hc-05,but dindn't work.Help me please.thanks.

JayKai7 days ago

I got this working for the Arduino Uno as instructed here. Has anyone got it working successfully for the Arduino Mini Pro? I pretty much get the same issue as everyone else where there is no response after sending the "AT" command. I have the same setup as the Arduino Uno.

WhizzWr7 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.

JeffW3 WhizzWr9 days ago

Thanks for this!

shanX WhizzWr6 months ago

THANKS!! THAT WAS NEEDED :) :)

Hello Everyone Eh Created a program to Set all parameters of a Hc-05 Bluetooth Module, arduino By,

Is Very Intuitive and shows the potential of these modules,

download:

https://mega.co.nz/#!IlgEhL7D!49AyfrlgPI2pjhWUyRTM...

Various Tools As has:

Slave Name

The Error Manager

The Finder Device

Configure All in one

etc

Since the program is written in Basic, the Deputy Pograma compiled and Soft for uploading to the Arduino

It is compatible with Arduino Uno, Duemilanove, Nano, MiniPro, Etc

Requirements,

Micro: ATmega328P

Clock: 16Mhz

Baud: 4800

Send the CR at the end of any order.

regards

BluLoader.png

Hello Everyone Eh Created a program to Set all parameters of a Hc-05 Bluetooth Module, arduino By,

Is Very Intuitive and shows the potential of these modules,

download:

https://mega.co.nz/#!IlgEhL7D!49AyfrlgPI2pjhWUyRTM...

Various Tools As has:

Slave Name

The Error Manager

The Finder Device

Configure All in one

etc

Since the program is written in Basic, the Deputy Pograma compiled and Soft for uploading to the Arduino

It is compatible with Arduino Uno, Duemilanove, Nano, MiniPro, Etc

Requirements,

Micro: ATmega328P

Clock: 16Mhz

Baud: 4800

Send the CR at the end of any order.

regards

BluLoader.png

Hello Everyone Eh Created a program to Set all parameters of a Hc-05 Bluetooth Module, arduino By,

Is Very Intuitive and shows the potential of these modules,

download:

https://mega.co.nz/#!IlgEhL7D!49AyfrlgPI2pjhWUyRTM...

Various Tools As has:

Slave Name

The Error Manager

The Finder Device

Configure All in one

etc

Since the program is written in Basic, the Deputy Pograma compiled and Soft for uploading to the Arduino

It is compatible with Arduino Uno, Duemilanove, Nano, MiniPro, Etc

Requirements,

Micro: ATmega328P

Clock: 16Mhz

Baud: 4800

Send the CR at the end of any order.

regards

BluLoader.png

Hello Everyone Eh Created a program to Set all parameters of a Hc-05 Bluetooth Module, arduino By,

Is Very Intuitive and shows the potential of these modules,

download:

https://mega.co.nz/#!IlgEhL7D!49AyfrlgPI2pjhWUyRTM...

Various Tools As has:

Slave Name

The Error Manager

The Finder Device

Configure All in one

etc

Since the program is written in Basic, the Deputy Pograma compiled and Soft for uploading to the Arduino

It is compatible with Arduino Uno, Duemilanove, Nano, MiniPro, Etc

Requirements,

Micro: ATmega328P

Clock: 16Mhz

Baud: 4800

Send the CR at the end of any order.

regards

BluLoader.png

I have tried your method of putting the HC-05 module AT command mode with no luck. However, I have discovered that there are some models with a small button that you can hold down while it is powering up that will put it into AT command mode.

can u tell me what is the procedure for it.,

i have that small button type HC-05

can u tell me what is the procedure for it.,

i have that small button type HC-05

can u tell me what is the procedure for it.,

i have that small button type HC-05

stsoky4 months ago

Hi,

I try everything, but still does not work.

1. problem

I have not blinking led, I do not how, but nothing blinkig when I connect arduino and HC-05. I checked few times conneciton.

2. problem

After some time i get this silly result when I try AT command in Serial Port:
Try to solve this with different baudrate (try on Win8 and Linux Mint)


2.1 ( BTSerial.begin(9600) ) whatever i send to arduino on serial I get same command,

Tx = AT; Rx=AT ..

2.2 (BTSerial.begin(38400) ) if I send command "AT" I get "xxø", for different command different simbols.

2.3 (BTSerial.begin(1382400)) for "AT" got nothing.


3. Also I try case with 3.3V on Key, but unfortunetly that also did not work.

Some idea or solution?


JDEAN73 stsoky1 month ago

Exact same problem! Any luck with solving this stsoky? Or anyone else?

me also exact same problem, any one rectified it?

abhi9nav1 month ago

how to change password

AT+HELP will list your command set

abhi9nav1 month ago

how to change password

abhi9nav1 month ago

how to change password

abhi9nav1 month ago

how to change password

abhi9nav1 month ago

hi

i am using hc-05 for my project,

how to change its password ;

please tell me in simple way,

abhi9nav1 month ago

hi

i am using hc-05 for my project,

how to change its password ;

please tell me in simple way,

loiphin2 months ago

After messing around with it for a couple of hours I finally got it to work!! I did a bit differently....

I used Windows 8 plus Arduino 1.05 on a Arduino Uno R3

My particular HC-05 was defaulting to 38400 BAUD. Therefore I changed the Terminal emulation speed within Arduino Serial Monitor to 38400 + Both NL + CR on the bottom right.

Then changed the program to also be 38400 (ie, Serial.begin(38400);)

Looks like the speed mismatch wasn't allowing it to work properly.

Also to get it into command mode, I followed the original instructions by applying the Vcc to the HC-05 after booting the Arduino Uno. You will know its in command mode when the LED blinks slowly on and off, around 2 seconds between on/off.

Once the HC-05 is in command mode you can then reboot the Arduino and mess withe the code to your hearts content, to get it to work. As long as you dont remove the power the HC-05 will stay in command mode (slow blink on the LED).

Hope it helps:)

loiphin.

Stouf_2 months ago

Thanks for the command ref PDF, it's very usefull !

rfuentes5 made it!3 months ago

SUCCESS! thx, definitelly this method will work, no matter what, with the correct module, take a look if your module's HC-05 or HC-06

IMG_20140604_112541.jpg
mtran26 rfuentes52 months ago

Hi rfuentes5. I tried step by step, the LED is blinking every 2s (I found it longer than that) but in serial monitor whatever I typed it doesn't respone. I bought the HC-05 from amazon

http://www.amazon.com/gp/product/B00JP05S6C/ref=oh...

I even changed BTSerial.begin(9600); but still no respone. Do you have any idea?

vomov5 months ago

I'm using your code, which gives me the 'OK' after I send 'AT', and I have even succeeded in renaming it. However, if I do this: AT+NAME=THINGY, it gives it the name of "=THINGY". Aside from this, no other commands seem to do anything. Any advice?

rwaliya vomov3 months ago

for name, check you have put only one '=' sign.

and for other changes the AT commands refer this link : http://makezineblog.files.wordpress.com/2014/03/hc_hc-05-user-instructions-bluetooth.pdf

vomov rwaliya3 months ago

I already figured it out; it turns out there are different ways of working with the AT commands, one of which (cheap Chinese knockoff) only uses a tiny subset of commands and does not require the '=' sign. I now also have another bluetooth module, which works as it should.

Also, thanks for the link: there was a command I was curious about that followed from the text in the pdf.

jiddoabdo4 months ago
lafiona5 months ago

I have try use AT command for getting the RSSI value.

I'm trying the command "at+inq\n\r" (from datasheet)
but i only get OK and i can't understand that,

can you help me to find where the mistake is?

agentnoise5 months ago

I am unable to get this to work at all. I have gone over these steps 40 million times, any ideas why it might not be working? I have tried Wenabe's method too, and it will not work.

I know you have to first right the key pin high and then connect the 5v but even doing that wont work.

I figured it out. Mine has a button that you have to hold down while it boots in order to right the pin high.

bstott made it!5 months ago

Thanks for the education.

ArduDroid-testing.jpg
accio6 months ago

With Mega, Mega 2560 and Leonardo not all the pins can be used to connect with the HC-05 via SoftwareSerial Library (used in the sketch).

Check http://arduino.cc/en/Reference/SoftwareSerial#.UxIQbXk1jFE

Once I found the right pins, I was able to use the HC_05.ino as is. Very useful!

samuelee7 months ago

Thanks for your instructions !

Unfortunately, after I've connected the circuit, there was no reaction when I applied AT command. Please kindly give your advice !

Details of my equipment :

  1. Arduino UNO R3

2. BT-Board V1.4

samuelee samuelee7 months ago

The LED on the BT board blinked rapidly (not 2-second blinking) throughout the experiment.

1-40 of 79Next »