Config settings

The config settings are non-volatile (they are remembered when power is lost).

Sending config commands to the HC-05 using a PC using a USB to serial cable

You might want to do this so you can configure the HC-05 without using an Arduino, or even if you want to connect your computer to a remote HC-05 without using the computer’s Bluetooth adapter for some reason.

Parts

HC-05 Bluetooth Serial Transceiver

FTDI Serial TTL-232 USB Type C Cable – 5V Power / 3.3V Logic or TTL-232R-3V3-WE FTDI USB to UART Cable

Wiring
TTL-232R / TTL-232RFunctionTC-05
BlackGNDGND
RedVCCVCC
YellowRXDTXD
OrangeTXDRXD
BrownCTSLink CTS to RTS
GreenRTSLink CTS to RTS

Configure your serial port / terminal software to use 38400-8-N-1 (baud 38400, 8-bit, no parity, 1 stop bit).

Sending config commands to the HC-05 via an Arduino

E.g. connecting the TX and RX pin of the HC-05 to the TX and RX pins of the Arduino Uno TX and RX pins (don’t connect the STATE pin for this).

ArduinoHC-05
IO0TX (Arduino RX, HC05 TX) (fine to connect directly to the Arduino Uno)
IO1RX (Arduino TX, HC05 RX) (connect via 1K2+2K2 potential divider)

A 1K2+2K2 potential divider is required on the RX pin to shift the Arduino 5V TX pin down to 3.3V required by the HC-05 RX pin.

Menu > Tools > Serial Monitor

Line ending dropdown: “Both NL & CR”. Note you shouldn’t include the \r\n characters at the end of all the commands below. (“No line ending” and using the characters doesn’t work via the Arduino serial monitor, it seems it doesn’t convert back slashed special characters).

Baud dropdown: “38400”

Programming the HC-05 using AT commands

You may need to make sure the HC-05 module is not paired with any other Bluetooth device before doing this.

Connect the HC-05 TX and RX pins to your serial port of choice (e.g. to your Arduino or your computer via a USB to serial adapter, etc).

Configure your serial port / terminal software to use 38400-8-N-1 (baud 38400, 8-bit, no parity, 1 stop bit).

  1. With power off, press and hold the push button (to tied the PIO11 pin to 3.3V).
  2. Turn the power on to the HC-05.
  3. The HC-05 LED will blink on and off at about 2 second intervals, confirming that it is in AT command mode.
  4. Release the push button.
  5. To test send the following from your serial port: AT\r\n
    You should see the HC-05 respond with: OK\r\n

The “\r\n” means the carriage return and line feed characters. They must be present after each command you send. Your terminal software may add them for you automatically when you hit return – if you’re not sure try without using them and if you get no response try again with them added.

Example commands you can use

AT Commands pdf doc

Check it’s in AT command mode

AT

(You should get the OK response)

Return the HC05 to its default manufacture settings

You need to press and hold the push button when sending this one, as it causes the HC-05 to reset and it will exit config mode as it restarts without the button held.

AT+ORGL\r\n

Set role to Master or Slave

AT+ROLE=0\r\n

(0 = Slave, 1 = Master)

You need to press and hold the push button when sending this one, as it causes a HC-05 configured in the opposite mode to reset and it will exit config mode as it restarts without the button held.

Change comms settings

AT+UART=115200,0,0\r\n

Changes the baud rate (e.g. 115200 baud, 1stop bit, no parity). N.B. this doesn’t change the baud rate for AT config mode, that is always 38400 baud.

Change device name from the default HC-05

AT+NAME=NEWNAME\r\n

Change default security code from 1234

AT+PSWD=”5678″\r\n

Read Slave HC-05 Bluetooth address

AT+ADDR?\r\n

You will get back an address like this:

+ADDR:98D3:51:F63A39\r\n
OK\r\n

Set master HC-05 to fixed address mode

Change the HC-05 to fixed address mode: AT+CMODE=0\r\n
So it won’t auto-connect to any other device in range

Set the address of the slave to pair with: AT+BIND=98D3,51,F63A39\r\n
Note that you need to use commas instead of colons here.
There are 6 bytes (pairs of hex characters) used for the address. The first two 00 00 bytes of the devices MAC address are not used.

Initialise

AT+INIT\r\n

(We got an ERROR response for this one, don’t know why?)

Completing config

Cycle the power to the module (without holding the button).
It will now be running with your new settings.

The config settings are non-volatile (they are remembered when power is lost)

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

  1. Roger A. Krupski

    7 months ago

    Thanks so much for the info. I finally got my two HC-05 boards to talk to each other. This project will end up being a wireless controller for my Hanmatek DC Power Supply.

Comments

Your email address will not be published. Required fields are marked *