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 74Next »

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

stsoky3 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,

loiphin1 month 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!2 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 vomov2 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 rwaliya2 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.

jiddoabdo3 months ago
lafiona4 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?

agentnoise4 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
WhizzWr6 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.

shanX WhizzWr5 months ago

THANKS!! THAT WAS NEEDED :) :)

accio5 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!

samuelee6 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 samuelee6 months ago

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

_MeRKeZ_6 months ago

That's a great work. Thanks Mr.

CATFARTS27 months ago

Have spent hours, but still get no response to AT commands. My HC-05 is purported to run at 9600 out of box, but no dice setting BTSerial.begin to either 9600 or original 38400 setting. Wiring and order of operations is correct and AT mode blinking is there - I even tried Wenabe's method, but that just put me into data mode (fast blinking) and didnt go back to AT mode. Have tried every line end option but there is absolutely no reply. When I send any text to UNO, only the rx LED lights up and there is no activity in tx LED.

Any help is appreciated.

Goines7 months ago

Thanks a lot, I've managed to get my HC-05 fully loaded up the way I'd like it to be!

I do have one problem though; no devices I have (Windows machines, or phone) will automatically reconnect via Bluetooth when the power is cycled to the HC-05. Have you had problems with this, or do you know how to get previous pairs to re-establish themselves?

Thanks again

Excellent guide, really helpful and well written. Thanks for submitting it.

kf5qgf7 months ago

Just a note, I couldn't get this to work on an Arduino Leonardo, but it does work great on the Arduino Uno.

1-40 of 74Next »