The HC-05 is a versatile and powerful Bluetooth module that enables wireless communication between devices. It operates on Bluetooth 2.0 technology and can serve as both a master and a slave device. Common applications of the HC-05 include wireless control systems, serial communication, and remote data logging.
Pin Number | Name | Type | Description |
---|---|---|---|
1 | KEY | Input | Module enters AT command mode when pulled HIGH |
2 | VCC | Power | Supply voltage 3.6V to 6V (5V typical) |
3 | GND | Power | Ground |
4 | TXD | Output | Transmit Data (connect to RXD of MCU) |
5 | RXD | Input | Receive Data (connect to TXD of MCU) |
6 | STATE | Output | Indicates the connection status |
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(10, 11); // RX | TX
void setup() {
pinMode(9, OUTPUT); // KEY pin if needed for AT commands
digitalWrite(9, HIGH); // Enable AT command mode
Serial.begin(9600);
Serial.println("Enter AT commands:");
BTSerial.begin(38400); // HC-05 default speed in AT command mode
}
void loop() {
// Keep reading from HC-05 and send to Arduino Serial Monitor
if (BTSerial.available())
Serial.write(BTSerial.read());
// Keep reading from Arduino Serial Monitor and send to HC-05
if (Serial.available())
BTSerial.write(Serial.read());
}
Q: How do I change the name or PIN of the HC-05 module?
A: Enter AT command mode and use the commands AT+NAME=<newname>
and AT+PIN=<newpin>
.
Q: Can I use the HC-05 with a 3.3V microcontroller? A: Yes, the HC-05 operates at 3.3V logic levels, making it compatible with 3.3V systems.
Q: How can I check if my HC-05 is working? A: Power the HC-05 and use a smartphone with Bluetooth to search for new devices. The HC-05 should appear in the list of available devices.
Q: What is the range of the HC-05? A: The HC-05 is a Class 2 Bluetooth device, typically with a range of about 10 meters (30 feet) without obstructions.
Q: How do I reset the HC-05 to factory settings?
A: Enter AT command mode and issue the AT+ORGL
command.
This documentation provides a comprehensive guide to the HC-05 Bluetooth module, covering technical specifications, usage instructions, example code for Arduino UNO, and troubleshooting tips. For further assistance, consult the HC-05 datasheet or contact technical support.