Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.
Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.
Notes: For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.
HC-05 Bluetooth Module Arduino: Complete Pairing Guide
After spending countless hours debugging wireless communication projects on my bench, I can tell you that the HC-05 Bluetooth module remains one of the most reliable choices for Arduino projects. Whether you’re building a home automation system, a wireless robot controller, or simply want to send data between your phone and microcontroller, this guide covers everything you need to know about the HC-05 Bluetooth module Arduino pairing process.
What is the HC-05 Bluetooth Module?
The HC-05 is a Class 2 Bluetooth SPP (Serial Port Protocol) module designed specifically for transparent wireless serial communication. Unlike its simpler sibling the HC-06, the HC-05 can operate in both master and slave modes, making it incredibly versatile for various project requirements.
From a hardware perspective, the HC-05 is built around the BC417 chip and supports the Bluetooth 2.0 + EDR (Enhanced Data Rate) standard. It communicates with microcontrollers through standard UART serial communication, which means if you’ve worked with serial communication before, you’ll feel right at home.
HC-05 Bluetooth Module Technical Specifications
Parameter
Specification
Bluetooth Version
2.0 + EDR
Operating Frequency
2.4GHz ISM Band
Operating Voltage
3.6V to 6V (with onboard regulator)
Logic Level
3.3V
Default Baud Rate
9600 bps (Data Mode), 38400 bps (AT Mode)
Communication Range
~10 meters (Class 2)
Default Password
1234 or 0000
Default Device Name
HC-05
Operating Temperature
-20°C to +75°C
Current Consumption
~30mA (paired), ~8mA (unpaired)
HC-05 Bluetooth Module Pinout Explained
Understanding the pinout is crucial before you start wiring anything up. I’ve seen too many fried modules from incorrect connections, so let’s get this right from the start.
Pin
Name
Function
1
EN/KEY
Enable AT command mode when HIGH
2
VCC
Power supply (3.6V – 6V)
3
GND
Ground reference
4
TXD
Transmit data (connects to Arduino RX)
5
RXD
Receive data (connects to Arduino TX)
6
STATE
Status indicator (HIGH when paired)
Critical Voltage Level Consideration
Here’s something that trips up many beginners: the HC-05 module operates at 3.3V logic levels. The Arduino Uno outputs 5V on its TX pin. Connecting the Arduino’s TX directly to the HC-05’s RX pin can damage the module over time or cause erratic behavior.
You need a voltage divider circuit between the Arduino TX and HC-05 RX pins. A simple combination of 1kΩ and 2kΩ resistors works perfectly for stepping down 5V to approximately 3.3V.
Hardware Requirements for HC-05 Bluetooth Module Arduino Setup
Before diving into the wiring, gather these components:
Component
Quantity
Purpose
Arduino Uno/Nano/Mega
1
Microcontroller
HC-05 Bluetooth Module
1
Wireless communication
1kΩ Resistor
1
Voltage divider
2kΩ Resistor
1
Voltage divider
Breadboard
1
Prototyping
Jumper Wires
Several
Connections
LED (optional)
1
Visual feedback
220Ω Resistor (optional)
1
LED current limiting
Wiring the HC-05 Bluetooth Module to Arduino
The wiring differs slightly depending on whether you’re using hardware serial (pins 0 and 1) or software serial (any digital pins). I generally recommend software serial because it keeps the hardware serial port free for debugging through the Serial Monitor.
HC-05 Arduino Connection Table (Software Serial)
HC-05 Pin
Arduino Pin
Notes
VCC
5V
Module has onboard 3.3V regulator
GND
GND
Common ground
TXD
Digital Pin 10 (RX)
Direct connection
RXD
Digital Pin 11 (TX)
Through voltage divider
EN/KEY
5V or Digital Pin 9
For AT mode entry
Building the Voltage Divider
Connect the voltage divider as follows: run one end of the 1kΩ resistor to Arduino digital pin 11 (TX), connect the other end to the HC-05 RX pin, then connect the 2kΩ resistor between the HC-05 RX pin and ground. This creates a simple resistor divider that converts the 5V signal to approximately 3.3V.
Basic Arduino Code for HC-05 Bluetooth Module Communication
Let’s start with a simple sketch that establishes communication between your Arduino and a smartphone via the HC-05 Bluetooth module.
#include <SoftwareSerial.h>
// Define Bluetooth serial pins
SoftwareSerial BTSerial(10, 11); // RX, TX
int ledPin = 13;
void setup() {
// Initialize hardware serial for debugging
Serial.begin(9600);
// Initialize Bluetooth serial
BTSerial.begin(9600);
pinMode(ledPin, OUTPUT);
Serial.println(“HC-05 Bluetooth Module Ready”);
Serial.println(“Waiting for connection…”);
}
void loop() {
// Check for incoming Bluetooth data
if (BTSerial.available()) {
char data = BTSerial.read();
Serial.print(“Received: “);
Serial.println(data);
// Simple LED control
if (data == ‘1’) {
digitalWrite(ledPin, HIGH);
BTSerial.println(“LED ON”);
}
else if (data == ‘0’) {
digitalWrite(ledPin, LOW);
BTSerial.println(“LED OFF”);
}
}
// Send data from Serial Monitor to Bluetooth
if (Serial.available()) {
char data = Serial.read();
BTSerial.write(data);
}
}
Upload this code to your Arduino, and you’re ready to start the pairing process.
How to Pair HC-05 Bluetooth Module with Android Smartphone
The pairing process is straightforward once your hardware is properly connected. Follow these steps:
Step 1: Power up your Arduino with the HC-05 module connected. You should see the onboard LED blinking rapidly (approximately 2Hz). This indicates the module is in pairing mode and discoverable.
Step 2: On your Android phone, enable Bluetooth and search for available devices. Look for “HC-05” in the list of discoverable devices.
Step 3: Tap on HC-05 to initiate pairing. When prompted for a PIN, enter “1234” (this is the default password). If that doesn’t work, try “0000”.
Step 4: Download a Bluetooth terminal application from the Play Store. I recommend “Serial Bluetooth Terminal” for its simplicity and reliability.
Step 5: Open the terminal app and connect to the HC-05 device you just paired.
Step 6: Once connected, the LED blinking pattern on the HC-05 changes from rapid blinking to two quick blinks followed by a pause. This indicates a successful connection.
Step 7: Try sending “1” from the app to turn on the LED, and “0” to turn it off.
How to Pair HC-05 Bluetooth Module with PC or Laptop
Connecting to a Windows PC follows a similar process:
Step 1: Open Bluetooth settings on your computer. Click “Add Bluetooth or other device.”
Step 2: Select “Bluetooth” from the device type options.
Step 3: Your PC will search for available devices. Select “HC-05” when it appears.
Step 4: Enter the pairing code “1234” when prompted.
Step 5: After successful pairing, check your Device Manager under “Ports (COM & LPT).” You’ll see two new entries for “Standard Serial over Bluetooth link.” Note the COM port numbers.
Step 6: Use a serial terminal program like PuTTY or Tera Term to connect to the appropriate COM port at 9600 baud rate.
Configuring HC-05 Using AT Commands
The HC-05 module supports a comprehensive set of AT commands that let you customize its behavior. You can change the device name, password, baud rate, and even set it up as a master device.
Entering AT Command Mode
There are two ways to enter AT command mode, depending on your module version:
Method 1 (Most common): Disconnect power from the module, hold down the small button on the module, then reconnect power while continuing to hold the button. Release after a few seconds. The LED should now blink slowly (once every 2 seconds), indicating AT mode.
Method 2: Connect the EN/KEY pin to 5V before powering the module, then apply power. The module enters AT mode automatically.
AT Command Mode Arduino Code
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(10, 11); // RX, TX
void setup() {
Serial.begin(9600);
Serial.println(“Enter AT commands:”);
// AT mode uses 38400 baud by default
BTSerial.begin(38400);
}
void loop() {
// Read from Bluetooth and send to Serial Monitor
if (BTSerial.available()) {
Serial.write(BTSerial.read());
}
// Read from Serial Monitor and send to Bluetooth
if (Serial.available()) {
BTSerial.write(Serial.read());
}
}
Essential AT Commands Reference Table
Command
Function
Example Response
AT
Test communication
OK
AT+VERSION?
Check firmware version
+VERSION:x.x
AT+NAME?
Query device name
+NAME:HC-05
AT+NAME=NewName
Set device name
OK
AT+ADDR?
Query MAC address
+ADDR:xxxx:xx:xxxxxx
AT+PSWD?
Query password
+PSWD:1234
AT+PSWD=NewPass
Set new password
OK
AT+UART?
Query baud rate settings
+UART:9600,0,0
AT+UART=38400,0,0
Set baud rate
OK
AT+ROLE?
Query current role
+ROLE:0 (Slave)
AT+ROLE=1
Set as Master
OK
AT+ROLE=0
Set as Slave
OK
AT+RESET
Reset module
OK
AT+ORGL
Restore factory settings
OK
Remember that AT commands must be sent with both carriage return (CR) and line feed (LF) terminators. In the Arduino Serial Monitor, set the dropdown to “Both NL & CR” before sending commands.
Configuring HC-05 as Master and Slave for Arduino-to-Arduino Communication
One of the most powerful features of the HC-05 is its ability to function as either master or slave, enabling direct communication between two Arduino boards without any smartphone or computer involved.
Configuring the Slave HC-05
Enter AT mode and send these commands:
AT+ROLE=0 (Set as slave)
AT+ADDR? (Note down this address for the master configuration)
Configuring the Master HC-05
Enter AT mode on the second module and send:
AT+ROLE=1 (Set as master)
AT+CMODE=0 (Connect to fixed address only)
AT+BIND=xxxx,xx,xxxxxx (Replace with slave’s address, using commas instead of colons)
After configuration, power cycle both modules. The master will automatically connect to the slave within seconds. Both LEDs will change to a pattern of two quick blinks followed by a pause, indicating successful pairing.
HC-05 Bluetooth Module Arduino Troubleshooting Guide
Over the years, I’ve encountered just about every possible issue with these modules. Here’s how to solve the most common problems:
Problem: HC-05 Not Appearing in Bluetooth Search
Causes and Solutions:
Possible Cause
Solution
Module not powered
Check VCC connection and verify LED is blinking
Module already paired
Unpair from previous device first
Wrong mode
Ensure module is in data mode (rapid LED blinking)
Distance too far
Move device closer (within 10 meters)
Problem: Can Pair but Cannot Connect
This usually indicates a software issue rather than hardware. Check that your terminal app supports the SPP profile. Also verify the baud rate in your code matches the module’s configuration (default is 9600).
Problem: Garbled Data or No Communication
Baud rate mismatch is the most common culprit. Not all HC-05 modules ship with 9600 as the default. Some come configured at 38400. Enter AT mode and check with AT+UART? to verify the actual baud rate.
Problem: Module Keeps Disconnecting
Power supply issues cause most auto-disconnect problems. The HC-05 draws more current when transmitting data, and if your power supply can’t handle the demand, the module resets. Try powering the module from a separate, stable power source instead of the Arduino’s 5V pin.
Problem: AT Commands Not Working
Make sure you’re in proper AT command mode (slow LED blinking). Verify the baud rate is set to 38400 for AT mode. Check that your terminal is sending both CR and LF with each command.
Advanced HC-05 Bluetooth Module Arduino Projects
Once you’ve mastered basic communication, consider these project ideas:
Wireless Sensor Monitoring: Connect temperature, humidity, or motion sensors to Arduino and transmit readings to your smartphone in real-time.
Bluetooth-Controlled Robot: Build a robot car that receives direction commands from a custom Android app through the HC-05 module.
Home Automation System: Control lights, fans, and other appliances wirelessly from your phone using relay modules connected to Arduino.
Data Logger with Wireless Download: Store sensor data on an SD card and download it wirelessly via Bluetooth when needed.
Useful Resources and Downloads
Here are some valuable resources for working with the HC-05 Bluetooth module Arduino:
What is the default password for HC-05 Bluetooth module?
The default password (also called PIN or pairing code) for most HC-05 modules is “1234”. However, some modules may come with “0000” as the default. You can change this password using the AT command AT+PSWD=NewPassword when in AT command mode.
Can I connect multiple devices to one HC-05 module simultaneously?
No, the HC-05 module supports only point-to-point communication. It can connect to only one device at a time. If you need to communicate with multiple devices, you would need multiple HC-05 modules or consider using a different communication protocol like WiFi with an ESP8266 or ESP32.
What is the difference between HC-05 and HC-06 Bluetooth modules?
The HC-05 can operate in both master and slave modes, while the HC-06 works only as a slave device. The HC-05 also has a more comprehensive AT command set for configuration. Additionally, the HC-05 typically has a button for entering AT mode, whereas the HC-06 is always in AT mode when not connected. For most Arduino projects requiring flexibility, the HC-05 is the better choice.
Why is my HC-05 Bluetooth module not sending or receiving data?
Several factors can cause communication failure: incorrect wiring (especially swapped TX/RX connections), baud rate mismatch between your code and module configuration, missing voltage divider on the RX line, or the module being in AT mode instead of data mode. Double-check your connections, verify the baud rate using AT commands, and ensure the LED shows rapid blinking indicating normal operation mode.
How far can the HC-05 Bluetooth module communicate?
The HC-05 is a Class 2 Bluetooth device with a typical range of about 10 meters in open space. Walls, electronic interference, and other obstacles can significantly reduce this range. For longer-range wireless communication, consider modules like HC-12 (up to 1km) or nRF24L01+ with an external antenna.
Final Thoughts
The HC-05 Bluetooth module Arduino combination remains a solid choice for wireless projects despite newer technologies being available. Its simplicity, reliability, and extensive documentation make it ideal for both beginners learning about wireless communication and experienced developers building practical applications.
The key to success with any HC-05 project lies in understanding the basics: proper voltage level handling, correct baud rate configuration, and knowing how to troubleshoot common issues. With the information in this guide, you should be well-equipped to integrate Bluetooth functionality into your next Arduino project.
Start with simple LED control to verify your setup works, then gradually move to more complex applications. And remember, when things don’t work as expected, systematically check your connections, verify your baud rates, and test with simple code before adding complexity.
Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.
Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.
Notes: For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.