Anyone tinkering with the HC-05 bluetooth module will eventually have to use what are called “AT commands”. AT commands are simple text-based commands that follow the “AT” prefix (“AT” meaning ‘attention’). These commands are similar to the ones used with old modem devices. By sending specific AT commands to the HC-05 module, you can configure it or retrieve basic information about it, such as its name, baud rate, PIN code, role, and so on.
In this tutorial, you will learn to configure the HC-05 module using AT commands to tailor the module according to your project’s requirements.
Configuring the HC-05 Module
To configure the HC-05 module, you put it into command mode and send AT commands over the UART port. While in command mode, any ASCII bytes you send are interpreted as commands. After making changes, you restart the module to apply the settings. When you change the configuration parameters, they are saved until you change them again or perform a factory reset.
The default configuration for the HC-05 module is:
- Device Name: HC-05
- Role: Slave
- Passkey: 1234
- Serial Parameters:
- Baud Rate: 38400 bits/s
- Stop bit: 1 bit
- Parity bit: None
- Inquire code: 0x009e8b33
Connecting HC-05 Module to a PC
When it comes to connecting the HC-05 module to a PC, you have two options.
- You can use a USB to TTL converter, directly establishing a connection between the HC-05 module and your PC. This converter serves as a bridge between the USB port on your PC and the TTL-level serial signals that the HC-05 module understands.
- Alternatively, you can use the Arduino as a medium between the PC and the HC-05 module. In this configuration, the Arduino serves as a translator, relaying commands and data between the PC and the HC-05 module.
With USB to TTL Converter
Let’s connect your HC-05 module to your PC using a USB to TTL converter.
Connecting the HC-05 Module to a USB to TTL converter is as easy as applying power and wiring up the serial Rx and Tx pins. The Tx of the HC-05 module is connected to the converter’s RXD, the Rx to TXD, GND to GND, and VCC to 5V.
Note that the Rx pin on the HC-05 module is not 5V tolerant. So, if you are using a USB-to-TTL converter that is operating at 5V I/O levels, you need to step down the Tx signal from the converter to 3.3V. There are numerous ways to accomplish this, but the simplest is to use a resistor divider. A 1K resistor between HC-05’s Rx and converter’s TXD, and a 2K resistor between HC-05’s Rx and GND, will work just fine.
To summarize, the following are the connections:
HC-05 Module | USB-to-TTL converter | Notes | |
VCC | VCC | – | |
GND | GND | – | |
TXD | Rx | – | |
RXD | Tx | Use level shifter if using 5V converter |
The image below shows the HC-05 connected to the PC using the FT232RL USB to TTL converter.

With Arduino
Similarly, you can connect the HC-05 Module to an Arduino. The TXD of the HC-05 module is connected to the Arduino’s D1, the RXD to D0, GND to GND, and VCC to 5V.
Again! The Rx pin on the HC-05 module is not 5V tolerant. So, if you are using a 5V microcontroller such as Arduino UNO, you need to step down the Tx signal from the Arduino to 3.3V using a resistor divider. A 1K resistor between HC-05’s Rx and Arduino’s D0, and a 2K resistor between HC-05’s Rx and GND, will work just fine.
To summarize, the following are the connections:
HC-05 Module | Arduino | Notes | |
VCC | 5V | – | |
GND | GND | – | |
TXD | D1 | – | |
RXD | D0 | Use level shifter if using 5V MCU |
The image below shows how to connect the HC-05 module to the Arduino Uno.

If you use this method, make sure that an empty sketch is uploaded to the Arduino.
Entering AT Mode
To enter AT mode, follow these steps.
- Press and hold the push button on the HC-05 module.
- Supply power to the module.
- Release the push button now. If the onboard led starts blinking with a time difference of approximately 2 seconds, the HC-05 has successfully entered AT mode; otherwise, repeat the procedure.
Note that in AT mode, HC-05 communicates at a baud of 38400 by default and with each command it is mandatory to send ‘\r’ and ‘\n’.
Sending AT Commands
To send AT commands, you will require a Windows terminal program installed on your PC that can communicate with the HC-05 module over UART. For this purpose, we recommend using the “Arduino Serial Monitor”. However, there are also many other free options (such as PuTTY, Tera Term etc.) that you can explore.
To begin, launch the Arduino IDE.

