

The HC-05 Bluetooth Module, manufactured by Bluetooth Serial Port Profile (Part ID: HC-05), is a versatile wireless communication module designed for short-range data transfer. It operates using Bluetooth technology and is widely used in embedded systems, IoT devices, and robotics. The module supports both master and slave modes, making it suitable for a variety of applications requiring wireless communication.








The HC-05 module has 6 pins, as described in the table below:
| Pin Name | Pin Number | Description |
|---|---|---|
| VCC | 1 | Power supply input (3.3V to 5V). |
| GND | 2 | Ground connection. |
| TXD | 3 | Transmit data pin (connects to RXD of the microcontroller). |
| RXD | 4 | Receive data pin (connects to TXD of the microcontroller). |
| EN (Key) | 5 | Enable pin for entering AT command mode (active HIGH). |
| STATE | 6 | Indicates the connection status (LOW: not connected, HIGH: connected). |
AT: Test the connection.AT+NAME=YourDeviceName: Set the module name.AT+PSWD=YourPIN: Set the pairing PIN.AT+ROLE=0: Set the module to slave mode (default).Below is an example of how to use the HC-05 module with an Arduino UNO for basic serial communication:
#include <SoftwareSerial.h>
// Define RX and TX pins for SoftwareSerial
SoftwareSerial BTSerial(10, 11); // RX = Pin 10, TX = Pin 11
void setup() {
// Initialize hardware serial for debugging
Serial.begin(9600);
// Initialize Bluetooth serial communication
BTSerial.begin(9600); // Default baud rate of HC-05
Serial.println("HC-05 Bluetooth Module Initialized");
}
void loop() {
// Check if data is available from Bluetooth
if (BTSerial.available()) {
char data = BTSerial.read(); // Read data from HC-05
Serial.print("Received: ");
Serial.println(data); // Print received data to Serial Monitor
}
// Check if data is available from Serial Monitor
if (Serial.available()) {
char data = Serial.read(); // Read data from Serial Monitor
BTSerial.write(data); // Send data to HC-05
Serial.print("Sent: ");
Serial.println(data); // Print sent data to Serial Monitor
}
}
Module Not Powering On:
Unable to Pair with a Device:
No Data Transmission:
AT Commands Not Working:
Q: Can the HC-05 module be used with a 5V microcontroller?
A: Yes, but a voltage divider is recommended on the RXD pin to prevent damage, as the HC-05 operates at 3.3V logic levels.
Q: How do I reset the HC-05 to factory settings?
A: Enter AT command mode and send the AT+ORGL command to reset the module to its default settings.
Q: What is the difference between master and slave modes?
A: In master mode, the HC-05 initiates connections with other devices. In slave mode, it waits for incoming connections.
Q: Can I change the default baud rate?
A: Yes, use the AT command AT+UART=<baud rate>,0,0 to set a new baud rate. For example, AT+UART=115200,0,0.
By following this documentation, users can effectively integrate the HC-05 Bluetooth Module into their projects and troubleshoot common issues.