Instructables
loading
loading

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 155Next »
bharat2413 days ago
In my Bluetooth module it has wake up pin instead of key pin what to do plzz solve
gnuarm1 month ago

I tried using an HC-05 module with Putty on my windows 8 PC. When I
hit enter on a command I get the response I expect, but it repeats
indefinitely until I hit another key. I switched to Terraterm and that
program doesn't have the same problem. Any idea what is going on? I can
use Teraterm for the time being, but I'd like to know what is up with
Putty so I can trust it for other projects.

gnuarm gnuarm28 days ago

I switched to another terminal program, Terraterm and it worked better. But when I try to talk to it from a Raspberry Pi using the same USB dongle it doesn't work at all. I find this very frustrating. Sometimes it works, sometimes it doesn't and the way it fails to work is very different. I've tried two different modules which give the same results.

Ultimately I want to control this device from a small, MCU eval board. Before I do that I want to be able to control it from my computers using a terminal emulator.

sühab9 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?

Cheers.

duwageM sühab4 months ago

Dear friend,

In my Hc-05 have tiny push button to put AT mode.

what i doing to put configure mode

1) disconnect power pin.

2) press the tiny push button

3) same time connect the power.

Done.

download.jpg
LordL duwageM1 month ago

Thanks. This was very helpful. Have been trying and suspected that the pushbutton had something to do with it.

EN pin should be the same as KEY pin. The default baud rate in AT command mode is different for different devices. My HC05 had it set at 9600. Try setting different baud rate and see if that solves the problem.

Same problem. Do you got the solution???

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

hii,,
Because not all of hc-05 can be configured, I recommend you use the HC-05 as it is drawn.
Follow the instructions and programs,

sETTING HC-05.jpg

We are using your circuit connections and a well Arduino code. But the AT commands are not working in 38400 baud rate. And if we upload some other code to Arduino, the HC-05 will not even turn ON. Can you please help me in this....

If you still wasn't able to solve this, there's a button on the Bluetooth module. press that button until it blinks like per 2 seconds and there you have it.
Been solving this for days...

mohamedS151 month ago

Can I remove pin Check !!
I mean pairing with module but without from fixed address but without entering "1234"

csshandy3 months ago

I have followed this tutorial and others on the internet and am getting the board into AT mode and my board is responding however it is responding in absolute gibberish for example I type AT with both NL & CR on and a baud rate of 9600 on the serial monitor and I get result of ϧ†…ÿ or some other variation of the same code I have tried and tested playing around with different baud rates I have several different hc-05 they all give me the same I have connected the RX, TX in the schematic the way it is labelled and reversed and I am still getting no luck can anyone give me some helpful information I don't have ausb ttl converter and would prefer not to wait for one, any help would be appreciated.

Thanks in advance, Chris.

AndrzejK23 months ago

It doesn't working. My BT module don't want to be in config. mode...

MiloslavN3 months ago

To all having strange characters in serial monitor:

As I read in the comments, it happens on linux only (also using linux) but with newest arduino ide (1.6.1) this problem dissapeared.

GeroS1 MiloslavN3 months ago

Thanks a lot. Your post helped me resolve the issue I was facing. Finally clear text in the terminal.

Thanks bro!

I donwload arduino IDE 1.6.1 and re-upload the code and its works!!

hi All! i'm using FB155BC as the bluetooth module. i had a response "OK" by typing AT but i got "ERROR" by typing AT+BTRSSI? .

i use Arduino 1.0.6.

could somebody help me?

thanks

Whether you go through the tutorial above?
Can you please tell me in advance when your configuration details, because this is related to the program and the bluetooth module. In order to find an appropriate answer

Explain to when you before entering the AT-command?

Orang Indonesia,

Hi TheKoobay,

orang indonesia?

yes i am!

so it did works with my configuration. i'm using hyperterminal instead of Serial Monitor in Arduino. Finally i got the AT+BTRSSI value in slave mode, but not in master mode. In master mode (FB155BC), i can't connect it with my smartphone.

So know i'm working on it.

Regards

Smartphones can not connect, if HC-05 be set as "master" !!!
Try to change the HC-05 as a "slave", now you try to connect with your smarphone.


You can restart the Configuration HC-05 "AT + ORGL" and "AT + RESET"
Greetings Indo, Jakarta

MiloslavN3 months ago

To all receiving nothing when typing "AT":

I had the same issue but then I tried to type "AT+RESET" (no response but led started blinking faster) and then I checked SoftwareSerial library documentation and I used wrong pin for Rx on my Leonardo. Pin you use for receiving has to support change interrupts. Check documentation: http://arduino.cc/en/Reference/softwareSerial for more informations.

shankar.makal3 months ago

Can any one help me, wireless communication between Hc05 ,problem:I am able to send the data till 0.62 voltage equivalent digital is 127. After 0.63 it is -128 ,0.64 it is -126 ,0.65 it is -124 and so on........

StephanT4 months ago

hello,

is it possible to change Module Bluetooth adress with AT Commands or is there another way to change it?

fcfelix4 months ago

Hi, very usefull ible.

I have one question. Is it possible to configure the HC-05 through AT commands to be seen as a keyboard/gamepad/mouse? According to the command ref pdf (appendix 2) you posted, there is such functionality. The question is if this would sufice, or a firmare flashing would be needed for it.

fansblink5 months 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

Hey, this instructable is missing one thing. To communicate Arduino with HC-05 you have to set line ending box in Arduino Serial Monitor to "Both NL and CR"

Hope it helps.

WhizzWr1 year 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.

Thank Youuuu!!!

WOW! THANK YOU for sharing this! I have been stuck on this tutorial for 3 days now, never being able to display any response in my serial monitor from the HC-05. I even bought another HC-05, thinking that my original was defective. You rock :)

JeffW3 WhizzWr10 months ago

Thanks for this!

shanX WhizzWr1 year ago

THANKS!! THAT WAS NEEDED :) :)

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: http://www.amazon.com/gp/product/B00L083QAC/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1

same module, i cant see any button

prmccafferty6 months ago

Hello,

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?

Same Problem, no response, have you got it?

The default rate for the BT module is 38400.

1-40 of 155Next »