loading

Step 2: Pinout and Entering AT Mode

PINS: The pins found on the breakout board are,

KEY: This pin has to be pulled high to enter AT mode.
VCC: Indicated range is 3.6 to 6 volt. To be on safer side, you should connect it to 3.3 Volt.
GND: Ground.
RXD: Serial input pin.
TXD Serial output pin.
STATE: May or may not be connected to any pin. Supposedly outputs the Bluetooth connection status. This pin will not be needed.

Some of the breakout boards have EN pin or even WAKE UP pin instead of KEY pin. None of them seem to be connected to any pins of module. But that does not matter because we wouldn't need them anyway.

Once you identified the module, now it's time to enter the AT mode.
For HC05: Connect the Rx pin of the Bluetooth module to Tx pin of USB to TTL converter, and Tx pin of Bluetooth to Rx pin of converter. Also connect their ground but don't connect the Vcc yet. First you'll have to short the key pin with the Vcc. Connect key pin and Vcc together on breadboard, or any other way. After all other pins are connected, connect Vcc of bt module to USB to TTL converter's Vcc. Now the led on the module will blink at the interval of 2 seconds. That means it has entered the AT mode. If the led blinks faster then AT mode was not entered. Disconnect Vcc, check your circuit and try again. If it does not work then there's a chance that your KEY pin of the module is not really soldered to the KEY of the main chip, i.e. the 34th pin. You can check that with the help of multimeter.

If you use an arduino uno, then connect Rx pin of the Bluetooth module to pin 11 of Arduino Uno(supposedly same for arduino mega), and Tx pin of Bluetooth to pin 10 of Arduino. Also connect key pin of module to pin 9 of arduino and ground to ground, but don't connect the Vcc yet. You have to first power up the arduino, and then connect Vcc just like you did in case of USB to TTL converter.

For HC06: Just connect the Rx of module to Tx of usb-ttl converter and Tx of module. Connect ground and Vcc. The module is in AT mode. Didn't see that one coming, right? :P Turns out HC06 module is permanently configured to be slave and it is always in AT mode when not paired to any other device. So there is no confirmation led blinking that it is in AT mode like HC05 has. Just power up the module and pass the AT commands to modify the default settings.

Connection overview:

HC05 USB to TTL Arduino
Vcc Vcc Vcc
Rx Tx pin 11
Tx Rx pin 10
Gnd Gnd Gnd
key Vcc pin 9

HC06 USB to TTL

Vcc Vcc
Rx Tx
Tx Rx
Gnd Gnd

