How-to · Beginner · 3 min read
HC-05 Bluetooth Module
Wiring, AT Commands and Arduino Code
By Geekobot Learning Team · Updated 24 Oct 2026
On this page
The HC-05 is a Bluetooth Classic module that acts like a wireless serial cable: whatever you send to its TX/RX pins appears on a paired phone or PC, at 9600 baud by default. Power it from 5 V, but its RX pin is 3.3 V, so use a voltage divider from the Arduino's TX. Hold the button at power-up for AT mode to change the name, PIN or baud rate.
Key specs at a glance
- Bluetooth
- Classic 2.0, Serial Port Profile (SPP)
- Supply
- 3.6 to 6 V on the module's VCC (regulator on board), about 40 mA
- Logic
- 3.3 V; RX needs a divider from 5 V boards
- Default baud
- 9600 (data), 38400 (AT mode)
- Default PIN
- 1234 or 0000
- Range
- About 10 m
- HC-06
- Slave only, no mode button; HC-05 can be master or slave
Wiring an HC-05 to an Arduino
| HC-05 pin | Arduino Uno | Notes |
|---|---|---|
| VCC | 5V | |
| GND | GND | |
| TXD | D10 (SoftwareSerial RX) | 3.3 V signal, fine for a 5 V input |
| RXD | D11 (SoftwareSerial TX) via 1 kΩ / 2 kΩ divider | Protects the module's 3.3 V RX |
| EN / KEY | 3.3 V only to enter AT mode | Or hold the button at power-up |
| STATE | Optional | HIGH when connected |
- VCC
- Arduino Uno:
- 5V
- GND
- Arduino Uno:
- GND
- TXD
- Arduino Uno:
- D10 (SoftwareSerial RX)
- Notes:
- 3.3 V signal, fine for a 5 V input
- RXD
- Arduino Uno:
- D11 (SoftwareSerial TX) via 1 kΩ / 2 kΩ divider
- Notes:
- Protects the module's 3.3 V RX
- EN / KEY
- Arduino Uno:
- 3.3 V only to enter AT mode
- Notes:
- Or hold the button at power-up
- STATE
- Arduino Uno:
- Optional
- Notes:
- HIGH when connected
Echo data between phone and Arduino
Use SoftwareSerial on pins 10 and 11 so the hardware serial stays free for uploads. On an ESP32 you do not need an HC-05 at all: use its built-in Bluetooth (BluetoothSerial library).
#include <SoftwareSerial.h>
SoftwareSerial bt(10, 11); // RX, TX
void setup() {
Serial.begin(9600);
bt.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
if (bt.available()) {
char c = bt.read();
if (c == '1') digitalWrite(LED_BUILTIN, HIGH);
if (c == '0') digitalWrite(LED_BUILTIN, LOW);
Serial.write(c);
}
if (Serial.available()) bt.write(Serial.read());
}Pairing with a phone
Pair in Android Bluetooth settings (PIN 1234), then open a Bluetooth serial terminal app such as Serial Bluetooth Terminal and connect to HC-05. Typing 1 or 0 switches the LED. iPhones do not support SPP, so for iOS use an ESP32 with BLE or an HM-10 BLE module.
AT commands: rename, change PIN and baud
- 1Power off, hold the small button (or tie EN to 3.3 V), power on. The LED blinks slowly every 2 seconds.
- 2Set the sketch's
bt.begin(38400)and the Serial Monitor to "Both NL & CR". - 3Send
ATand expectOK. Then:
| Command | Does |
|---|---|
| AT+NAME=OLRobot | Set the Bluetooth name |
| AT+PSWD="5678" | Set the pairing PIN (quotes on newer firmware) |
| AT+UART=115200,0,0 | Set data baud rate |
| AT+ROLE=1 | Make it a master (to connect to another HC-05 or sensor) |
| AT+ORGL | Restore factory settings |
- AT+NAME=OLRobot
- Set the Bluetooth name
- AT+PSWD="5678"
- Set the pairing PIN (quotes on newer firmware)
- AT+UART=115200,0,0
- Set data baud rate
- AT+ROLE=1
- Make it a master (to connect to another HC-05 or sensor)
- AT+ORGL
- Restore factory settings
HC-05 vs HC-06 vs ESP32 vs HM-10
| Module | Type | Works with iPhone | Choose it for |
|---|---|---|---|
| HC-05 | Classic SPP, master or slave | No | Arduino robots and data loggers with Android |
| HC-06 | Classic SPP, slave only | No | Cheapest Android serial link |
| HM-10 / AT-09 | Bluetooth LE | Yes | iOS apps, low power |
| ESP32 (built in) | Classic + BLE | Yes (BLE) | New projects: no extra module, Wi-Fi too |
- HC-05
- Type:
- Classic SPP, master or slave
- Works with iPhone:
- No
- Choose it for:
- Arduino robots and data loggers with Android
- HC-06
- Type:
- Classic SPP, slave only
- Works with iPhone:
- No
- Choose it for:
- Cheapest Android serial link
- HM-10 / AT-09
- Type:
- Bluetooth LE
- Works with iPhone:
- Yes
- Choose it for:
- iOS apps, low power
- ESP32 (built in)
- Type:
- Classic + BLE
- Works with iPhone:
- Yes (BLE)
- Choose it for:
- New projects: no extra module, Wi-Fi too
Try it: Voltage divider calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Connecting the Arduino's 5 V TX directly to the module's RX.
- Using the hardware serial pins and then failing to upload sketches.
- Trying AT mode at 9600 baud; it is 38400 by default.
- Expecting an iPhone to connect; SPP is not supported on iOS.
- Forgetting to set the terminal line ending to NL and CR for AT commands.
Frequently asked questions
What is the HC-05 used for?
Adding a wireless serial link to an Arduino, so a phone or PC can send commands or receive sensor data over Bluetooth.
What is the difference between HC-05 and HC-06?
The HC-05 can act as master or slave and has a mode button; the HC-06 is slave-only. Both use the same wiring and serial behaviour.
Does the HC-05 work with iPhone?
No. It uses Bluetooth Classic SPP, which iOS does not expose to apps. Use a BLE module (HM-10) or an ESP32 for iPhone projects.
How do I enter AT mode on the HC-05?
Hold the button on the module while powering it on, or pull the EN/KEY pin high. The LED blinks slowly, and the module listens at 38400 baud.
Should I buy an HC-05 or an ESP32?
For a new project, an ESP32 board gives Bluetooth and Wi-Fi with no extra wiring. Use the HC-05 to add Bluetooth to an existing Arduino.
Parts for this guide
Calculators
Terms in this guide
Projects that use it
Put this into practice: 4 step-by-step builds in our project library use parts from this guide.
Keep learning
Sources
- HC-05 Bluetooth module datasheet and AT command set (ITead / Guangzhou HC)
- Arduino SoftwareSerial reference
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.