Make sure the HC-05 module is powered up and in AT mode. The onboard LED should be blinking at a slow and steady rate.
When you connect the HC-05 to your PC, it will be recognized as a COM port. Opening up your device manager, and looking in the “Ports (COM & LPT)” tree, you’ll find a new port.

Then in the Arduino IDE, navigate to Tools > Port and choose that COM port.

Open up the Serial Monitor via Tools > Serial Monitor, and make sure that the baud rate in the lower right-hand corner is set to 38400 and the ‘Both NL and CR‘ option is selected. This means when you send commands to the HC-05, it will put a newline and return at the end.

Now type “AT” (without quotes) in the textbox at the top of the Serial Monitor and click the Send button. You should see “OK” as a response from the module. This means the communication is successful.

You can now send commands like the ones below to get more information about your module:
AT+VERSION? – It prints the software version.
AT+NAME? – It prints the device’s name.
AT+ PSWD? – It prints the passkey.

These are Read Commands. You can also send Write Commands like:
AT+NAME=Param1 – It sets the device’s name to Param1. Note that the device name can be up to 32 bytes long and can include special characters.
HC-05 AT Commands
For your reference here’s a list of all HC-05 AT Commands.
AT
Usage | Test |
Response | OK |
Parameter | – |
Notes | – |
Example | AT OK |
AT+RESET
Usage | Reset the module |
Response | OK |
Parameter | – |
Notes | – |
Example | AT+RESET OK |
AT+VERSION?
Usage | Get the software version |
Response | +VERSION:**** OK |
Parameter | – |
Notes | – |
Example | AT+VERSION? +VERSION:2.0-20100601 OK |
AT+ORGL
Usage | Restore default status |
Response | OK |
Parameter | – |
Notes | The parameter of default status: 1. Device type: 0 2. Inquire code: 0x009e8b33 3. Module work mode: Slave Mode 4. Connection mode: Connect to the Bluetooth device specified 5. Serial parameter: Baud rate: 38400 bits/s; Stop bit: 1 bit; Parity bit: None. 6. Passkey: “1234” 7. Device name: “H-C-2010-06-01” |
Example | AT+ORGL OK |
AT+ADDR?
Usage | Get module bluetooth address |
Response | +ADDR:**** OK |
Parameter | – |
Notes | Bluetooth address will be shown as: NAP: UAP: LAP (Hexadecimal) |
Example | AT+ADDR? +ADDR:1234:56:abcdef OK |
AT+NAME?
Usage | Inquire device’s name | |
Response | If Success: +NAME:**** OK | If Failure: FAIL |
Parameter | – | |
Notes | Default: “HC-05” | |
Example | AT+NAME? +NAME:HC-05 OK |
AT+NAME=Param1
Usage | Set device’s name |
Response | OK |
Parameter | Param1: Bluetooth device name |
Notes | Length up to 32 bytes Supports special characters. AT+NAME=”HC-05″ is the same as AT+NAME=HC-05 |
Example | AT+NAME=myBluetooth OK |
AT+RNAME?Param1
Usage | Inquire remote bluetooth device’s name | |
Response | If Success: +NAME:Param2 OK | If Failure: FAIL |
Parameter | Param1: Remote Bluetooth device address Param2: Remote Bluetooth device name | |
Notes | Bluetooth address will be shown as: NAP:UAP:LAP (Hexadecimal) | |
Example | AT+RNAME?0002,72,od2224 +RNAME:Bluetooth OK |
AT+ROLE?
Usage | Inquire module role |
Response | +ROLE:**** OK |
Parameter | – |
Notes | Result is a number where: 0 -> Slave 1 -> Master 2 -> Slave-Loop |
Example | AT+ROLE? +ROLE=0 OK |
AT+ROLE=Param1
Usage | Set module role |
Response | OK |
Parameter | Param1: module role: 0 -> Slave 1 -> Master 2 -> Slave-Loop |
Notes | Roles: Slave (Default): Passive connection Slave-Loop: Passive connection, receive the remote Bluetooth master device data and send it back to the master device Master: Inquire the near SPP Bluetooth slave device, build connection with it positively, and build up the transparent data transmission between master and slave device. |
Example | AT+ROLE=0 OK |
AT+CLASS?
Usage | Inquire device type | |
Response | If Success: +CLASS:**** OK | If Failure: FAIL |
Parameter | – | |
Notes | Default: 0 | |
Example | – |
AT+CLASS=Param1
Usage | Set device type |
Response | OK |
Parameter | – |
Notes | Bluetooth device type is a 32-bit parameter indicates the device type and what type can be supported. For inquiring the custom Bluetooth device from around Bluetooth devices quickly and effectively, user can set the module to be non-standard Bluetooth device type, such as 0x1F1F (Hex). |
Example | – |
AT+IAC?
Usage | Inquire “inquire access code” |
Response | +IAC: **** OK |
Parameter | – |
Notes | Default: 9e8b33 |
Example | AT+IAC? +IAC: 9e8b3f OK |
AT+IAC=Param1
Usage | Set “inquire access code” | |
Response | If Success: OK | If Failure: FAIL |
Parameter | Param1: Inquire access code | |
Notes | Access code is set to be GIAC type (General Inquire Access Code:0x9e8b33), and used for seeking ( or being sought by ) all the Bluetooth devices around. For inquiring (or being inquiring by) the custom Bluetooth device from around Bluetooth devices quickly and effectively, user can set the inquire access code to be the other type number (not GIAC nor LIAC), such as 9e8b3f. | |
Example | AT+IAC=9e8b3f OK |
AT+INQM?
Usage | Inquire inquire access mode |
Response | +INQM:***,***,*** OK |
Parameter | – |
Notes | Output is in the format: Inquire access mode, the maximum of Bluetooth devices response, the maximum of limited inquiring time Default: 1, 1, 48 |
Example | AT+INQM +INQM:1, 9, 48 OK |
AT+INQM=Param1, Param2, Param3
Usage | Set inquire access mode | |
Response | If Success: OK | If Failure: FAIL |
Parameter | Param1: Inquire access mode: 0 -> Standard 1 -> RSSI Param2: The maximum of Bluetooth devices response Param3: The maximum of limited inquiring time | |
Notes | The range of limited time: 1~48 (Corresponding time:1.28s~61.44s) | |
Example | Set Inquire access mode such that: 1) has RSSI signal intensity indicator, 2) stop inquiring once more than 9 devices response, 3) limited time is 48*1.28=61.44s: AT+INQM=1,9,48 OK |
AT+PSWD?
Usage | Inquire passkey |
Response | +PSWD:**** OK |
Parameter | – |
Notes | Default: “1234” |
Example | AT+PSWD? +PSWD:1234 OK |
AT+PSWD=Param1
Usage | Set passkey |
Response | OK |
Parameter | Param1: Passkey |
Notes | – |
Example | AT+PWD=1234 (or AT+PSWD=”1234″) OK |
AT+UART?
Usage | Inquire serial parameter |
Response | +UART=****, ****, **** OK |
Parameter | – |
Notes | Output is in the format: Baud rate, Stop bit, Parity bit Default: 9600, 0, 0 |
Example | AT+UART? +UART:115200,1,2 OK |
AT+UART=Param1, Param2, Param3
Usage | Set serial parameter |
Response | +UART=Param1, Param2, Param3 OK |
Parameter | Param1: Baud rate: 4800 -> 4800 bits/s 9600 -> 9600 bits/s<br 19200 -> 19200 bits/s 38400 -> 38400 bits/s 57600 -> 57600 bits/s 115200 -> 115200 bits/s 230400 -> 230400 bits/s 460800 -> 460800 bits/s 921600 -> 921600 bits/s 1382400 -> 1382400 bits/s Param2: Stop bit: 0 -> 1 bit 1 -> 2 bits Param3: Parity bit: 0 -> None 1 -> Odd parity 2 -> Even parity |
Notes | – |
Example | Set baud rate to be 115200, stop bit to be 2 bits, parity bit to be even parity: AT+UART=115200,1,2 OK |
AT+CMODE?
Usage | Inquire connection mode |
Response | +CMODE:**** OK |
Parameter | – |
Notes | Result is a number where: 0 (Default) -> Connects the module to the specified Bluetooth address 1 -> Connects the module to any address 2 -> Slave-Loop |
Example | AT+CMODE? +CMODE:2 OK |
AT+CMODE=Param1
Usage | Set connection mode |
Response | OK |
Parameter | Param1: Connection mode: 0 -> Connect the module to the specified Bluetooth address. 1 -> Connect the module to any address 2 -> Slave-Loop |
Notes | – |
Example | AT+CMODE=2 OK |
AT+BIND?
Usage | Inquire – bind Bluetooth address |
Response | +BIND:**** OK |
Parameter | – |
Notes | Bluetooth address will be shown as: NAP: UAP:LAP(Hexadecimal) |
Example | AT+BIND? +BIND:1234:56:abcdef OK |
AT+BIND=Param1
Usage | Set – bind Bluetooth address |
Response | OK |
Parameter | Param1: Bluetooth address: needed to be bind |
Notes | When writing the address, you must use commas rather than colons. |
Example | AT+BIND=1234,56,abcdef OK |
AT+POLAR?
Usage | Inquire – drive indication of LED and connection status |
Response | +POLAR=****, **** OK |
Parameter | – |
Notes | Output is in the format: PI08 mode, PI09 mode Default: 1, 1 |
Example | AT+POLAR? +POLAR=0, 1 OK |
AT+POLAR=Param1, Param2
Usage | Set – drive indication of LED and connection status |
Response | OK |
Parameter | Param1: PI08 mode: 0 -> PI08 outputs low level and turn on LED 1 -> PI08 outputs high level and turn on Param2: PI09 mode: 0 -> PI09 output low level indicate successful connection 1 -> PI09 output high level indicate successful connection |
Notes | – |
Example | PI08 outputs low level and turn on LED, PI09 outputs high level and indicates successful connection: AT+POLAR=0, 1 OK |
AT+PIO=Param1, Param2
Usage | Set PIO single port output |
Response | OK |
Parameter | Param1: PIO port number(Decimal): Param2: PIO port status: 0 -> low level 1 -> high level |
Notes | HC-05 Bluetooth module provides the user with the ports (PI00~PI07 and PI010) which can extern another input and output ports. |
Example | 1. PI010 port outputs high level: AT+PI0=10, 1 OK 2. PI010 port outpust low level: AT+PI0=10, 0 OK |
AT+MPIO=Param1
Usage | Set PIO multiple port output |
Response | OK |
Parameter | Param1: Mask combination of PIO ports number (Decimal) |
Notes | (1) Mask of PIO port number = (1<<port number) (2) Mask combination of PIO ports number= (PIO port number mask 1|PIO port numbermask 2|……) Example : PI02 port number mask=(1<<2) =0x004 PI010 port number mask =(1<<10)=0x400 Mask combination of PI02 and PI010 port number=(0x004|0x400)=0x404 |
Example | 1. PI010 and PI02 ports output high level: AT+MPI0=404 OK 2. PI04 port output high level: AT+PI0=004 OK 3. PI010 port output high level: AT+PI0=400 OK 4. All ports output low level: AT+MPI0=0 OK |
AT+MPIO?
Usage | Inquire PIO port input |
Response | +MPIO:**** OK |
Parameter | Param1: PIO port value (16bits) Param[0]=PI00 Param[1]=PI01 Param[2]=PI02 … Param[10]=PI010 Param[11]=PI011 |
Notes | – |
Example | – |
AT+IPSCAN?
Usage | Inquire page scan and inquire scan parameter |
Response | +IPSCAN:****, ****, ****, **** OK |
Parameter | – |
Notes | Output is in the format: time interval of inquiring, duration in inquiring, time interval of paging, duration in paging Default:1024,512,1024,512 |
Example | AT+IPSCAN? +IPSCAN:1234,500,1200,250 OK |
AT+IPSCAN=Param1, Param2, Param3, Param4
Usage | Set page scan and inquire scan parameter |
Response | OK |
Parameter | Param1:time interval of inquiring Param2: duration in inquiring Param3: time interval of paging Param4: duration in paging |
Notes | – |
Example | AT+IPSCAN=1234,500,1200,250 OK |
AT+SNIFF?
Usage | Inquire—SNIFF energy parameter |
Response | +SNIFF:****, ****, ****, **** OK |
Parameter | – |
Notes | Output is in the format: maximum time, minimum time, test time, limited time Default : 0,0,0,0 |
Example | – |
AT+SENM?
Usage | Inquire safe and encryption mode |
Response | +SENM:****, **** OK |
Parameter | – |
Notes | Output is in the format: the value of safe mode, the value of encryption mode Default : 0,0 |
Example | – |
AT+SENM=Param1, Param2
Usage | Set safe and encryption mode | |
Response | If Success: OK | If Failure: FAIL |
Parameter | Param1: the value of safe mode: 0 -> sec_mode0+off 1 -> sec_mode1+non_secure 2 -> sec_mode2_service 3 -> sec_mode3_link 4 -> sec_mode_unknown Param2: the value of encryption mode: 0 -> hci_enc_mode_off 1 -> hci_enc_mode_pt_to_pt 2 -> hci_enc_mode_pt_to_pt_and_bcast | |
Notes | – | |
Example | – |
AT+RMSAD=Param1
Usage | Delete authenticated device in the Bluetooth pair list |
Response | OK |
Parameter | Param1: Bluetooth device address |
Notes | – |
Example | AT+RMSAD=1234,56,abcdef OK | FAIL |
AT+RMAAD
Usage | Delete all authenticated devices in the pair list |
Response | OK |
Parameter | – |
Notes | – |
Example | AT+RMAAD OK |
AT+FSAD=Param1
Usage | Seek the authenticated device in the Bluetooth pair list | |
Response | If Success: OK | If Failure: FAIL |
Parameter | Param1: Bluetooth device address | |
Notes | – | |
Example | AT+FSAD=1234,56,abcdef OK | FAIL |
AT+ADCN?
Usage | Get the authenticated device count from the pair list |
Response | +ADCN:**** OK |
Parameter | – |
Notes | – |
Example | AT+ADCN? +ADCN:0 OK |
AT+MRAD?
Usage | Get the Bluetooth address of Most Recently Used Authenticated Device |
Response | +MRAD:**** OK |
Parameter | – |
Notes | – |
Example | AT+MRAD? +MRAD:0:0:0 OK |
AT+STATE?
Usage | Get the work status of Bluetooth module |
Response | +STATE:**** OK |
Parameter | – |
Notes | Result can be one of the following: “INITIALIZED” -> initialized status “READY” -> ready status “PAIRABLE” -> pairable status “PAIRED” -> paired status “INQUIRING” -> inquiring status “CONNECTING” -> connecting status “CONNECTED” -> connected status “DISCONNECTED” -> disconnected status “NUKNOW” -> unknown status |
Example | AT+STATE? +STATE:INITIALIZED OK |
AT+INIT
Usage | Initialize the SPP profile lib | |
Response | If Success: OK | If Failure: FAIL |
Parameter | – | |
Notes | – | |
Example | AT+INIT OK |
AT+INQM?
Usage | Inquire Bluetooth device |
Response | +INQ:**** +INQ:**** … OK |
Parameter | – |
Notes | Every result is in the form: +INQ:Bluetooth address, Device type, RSSI signal intensity |
Example | AT+INQ +INQ:2:72:D2224,3E0104,FFBC +INQ:1234:56:0,1F1F,FFC1 +INQ:1234:56:0,1F1F,FFC0 OK |
AT+PAIR=Param1, Param2
Usage | Set pair | |
Response | If Success: OK | If Failure: FAIL |
Parameter | Param1: Bluetooth address of remote device Param2: limited time of connection (second) | |
Notes | – | |
Example | Make pair with the remote Bluetooth device(address:1234:56:abcdef), the limited time is 20s: AT+PAIR=1234,56,abcdef,20\r\n OK |
AT+LINK=Param1
Usage | Connect device | |
Response | If Success: OK | If Failure: FAIL |
Parameter | Param1: Bluetooth address of remote device | |
Notes | – | |
Example | Connect with the remote Bluetooth device (address: 1234:56:abcdef): AT+FSAD=1234,56,abcdef OK AT+LINK=1234,56,abcdef OK |
AT+DISC
Usage | Disconnection |
Response | If Successful Disconnection: +DISC:SUCCESS OK If Lose the connection: +DISC:LINK_LOSS OK If No SLC connection: +DISC:NO_SLC OK If Disconnection Timeout: +DISC:TIMEOUT OK If Disconnection Error: +DISC:ERROR OK |
Parameter | – |
Notes | – |
Example | – |
AT+ENSNIFF=Param1
Usage | Enter to energy mode |
Response | OK |
Parameter | Param1: Bluetooth address of device |
Notes | – |
Example | – |
AT+EXSNIFF=Param1
Usage | Exit energy mode |
Response | OK |
Parameter | Param1: Bluetooth address of device |
Notes | – |
Example | – |