Introduction
In this guide, we’ll learn everything about using the HC-05 with Arduino. HC-05 is one of the most popular Bluetooth modules used in Arduino projects, especially when you want to add wireless communication to your project.
Whether you want to control a robot from your phone or send sensor data wirelessly, the HC-05 module is a simple and affordable solution. In this complete guide, I’ll show you how to connect HC-05 with Arduino UNO, write code to send and receive data, and even enter AT command mode to change settings like device name and password.
What is HC-05 Bluetooth Module?
HC-05 is a classic Bluetooth module that supports both Master and Slave modes. This makes it more flexible than some other modules, like HC-06 (which only works in Slave mode). It communicates with Arduino using Serial Communication (UART), making it easy to connect with Arduino’s TX and RX pins.
Key Features of HC-05:
- Operating Voltage: 3.6V – 6V (Logic level 3.3V)
- Communication: UART (9600 baud default)
- Range: ~10 meters
- Master/Slave mode support
- Built-in LED for status indication
- Default password: 1234 or 0000

HC-05 Pinout and Explanation
Pin | Description |
---|---|
EN (KEY) | Used to enter AT Command Mode |
VCC | Power supply (3.6V to 6V) |
GND | Ground |
TX | Transmit Data |
RX | Receive Data |
STATE | Status indicator |

How to Connect HC-05 with Arduino UNO
Connecting HC-05 with Arduino is straightforward, but there’s one important detail — HC-05’s RX pin works at 3.3V logic level, while Arduino works at 5V. To avoid damaging the module, we add a voltage divider between Arduino TX and HC-05 RX.
Wiring Table
HC-05 Pin | Arduino Pin |
---|---|
VCC | 5V |
GND | GND |
TX | Pin 2 (Arduino RX) |
RX | Pin 3 (Arduino TX via voltage divider) |
For the voltage divider, use:
- 2K or 2.2K ohm resistor to GND
- 1K ohm resistor between Arduino TX and HC-05 RX

Basic Communication (Send/Receive Data)
To communicate between HC-05 and Arduino, we use SoftwareSerial because Arduino UNO’s hardware serial (pins 0 & 1) is used for uploading code and Serial Monitor.
Code:
// HC-05 with Arduino bu ArduinoYard
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(2, 3); // RX, TX
void setup() {
Serial.begin(9600); // Serial Monitor
BTSerial.begin(9600); // HC-05 Baud Rate
Serial.println("HC-05 with Arduino - Ready");
}
void loop() {
if (BTSerial.available()) {
Serial.write(BTSerial.read());
}
if (Serial.available()) {
BTSerial.write(Serial.read());
}
}
Hardware:

How to Test:
- Upload this code to Arduino.
- Open Serial Monitor (9600 baud, Both NL & CR selected).
- Pair HC-05 with your phone (default password: 1234).
- Use a free app like Serial Bluetooth Terminal on your phone to connect.
- Send messages from the app and see them appear on Serial Monitor!
App Output:

Serial Output:

Entering AT Command Mode (Configuration Mode)
Sometimes you need to change the HC-05 name, password, or baud rate. For that, we use AT commands. We will use the same code as above.
Steps to Enter AT Command Mode:
- Disconnect power from HC-05.
- Hold the KEY/EN button.
- Power the module back on while holding the button.
- The LED will blink slowly (2 seconds gap) — this confirms AT Mode is active.
AT Command Examples:
Command | Description |
---|---|
AT | Check connection |
AT+NAME=ArduinoYard_BT | Set Bluetooth name |
AT+PSWD=4321 | Set new password |
AT+UART=9600,0,0 | Set baud rate |
- Send these from Serial Monitor (9600 baud, Both NL & CR).
- Each command should return OK if successful.
Seril Monitor:

Verifying the New Bluetooth Name:
After successfully changing the name, password, and baud rate through AT commands, it’s time to check if the changes actually took effect. To do this, we can scan for Bluetooth devices using a smartphone.
Once the HC-05 is back in normal mode (by disconnecting and reconnecting power without the WAKEUP pin connected), it will advertise itself with the new name we just set.
Here’s how the module should now appear in your phone’s Bluetooth device list:

Troubleshooting Tip: Baud Rate Issues in AT Mode
If you enter AT mode but don’t get any response after sending commands like AT
, the issue might be the baud rate. Most HC-05 modules expect 38400 in AT mode, but some versions (especially clones) might use 9600 instead. If you face this problem, try changing the Serial Monitor baud rate to 9600 or 38400 and test again. This simple step can save a lot of frustration when working with different module variants.
Control LED with HC-05 and Arduino (Mini Project)
Let’s make a simple project using HC-05 with Arduino — controlling an LED from your phone via Bluetooth.
Wiring
Component | Pin |
---|---|
LED | Pin 7 |
HC-05 | Same as previous wiring |
Code
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(2, 3);
const int ledPin = 7;
void setup() {
pinMode(ledPin, OUTPUT);
BTSerial.begin(9600);
}
void loop() {
if (BTSerial.available()) {
String command = BTSerial.readString();
command.trim();
if (command == "ON") {
digitalWrite(ledPin, HIGH);
} else if (command == "OFF") {
digitalWrite(ledPin, LOW);
}
}
}
How to Test
- Use Bluetooth Terminal app.
- Connect to HC-05.
- Send ON to turn LED on, and OFF to turn it off.
Common Issues and Troubleshooting
Issue | Possible Cause |
---|---|
No response to AT commands | Wrong baud rate, wiring issue, not in AT mode |
Garbage data in Serial Monitor | Baud rate mismatch |
Can’t pair with phone | Wrong password, faulty module |
HC-05 RX not receiving data | Voltage divider missing or incorrect |
Conclusion
That’s everything you need to know to use HC-05 with Arduino! From basic communication to configuring the module and controlling devices via Bluetooth — you’re now ready to use this powerful little module in your own projects.
Let me know in the comments if you face any issues while working with HC-05 with Arduino.
Useful Resources
Guides/Projects
- L298N Motor Driver with Arduino — Learn how to control DC motors using the popular L298N motor driver module with Arduino.
- Arduino MP3 Player with Voice Control using HC-05 and DFPlayer Mini — Create a voice-controlled MP3 player using HC-05 Bluetooth Module and DFPlayer Mini.
Documentation
- HC-05 Datasheet — Complete datasheet and technical details for HC-05 module.
- Arduino SoftwareSerial Library Documentation — Official Arduino documentation for the SoftwareSerial library.