September 4, 2013: Featured on Hackaday.com http://goo.gl/qxvWkd
September 1, 2013: Featured on DangerousPrototypes.com http://goo.gl/K4kH9g


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.

Step 1: Components & Wiring

I have tested this guide with the following:

  • HC-05 GND --- Arduino GND Pin
  • HC-05 VCC (5V) --- Arduino 5V
  • HC-05 TX --- Arduino Pin 10 (soft RX)
  • HC-05 RX --- Arduino Pin11 (soft TX)
  • HC-05 Key (PIN 34) --- Arduino Pin 9

<p>hi, if u having trouble in making into AT mode of HC-05 (ZS-040)(especiall if one having en/wakeup up pin instead of key pin). Follow they bellow procedure</p><p>Power off HC-05 module.</p><p>Press and hold small button above EN pin.</p><p>Power on and keep pressing small button.</p><p>Small LED should start to blink slowly about once every 2 seconds.</p><p>for more info visit below site:</p><p>http://abratukhin.blogspot.in/2015/04/connect-atmega328-with-hc-05-zs-040.html</p>
<p>hi, if u having trouble in making into AT mode of HC-05 (ZS-040)(especiall if one having en/wakeup up pin instead of key pin). Follow they bellow procedure</p><p>Power off HC-05 module.</p><p>Press and hold small button above EN pin.</p><p>Power on and keep pressing small button.</p><p>Small LED should start to blink slowly about once every 2 seconds.</p><p>for more info visit below site:</p><p>http://abratukhin.blogspot.in/2015/04/connect-atmega328-with-hc-05-zs-040.html</p>
I connected hc05 module with arduino uno board with connections as- <br>G<br>HC-05 GND --- Arduino GND Pin<br>HC-05 VCC (5V) --- Arduino 5V<br>HC-05 TX --- Arduino Pin 10 (soft RX)<br>HC-05 RX --- Arduino Pin11 (soft TX)<br>HC-05 Key (PIN 34) --- Arduino Pin 9<br>After connecting i m getting rapid blinking of led on hc 05 module but unable to connect with any app on ios neither AT command is getting any response on serial port.<br>Suggest how to connect hc05 with arduino uno and how to use it on ios mobile app
<p>can u please tell me how to change my pin or password for my hc-05??</p>
<p>Connect Hc-05 to the Serial Monitor. then Convert the HC-05 into AT command mode. then type AT+PSWD? then press enter button(\r\n). it will reply PSWD=&quot;XXXX&quot;, then Put AT+PSWD=password. then password will set as a password.</p>
<p>Once it is in full AT mode send &quot;AT+PSWD=0000&quot; (without quotes) and don't forget to be sending the Newline and Carriage return characters after each command...</p>
<p>can anyone please tell me how can i change data rate in Hc-05?</p><p>and how to change the class of device? what will happen if i change the class? whether it would affect the data rate or something?</p>
<p>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 &amp; CR on and a baud rate of 9600 on the serial monitor and I get result of &Iuml;&sect;&dagger;&hellip;&yuml; 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.</p><p>Thanks in advance, <strong>Chris</strong>.</p>
<p>Hi, the fix for this is to put the module into AT mode with the user-defined baud rate, which by default is 9600. To do this, pull pin 34 high AFTER power-up instead of before. You won't have any indication of the mode change, i.e the led will continue blinking quickly whereas in the 38400 baud AT mode the led starts blinking slowly, on 2s, off 2s. I have posted an answer with code + additional info at http://forum.arduino.cc/index.php?topic=302827.msg2561221#msg2561221</p>
<p>Thank you for the link. After reading some of the suggestions I was able to get my HC-05 into AT mode just by holding the button while powering on. The LED went to the long blink and all AT commands functioned properly.</p>
<p>I am getting the same thing. Instead of the &quot;OK&quot; response I get &quot;&Iuml;&sect;†…&quot; plus two unprintable characters. Sending commands seems to work but I never really know since I don't get an understandable response.</p>
<p>i had try it but in serial monitor shows like xxxxxxx&euro;&oslash;.</p><p>also i had change all baud rates nothing happens.. im using hc-05</p>
<p>hi there, i paired up 2 hc05 master &quot;1&quot; and slave &quot;0&quot; doing this </p><p>AT commands</p><p>//SLAVE = 98d3:31:2093cb AT+ROLE=0</p><p>//MASTER= 98d3:32:204d2a AT+ROLE=1</p><p>//AT+BIND=98d3,31,2093cb</p><p>//AT+BIND=98d3,32,204d2a</p><p>The end im left with paired modules that can talk to one another now i set this in AT+UART=9600.0.0 or 38400,0,0 im not sure now but it worked out fine now in the sketch i was doing all this in terminal obvsly using the terminal baud rate which was</p><p>as follow</p><p>include SoftwareSerial.h</p><p>SoftwareSerial mySerial(10, 11); RX, TX</p><p>void setup</p><p>{ Serial.begin(38400);</p><p>pinMode(9, OUTPUT);</p><p>digitalWrite(9, HIGH);</p><p>Serial.println(&quot;Enter AT commands:&quot;);</p><p>mySerial.begin(38400);</p><p>}</p><p>so my problem is that when i try to take the 2 talking modules to use in another project im not sure but they dont communicate no more &quot;after uploading new sketch&quot; am i suppose to use the same baud rate as in the sketch (38400); or should i be using the baud that i set this 2 up to begin with when i did the whole AT+UART=9600.0.0 or 38400,0,0 ???</p><p>i was assuming what i have now when they were talking was a wireless RS232/terminal right? if so then all i have to do is make sure in the loop of what ever other program i go to use this modules on that they talk to that SoftwareSerial mySerial or something like this</p><p>void loop()</p><p>{</p><p>if (mySerial.available())</p><p>mySerial.write(&quot;Variable or Array here&quot;);</p>
<p>didnt had success with this setup. Seems like I couldnt work out the right combination of baud rate and return characters (which are 38400 and cr+lf for my cz-hc-05). However, I hooked up the hc-05 directly to my usb ftdi dongle and it worked perfectly with a random serial terminal program. (had a 3.3 voltage regulator for the key pin but dont know if thats necessary).</p>
<p>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?</p><p>My second question is, how can I pair the HC05 connected to an Arduino uno with an HC06 connected to an ATTiny 85?</p><p>Cheers.</p>
<p>Dear friend, </p><p>In my Hc-05 have tiny push button to put AT mode.</p><p>what i doing to put configure mode</p><p>1) disconnect power pin.</p><p>2) press the tiny push button</p><p>3) same time connect the power.</p><p>Done. </p>
<p>:D I always wonder about that button</p>
<p>Thanks. This was very helpful. Have been trying and suspected that the pushbutton had something to do with it.</p>
<p>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.</p>
<p>Same problem. Do you got the solution???</p>
Having same problem. Did u get any solution..?
My hc-05 module responds to all AT commands &amp; also connects to my android device but doesnt respond to commands.<br>Please help me to solve this issue <br>Thank you
<p>Hello!</p><p>Everybody who is not able to get into AT-mode with this Tutorial should check if they have a HC-05 (ZS-040) Bluetooth Module. If so, check out Martyn Currey's tutorial: <a href="http://www.martyncurrey.com/arduino-with-hc-05-bluetooth-module-at-mode/#comment-4042." rel="nofollow">http://www.martyncurrey.com/arduino-with-hc-05-blu...</a> With this tutorial I was finally able to access AT-mode :-D. </p>
<p>Thanks, Martyn Currey's tutorial worked just fine for me.</p>
<p>According to the AT-cmd spec </p><p>Param2:stop bit: </p><p>0----1 bit </p><p>1----2 bits<br></p><ul> <br><li>To change HC-05 baud rate from default 9600 to 115200, 1 stop bit, 0 parity enter: &quot;AT+UART=115200,1,0&quot;<br><br>should enter AT+UART=115200,0,0</ul>
<p>If the HC05 is 3.3V could I just not use the 3.3V supply from the arduino itself ?</p>
In my Bluetooth module it has wake up pin instead of key pin what to do plzz solve
<p>hi, you can my older post </p><p>Wakeup pin is a pin that works for you configure the AT-Command setting, the previous post I already give an example and program.</p><p>[ HC-05 ] ___________ [ ARDUINO ]</p><p>vcc ------------------------- pin7(Arduino)</p><p>gnd ------------------------ gnd (Arduino)</p><p>txd ------------------------- pinA0 (Arduino)<br>rxd ------------------------- pinA1 (Arduino)<br>wakeup/ en/ key ------ pin8 (Arduino)</p>
<p>I tried using an HC-05 module with Putty on my windows 8 PC. When I <br>hit enter on a command I get the response I expect, but it repeats <br>indefinitely until I hit another key. I switched to Terraterm and that <br>program doesn't have the same problem. Any idea what is going on? I can <br> use Teraterm for the time being, but I'd like to know what is up with <br>Putty so I can trust it for other projects. </p>
<p>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. </p><p>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. </p>
<p>hii,,<br>Because not all of hc-05 can be configured, I recommend you use the HC-05 as it is drawn.<br> Follow the instructions and programs, </p>
<p>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....</p>
<p>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.<br>Been solving this for days...</p>
<p>Can I remove pin Check !!<br>I mean pairing with module but without from fixed address but without entering &quot;1234&quot;</p>
<p>It doesn't working. My BT module don't want to be in config. mode...</p>
<p>To all having strange characters in serial monitor:</p><p>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.</p>
<p>Thanks a lot. Your post helped me resolve the issue I was facing. Finally clear text in the terminal.</p>
<p>Thanks bro!</p><p>I donwload arduino IDE 1.6.1 and re-upload the code and its works!!</p>
<p>hi All! i'm using FB155BC as the bluetooth module. i had a response &quot;OK&quot; by typing AT but i got &quot;ERROR&quot; by typing AT+BTRSSI? . </p><p>i use Arduino 1.0.6.</p><p>could somebody help me? </p><p>thanks</p>
<p>Whether you go through the tutorial above?<br> 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<br><br> Explain to when you before entering the AT-command?</p>
<p>Orang Indonesia, </p>
<p>Hi TheKoobay,</p><p>orang indonesia? </p><p>yes i am!</p><p>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.</p><p>So know i'm working on it.</p><p>Regards</p>
<p>Smartphones can not connect, if HC-05 be set as &quot;master&quot; !!!<br> Try to change the HC-05 as a &quot;slave&quot;, now you try to connect with your smarphone.</p><p><br> You can restart the Configuration HC-05 &quot;AT + ORGL&quot; and &quot;AT + RESET&quot;<br> Greetings Indo, Jakarta</p>
<p>To all receiving nothing when typing &quot;AT&quot;:</p><p>I had the same issue but then I tried to type &quot;AT+RESET&quot; (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.</p>
<p>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........ </p>
<p>hello,</p><p>is it possible to change Module Bluetooth adress with AT Commands or is there another way to change it?</p>
<p>Hi, very usefull ible.</p><p>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.</p>
<p>HC-05 bluetooth why I did not respond to anything when I type AT? please help, I want to change the name and passwordnyaa</p>
<p>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 &quot;Both NL and CR&quot;</p><p>Hope it helps.</p>
<p>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 &quot;Both NL and CR&quot; on the dropdown.</p>

About This Instructable


320 favorites


Bio: Did I unplug the solder iron?
More by techbitar: IR Remote Control Station for Android - TURN THE TV DOWN SensoDuino: Turn Your Android Phone into a Wireless Sensors Hub for Arduino Modify The HC-05 Bluetooth Module Defaults Using AT Commands
Add instructable to: