The HC-05 Bluetooth Module is a wireless communication module designed for short-range data transmission using Bluetooth technology. It is widely used in embedded systems, IoT projects, and other applications requiring wireless communication between devices. The module supports both master and slave modes, making it versatile for various use cases.
The HC-05 module is a compact and reliable solution for Bluetooth communication. Below are its key technical details:
The HC-05 module has 6 pins, as described in the table below:
Pin Name | Description |
---|---|
VCC | Power supply pin (3.3V to 5V). |
GND | Ground pin. Connect to the ground of the circuit. |
TXD | Transmit pin. Sends serial data to the connected device. |
RXD | Receive pin. Receives serial data from the connected device. |
EN (Key) | Enable pin. Used to switch between command mode and data mode. |
STATE | Status pin. Indicates the connection status (HIGH when connected, LOW otherwise). |
The HC-05 module is straightforward to use in a circuit. Below are the steps and best practices for integrating it into your project.
Below is an example of how to use the HC-05 module with an Arduino UNO to send and receive data.
// Example code to send and receive data using HC-05 Bluetooth Module
#include <SoftwareSerial.h>
// Define RX and TX pins for SoftwareSerial
SoftwareSerial BTSerial(10, 11); // RX = Pin 10, TX = Pin 11
void setup() {
// Initialize serial communication
Serial.begin(9600); // For communication with the PC
BTSerial.begin(9600); // For communication with HC-05
Serial.println("HC-05 Bluetooth Module Test");
Serial.println("Send data via Bluetooth to see it here.");
}
void loop() {
// Check if data is available from HC-05
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 Device:
No Data Transmission:
AT Commands Not Working:
Q: Can the HC-05 module work with 5V logic levels?
A: The TXD pin can output 5V logic, but the RXD pin is not 5V tolerant. Use a voltage divider or level shifter for safe operation.
Q: How do I change the module's name or PIN code?
A: Enter command mode by pulling the EN pin HIGH and send the appropriate AT commands (e.g., AT+NAME=NewName
, AT+PIN=5678
).
Q: What is the difference between master and slave modes?
A: In master mode, the HC-05 can initiate connections with other Bluetooth devices. In slave mode, it waits for incoming connections.
By following this documentation, you can effectively integrate the HC-05 Bluetooth Module into your projects and troubleshoot common issues.