HC-05 Bluetooth: Using AT commands

A couple of weeks ago I posted a discussion about using a Bluetooth HC-05 module to control one of my WALL CLOCKs. One of the issues I faced was not being able to reliably control one of the two modules that I purchased using AT commands.  One worked while the other didn’t and I couldn’t figure out why.

HC-05 Module

HC-05 Module

So, with a little bit of time to kill, and a very helpful instructable, I tried to get the errant unit into AT-mode. Again, no luck!

While there are many discussions online about this issue, I could not find one that related specifically to the module I had. In my case the mode select pin of the HC-05 daughter board is not brought out to the pins of the carrier. But by tracing the layout, I worked out how to wrestle this little bugger into AT command mode and reset the unit to its factory default settings.  Thank Odin for Internet!

It turns out that on my module, while the mode select signal is not broken out to a pin on the carrier, it is connected to the tiny reset button on the carrier. Duh!  This is what is used to force the HC-05 into AT command mode.

So, first connect the Bluetooth module to an Arduino (Nano, UNO or whatever) using the following connections…

  • HC-05 GND –> Gnd
  • HC-05 VCC –> +5V (initially disconnected)  *
  • HC-05 TX –> D2
  • HC-05 RX –> D3
  • STATE (output) and EN (input) are not connected

(* the HC-05 daughter board operates on 3.3V but the carrier has level shifting for the TX and RX pins so that the entire module can be safely connected to the Arduino operating on +5v)

… and follow these steps:

  1. Disconnect the power to the HC-05 module.
  2. Load the sketch to the Arduino
  3. Depress the small reset button on the HC-05 module and hold it down while you connect its Vcc pin to +5V.  <– this was the missing piece!!!

The red LED on the module (that would otherwise be blinking quickly) will flash slowly indicating it is in AT mode. Open a serial monitor in the Arduino IDE (or any other terminal software) and set its baud rate to 57600 and ensure that the transmit function sends both New Linefeed (\n) and Carriage Return (\r) after every AT command entered. On the IDE serial terminal, ensure “Both NL & CR” is selected. You should then see the prompt “Enter AT commands: “. You can then type your AT commands into the terminal input line and have them control the HC-05. So much POWER!!!

Here are a few AT commands that I found useful:

  • To ensure the unit is responding, enter AT. The unit should respond OK
  • To return the HC-05 to its default settings, enter AT+ORGL
  • To see the version of your HC-05 enter AT+VERSION?
  • To change the name of the device to AJCLOCK, for example, enter AT+NAME=AJCLOCK
  • To change the default security code (1234) to 2332 enter AT+PSWD=2332
  • To check baud rate, enter AT+UART? (my unit reset to 38400)
  • To change baud rate to say, 115200, 1 stop bit, 0 parity, enter AT+UART=115200,1,0

Here is the sketch to use…

[codesyntax lang=”php” title=”HC-05 AT Command Control” blockstate=”collapsed”]

#include <SoftwareSerial.h>

SoftwareSerial btSerial(2, 3); // RX | TX

void setup() {
  Serial.println("Enter AT commands:");
  btSerial.begin(38400);  // HC-05 default speed in AT command more

void loop() {
  if (btSerial.available())  Serial.write(btSerial.read());
  if (Serial.available())    btSerial.write(Serial.read());


Simple when you (or someone on the Internet) knows how!

11 thoughts on “HC-05 Bluetooth: Using AT commands

  1. suresh


    I have been trying to interface HC05 with my controller.

    So far, I could connect to HC05 in COMMAND Mode and configure the module successfully. I have connected KEY to HIGH to enter in to the command mode.

    I have set Role=1(Master) and Baudrate to 384000. Since I am able to connect in Command Mode there is no doubt about my UART interface.

    Now to enter to Communication mode, I pulled connected KEY pin to GND ( I have switch to do this) and restart the board. I could see the LED pattern changing as per the data mode.

    I could connect to HC05 using my mobile and see that connection LED is glowing bright RED!!! I am very happy!! Also the other LED blinks with bigger delay and it seems to be all well.

    Now, when I send any text from my controller over UART interface I am not able to receive it and vice versa.

    Do you see any problem in configuring the HC05?

    Is issuing of command AT+INIT and AT+PAIR mandatory?

    Appreciate any help to come out of this issue.

    I have been mining google to get out of this issue but I dont see any specific issues with my configuration but still it is not working so some where something is wrong!! 🙁

    Thanks for your time in Advance!!


  2. Sam Griffen

    Thank you so much! I have been having so many issues. I think it turns out I never clicked that the default baud rate of the HC-05 in AT mode is 38400. Yours is the first tutorial that worked for my modules. So I salute you. Have a lovely day

    1. Sam Griffen

      Not sure why, but if anyone has issues with the AT+INIT issue. For me it just wouldn’t return an OK. I held the little button closed and I could initiate the SPP and then get a list of devices around. Not sure if that is useful, maybe blatantly obvious


Come on... leave a comment...