<p>`_window_func' referenced in section `.text' of C:\Users\Acer\AppData\Local\Temp\ccXDgjDW.ltrans1.ltrans.o: defined in discarded section `.text' of sketch\LED_control.ino.cpp.o (symbol from plugin)</p><p>`_window_func' referenced in section `.text' of C:\Users\Acer\AppData\Local\Temp\ccXDgjDW.ltrans1.ltrans.o: defined in discarded section `.text' of sketch\LED_control.ino.cpp.o (symbol from plugin)</p><p>`fht_log_out' referenced in section `.text' of C:\Users\Acer\AppData\Local\Temp\ccXDgjDW.ltrans1.ltrans.o: defined in discarded section `.text' of sketch\LED_control.ino.cpp.o (symbol from plugin)</p><p>`fht_log_out' referenced in section `.text' of C:\Users\Acer\AppData\Local\Temp\ccXDgjDW.ltrans1.ltrans.o: defined in discarded section `.text' of sketch\LED_control.ino.cpp.o (symbol from plugin)</p><p>`_log_table' referenced in section `.text' of C:\Users\Acer\AppData\Local\Temp\ccXDgjDW.ltrans1.ltrans.o: defined in discarded section `.text' of sketch\LED_control.ino.cpp.o (symbol from plugin)</p><p>`_log_table' referenced in section `.text' of C:\Users\Acer\AppData\Local\Temp\ccXDgjDW.ltrans1.ltrans.o: defined in discarded section `.text' of sketch\LED_control.ino.cpp.o (symbol from plugin)</p><p>`_reorder_table' referenced in section `.text' of C:\Users\Acer\AppData\Local\Temp\ccXDgjDW.ltrans1.ltrans.o: defined in discarded section `.text' of sketch\LED_control.ino.cpp.o (symbol from plugin)</p><p>`_reorder_table' referenced in section `.text' of C:\Users\Acer\AppData\Local\Temp\ccXDgjDW.ltrans1.ltrans.o: defined in discarded section `.text' of sketch\LED_control.ino.cpp.o (symbol from plugin)</p><p>`_cas_constants' referenced in section `.text' of C:\Users\Acer\AppData\Local\Temp\ccXDgjDW.ltrans1.ltrans.o: defined in discarded section `.text' of sketch\LED_control.ino.cpp.o (symbol from plugin)</p><p>`_cas_constants' referenced in section `.text' of C:\Users\Acer\AppData\Local\Temp\ccXDgjDW.ltrans1.ltrans.o: defined in discarded section `.text' of sketch\LED_control.ino.cpp.o (symbol from plugin)</p><p>collect2.exe: error: ld returned 1 exit status</p><p>exit status 1</p><p>anny one can help?</p>
<p>Hey there Sayem2603, is there anyway that we could actually get into the AT Command mode of the HC-05 pragmatically without holding the button? I'm having a project that which requires every startup of the Bluetooth it requires a brand new 4 pin numeric password. Thanks in advance.</p>
<p>Hey there , i tried using this method a few weeks ago using my arduino mega 2560 and my hc05 and it worked fine , suddenly when i tried using it again it didn't work ! i even tried replacing the arduino and the module itself , and it still didn't work , any clue why it doesn't work ?</p>
<p>With HC-06</p>
<p>thank you! life saver!!</p>
<p>Hi,</p><p>i spent whole day trying to get it working. I have some yfrobot bt board v1.2<br>Tryed like everything and no comunication from board :-/ .<br>Its feel like it need firmware flash</p>
<p>I have two identical boards JY-MCU new,but only one responds as it should . Could be the other is a dud in part. Both connect to my phone OK While the LED is flashing quickly. When the AT command is given to the good one the led flashing slows to a long burst on then off. It may be my soldering or perhaps it is connected to my phone at the time or some board fault is at play . Identical connections up to the BT board pins. From there who knows?</p>
<p>These modules seem to have a lot of variations in them .The Name problem is discussed in the documentation and depends on the KEY line connection to give it out .Your phone will give the name.</p><p>My module which gives Version 2.0 when asked seems fixed on 115200 UART and won't change but is responding to the arduino IDE serial terminal connection at 38400 Baud. Its very confusing .</p><p>Well done on presenting this because this is the first time I have been able to get any reply from it and the following do give a respone </p><p>AT (IF not already then changes to a slow flash)</p><p>AT+UART</p><p>AT+UART=9600 (NO CHANGE)</p><p>AT+VERSION (Gives 2.0)</p><p>AT+ADDR</p><p>AT+ROLE (gives 1)</p><p>AT+PSWD</p><p>AT+PSWD=1234 (seems to reset it but it does not last) </p><p>AT+RESET (changes to a fast flash)</p>
<p>Unless I'm missing something in your guide, you seem to be suggesting connecting TTL outputs directly to the HC-05/06 signal inputs. The signal inputs ARE NOT TTL compatible and should only be used with 3.3V logic levels. You need level shifters on the module's signal inputs.</p>
<p>hehe &quot;TTL&quot; .... its TTY</p>
<p>Thank you very much! I needed to rename my module and I got through the documentation.</p>
<p>Thanks for the great tutorial! I managed to do all of this and I could at first check for the name with &quot;AT+NAME&quot; but after I tried changing the name it accepted it but now when I try to check for the name with the AT command &quot;AT+NAME&quot; it never returns a name or acknowledges an entry. I tried other commands like &quot;AT+ROLE&quot; and could view it, change the role and view the role changed and all other commands worked. I even did the factory-reset with &quot;AT+ORGL&quot; and I still can't see name. Stranger still, I can still change the name even though I can't view it. Would you know what the problem is or how to fix it? Also I can't get my phone's Bluetooth to find the HC-05 module, do you know about a good tutorial or source for that in case it's an issue I have to troubleshoot? </p>
<p>thats just the same problem i have too</p>
<p>Same as me. Did you find the solution?</p>
<p>I flashed the firmware because i wanted a HID anyway.</p>
<p>How did you flash it? And what firmware version did you have? </p><p>Did it finally answer the AT+NAME? command?</p><p>Thanks for your help</p>
<p>JUST TYPE AT+NAME</p>
<p>i used a CSR-USB-SPI flasher for about 17bucks ( you can build your own ) - free Blueflash and PSTool software and an alternative firmware. </p><p>have a look hier </p><p>https://youtu.be/BBqsVKMYz1I?list=PLaCGYJSDl2G_NL3PCnu6B4_t3k4TNy8Bc</p>
<p>MAKES NO SENCE ARDUINO RX AND TX PINS ARE NOT 10 AND 11 THEY 0 AND 1 </p><p>Connection overview:</p><p>HC05 USB to TTL Arduino<br>Vcc Vcc Vcc<br>Rx Tx pin 11<br>Tx Rx pin 10<br>Gnd Gnd Gnd<br>key Vcc pin 9</p><p>HC06 USB to TTL</p><p>Vcc Vcc<br>Rx Tx<br>Tx Rx<br>Gnd Gnd</p>
<p>The Arduino 0 Rx and 1 Tx pins are connected to serial monitor in your computer. In serial monitor, u can send at commands to HC05, connected to 10/11 with help of softSerial, through Arduino. Arduino will work as a bridge.</p>
<p>Thanks!</p><p>It turned out that I got one of those HC-05 modules where the KEY/EN pin was unconnected. I soldered a wire directly to KEY34 and connected that to VCC. Then things worked like a charm.</p><p>-&gt; The command mode LED really, really, has to blink every 2 seconds. &lt;-<br>Anything faster means that you are not in command mode and it's useless to try to do any configuration :-)</p><p>I did bypass the Arduino and connected the HC-05 directly to a USB-serial cable (voltages were within range). From there I could configure the HC-05 to my own taste using &lt;whatever serial communication package&gt;.</p><p>Regards, Willem</p>
<p>Hey! Thanks for your comment. I also got one of those HC-05 modules without a switch for KEY/EN pin. I tried what you suggested, I shortcircuited KEY34 pin to Vcc but it still doesn't work. The thing is that it doesn't blink every 2 seconds neither. </p><p>I tried this with my Arduino. I need your help, could you give me some advice?</p>
<p>There is another strange issue in here. None of the commands would work except for the AT+NAMEXXX, from which I get the response OKsetname. After that, if I ask him for his name with the command AT+NAME? the answer still is OKsetname. </p><p>No idea of what's happening in here. Help please.</p>
<p>Hi i really need your help i'm stacked for about one week trying to configure my HC-05 with the EN pin instead of the KEY pin . i did the same as you i inshorted pin 34 to VCC and i get the 2 seconds blinking but there is no response when i enter AT coomand can you help me pleaze .....</p><p>i didn't understand you:&quot; I did bypass the Arduino and connected the HC-05 directly to a USB-serial cable (voltages were within range). From there I could configure the HC-05 to my own taste using &lt;whatever serial communication package&gt;.&quot;</p>
<p>Hi xyztw,</p><p>I meant that I did not use an Arduino at all. The HC-05 is connected directly to the USB-serial cable. Before connecting, I measured the voltage on the serial cable against ground, voltages were below 5V. That was safe enough for me.</p><p>Make sure that RXD on the HC-05 is connected to TXD on the cable and that TXD on HC-05 is connected to RXD on the cable. Check the settings in your communication tool, it shoud be 38400,8,n,1 (38400 baud, 8 bits, no parity, 1 stop bit). Also make sure that you are connected to the correct serial port, ttyUSB0 in my case (Linux machine).</p><p>HTH,</p><p>Willem</p>
<p>I'm encountering a problem :</p><p>I've plug my HC-05 through arduino uno, on the serial monitor it say &quot;ready for AT commands&quot;.</p><p>Then i wrote &quot;AT&quot; in the monitor but no OK answer </p><p>What Should I do ?? </p><p>Thanks</p>
<p>Make sure Rx from the module goes to the Tx on the Arduino and Tx (Module) goes to RX (Arduino).</p><p>Also ensure you have NL and CR in the dropdown on Serial Monitor.</p><p>Regards,</p>
Check parity and or duplex settings
<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>that's what a small button is there !!. i was in thought so long for what that button is for, thanks for share...</p>
<p>THx man! saved my day!</p>
<p>Worked well for me too! It's important to keep pressing the button while sending the AT commands otherwise some commands might not work!<br>Before trying to solder any wires as suggested in this instructables, try the button!;)</p>
thanks for this information
Mine bluethooth module doesnt have a vcc and key . Im having hc05. Plz tell me today tomorrow i have science exhibition
<p>This is brilliant, thanks!</p>
<p>woohoo great instructable- i've been trying to program my hc05 for days and your method worked first time :-)</p>
<p>Hi there</p><p>I am trying to pair two HC-05 at 38500 baud rate. I configure them as <br>master and slave and when used in normal mode they pair properly and i <br>can transmit and receive data. </p><p>I use AT mode on master side to retrieve slave address using AT+INQ, i <br>do get my address in the format 2015:4:90245 which is correct.</p><p>However when i try to retrieve name of the slave device using AT+RNAME <br>?2015,4,90245 nothings happens. The LED on the master board goes to <br>slow blink .</p><p>same happens when i try AT+LINK=?2015,4,90245. Eventually i have to give<br> up and send AT command again and redo AT+INIT and try again. The <br>Password on both unit is 1234 and they are set to Original values by <br>using AT+ORGL</p><p>any suggestions </p><p>Thanks</p>
<p>Where is the code for HC06? You put code for HC05, but none for HC06, but then conitnue with the tutorial as if we have code to execute for HC06. I'm confused.</p>
<p>sent AT </p><p>replay is ok</p><p>but getting error for rest command</p><p>why?</p>
<p>Thank you!</p>
<p>hi.</p><p>my HC-05 isn't working with this sketch,actually im not receiving any answer from HC-05.</p>
superb tutorial, with many details ! <br><br>But I'm encountering a problem :<br>I've plug my HC-06 through arduino uno, on the serial monitor it say &quot;ready for AT commands&quot;.<br>Then i wrote &quot;AT&quot; in the monitor but no OK answer is receive : /<br>Do you have any idea about this issue ?? <br><br>Thanks
<p>HI , i am trying with HC06 but it is not working. i cannot see 2second delay in led. i have uploaded the code. then disconnected the board from usb. then connected again and connected the wires. but still not working . there is one more thing i do not have a key pin on my hc06</p>
hc06 does not need key pin. It's already in AT mode. You just have to type in the commands fast.
<p>Thanks for the quick reply. i am new to this hardware stuff. and already spent more than a week on configuring hc06 with my arduino and then trying to detect it with iphone .<br>I can connect my android with the bluetooth but cant connect iphone.<br>What i want to do</p><p>1) change the name of the bt module</p><p>2)change the device class to 1 ( i think iphone doesnt recognise class 0 thats why</p><p>now the big problem is AT command stuff. </p><p>is there any way that i can put the AT commands in the sketch and upload it and they do the magic. because it seems not working at all. today i will try one more time to follow your tutorial whole heartedly :) step by step. and see what happens.</p><p>thanks in advance :)</p>
<p>I am sorry but I have no idea about iphone, but as far as I am concerned, it uses a different protocol. And for the AT command part, I think it might be possible to run AT commands through sketch. But you will not have confirmation of the action. </p>
<p>i can take care of that part once i run the AT commands successfully. Still i cannot run them and now i want to just throw my HC06 away because i spent many hours without success.</p><p>Here is the flow</p><p>1) i uploaded the sketch on my Arduino UNO (mentioned by you)</p><p>2) i am trying to work with my board to act like ttl by connecting reset to ground. and tx to rx and rx to tx ( triend with tx to tx and rx to rx also)</p><p>3)when i connect with 38... then i can see a first line of garbage characters</p><p>4) if i connect with 9600 then i can see only my commands on the serial monitor but no echo</p><p>what is the working flow if you can suggest</p><p>1) i apply your circuit to my board and hc06 module (the one you mentioned for hc06</p><p>2) then i upload the sketch? here i am a bit confused you said to unplug the hc06 module if i unplug it . do i need to remove the reset wire as well </p><p>so i unplug every thing , upload your code to arduino uno</p><p>then i plug in hc06 and apply the reset jumper then i connect it as usb to ttl to computer and send the commands</p><p>i think i am stuck on your last instruction which is mentioned under For HC05. there you have given one extra paragraph of arduino sketch where pin 10 and 11 have been used. while before you have given some other suggestion</p><p>is it only for hc05? if it is only for hc05 then where is the sketch for hc06 ? to use. or i need to write my own? </p><p>or i just follow the circuit diagram and try to connect it as usb to ttl and then try to send fast AT commands. <br>Can you please guide. i would be very thankful. </p><p>thanks a lot in advance</p>
<p>I have the 2 second blink. Everything is hooked up properly; but when I use the serial monitor, a gibberish unicode message comes up. It doesn't even say &quot;Enter AT commands&quot;. What's going on? Btw I'm using COM 7 for monitor which is my USB port. COM 12 is what my Bluetooth usually is. I've tried monitoring with COM 12 but it says &quot;port is busy&quot;.</p>
<p>Hey buddy! I have a ble module very similar to HC05, but I am not able to access it's configuration using AT commands the same way you do via arduino Serial Monitor. I was able to modify it when I connected the ble to a FTDI header and then connect via USB to my laptop. I need to do it via arduino, the same way you did, but for some reason I am not getting the same results you are. The modules are not very different, and I am trying to use the same code you have there, and it does not give me an answer back unless I add some substantial delay like at least 100 micro seconds. However, if I do add these delay, the module does not answer me back. Do you have any idea or know somewhere that could have this answer? I am researching about this for the past 3 weeks now. Thanks.</p>
<p>Gratulation for that great tutorial. <br>I'am stucked because my module HC-06 doesn't react any more on at commands.<br>First I was able to send AT commands and I tried some of them. At the end I tried the command &quot;AT+RST&quot;. I am not shure if the short command with RST also works, but since this command it doesn't reacts on any AT-commands any more. It seems that (as described in this tutorial) it leaves the AT mode. (AT+RESET : Reset and exit AT mode)<br>Is it possible that the module HC-06 is going out of AT Mode?<br>How to bring the module back to AT-Mode (I already connected the Key-Pin with a resistor to VCC, but noting happened)</p>

About This Instructable

661,606views

224favorites

License:

More by sayem2603:On a budget valentine AT command mode of HC-05 and HC-06 Bluetooth module 
Add instructable to: