HC-05 Bluetooth Module

Introduction

The HC-05 Bluetooth module is a widely used wireless communication component that enables seamless data transmission between microcontrollers and other Bluetooth-enabled devices. It operates using the Bluetooth 2.0+EDR (Enhanced Data Rate) standard, making it an ideal choice for short-range wireless communication in embedded systems, robotics, and IoT applications.

Overview of the HC-05 Bluetooth Module

The HC-05 module is a versatile Bluetooth Serial Port Protocol (SPP) device that can function in both master and slave modes. It facilitates wireless serial communication, making it a popular choice for Arduino, Raspberry Pi, and other microcontroller-based projects.

Key Features

  • Bluetooth 2.0+EDR Standard: Ensures reliable wireless communication with a range of up to 10 meters.
  • Master/Slave Mode: Can be configured as either a master or a slave device.
  • Serial Communication: Uses UART with a default baud rate of 9600 bps.
  • Low Power Consumption: Operates efficiently with a 3.3V to 5V power supply.
  • Integrated LED Indicator: Shows module status and pairing state.

Pin Configuration of HC-05

The HC-05 Bluetooth module consists of six pins:

  1. VCC – Power supply (3.6V–6V, typically 5V)
  2. GND – Ground connection
  3. TXD – Transmit data pin (connects to RX of microcontroller)
  4. RXD – Receive data pin (connects to TX of microcontroller)
  5. STATE – Indicates connection status
  6. EN/KEY – Used to switch between command and data mode

Modes of Operation

The HC-05 operates in two primary modes:

  1. Data Mode – Used for normal wireless data transfer.
  2. Command Mode – Enables configuration of the module using AT commands.

AT Commands for Configuration

AT commands allow users to modify the settings of the HC-05 module. Some common AT commands include:

  • AT – Checks communication with the module.
  • AT+NAME=<desired_name> – Changes the module’s Bluetooth name.
  • AT+ROLE=<0/1> – Sets the module as a slave (0) or master (1).
  • AT+PSWD=<password> – Sets a pairing password.

Applications of HC-05

  1. Wireless Data Transmission: Used for sending and receiving data between microcontrollers.
  2. Home Automation: Enables remote control of smart home devices.
  3. Robotics: Provides wireless control for robots.
  4. IoT Projects: Facilitates Bluetooth communication in Internet of Things applications.
  5. Wearable Technology: Used in smart wearable devices.

Interfacing HC-05 with Arduino

The HC-05 can be easily connected to an Arduino for wireless communication.

Wiring Diagram

HC-05 PinArduino Pin
VCC5V
GNDGND
TXDRX (D2)
RXDTX (D3)
STATENot Used
EN/KEYNot Used

Sample Arduino Code

#include <SoftwareSerial.h>
SoftwareSerial BTSerial(2, 3); // RX, TX

void setup() {
    Serial.begin(9600);
    BTSerial.begin(9600);
}

void loop() {
    if (BTSerial.available()) {
        Serial.write(BTSerial.read());
    }
    if (Serial.available()) {
        BTSerial.write(Serial.read());
    }
}
Categories: Uncategorized