Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use HC-05: Examples, Pinouts, and Specs

Image of HC-05Design with HC-05 in Cirkit Designer

Introduction

The HC-05 is a Bluetooth module that allows for wireless communication between devices. It operates in the 2.4 GHz frequency range and is commonly used in embedded systems for connecting microcontrollers to smartphones or other Bluetooth-enabled devices. The module supports both master and slave modes, making it versatile for a wide range of applications.

Explore Projects Built with HC-05

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Raspberry Pi Pico-Based Navigation Assistant with Bluetooth and GPS: A project utilizing HC-05 in a practical application
Raspberry Pi Pico-Based Navigation Assistant with Bluetooth and GPS

This circuit features a Raspberry Pi Pico microcontroller interfaced with an HC-05 Bluetooth module for wireless communication, an HMC5883L compass module for magnetic field measurement, and a GPS NEO 6M module for location tracking. The Pico is configured to communicate with the HC-05 via serial connection (TX/RX), with the compass module via I2C (SCL/SDA), and with the GPS module via serial (TX/RX). Common power (VCC) and ground (GND) lines are shared among all modules, indicating a unified power system.

Open Project in Cirkit Designer
Image of Arduino UNO Bluetooth Communication Interface: A project utilizing HC-05 in a practical application
Arduino UNO Bluetooth Communication Interface

This circuit connects an HC-05 Bluetooth module to an Arduino UNO for wireless communication. The HC-05's VCC and GND are connected to the Arduino's 5V and GND, respectively, for power. The TXD pin of the HC-05 is connected to the Arduino's D1 (RX) pin, and the RXD pin of the HC-05 is connected through a voltage divider made of two resistors to the Arduino's D0 (TX) pin, allowing for serial communication between the two devices.

Open Project in Cirkit Designer
Image of Arduino UNO Bluetooth-Controlled Relay System: A project utilizing HC-05 in a practical application
Arduino UNO Bluetooth-Controlled Relay System

This circuit features an Arduino UNO microcontroller interfaced with an HC-05 Bluetooth module for wireless communication. It also includes two 5V two-channel relay modules, which are connected to the Arduino for controlling external devices. The setup allows for remote control of devices via Bluetooth.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

The HC-05 module is designed for ease of use and reliable communication. Below are its key technical details:

Key Technical Details

Pin Configuration and Descriptions

The HC-05 module typically has 6 pins. Below is the pinout and description:

Pin Name Description
1 EN/KEY Used to switch between command mode and data mode. Pull HIGH to enter command mode.
2 VCC Power supply input (3.3V to 5V).
3 GND Ground connection.
4 TXD Transmit data pin. Sends serial data to the connected device.
5 RXD Receive data pin. Receives serial data from the connected device.
6 STATE Indicates the connection status (HIGH when connected, LOW when disconnected).

Usage Instructions

The HC-05 module is straightforward to use in a circuit. Below are the steps and best practices for integrating it into your project.

How to Use the HC-05 in a Circuit

  1. Power the Module: Connect the VCC pin to a 3.3V or 5V power source and the GND pin to ground.
  2. Connect TXD and RXD:
    • Connect the TXD pin of the HC-05 to the RX pin of your microcontroller.
    • Connect the RXD pin of the HC-05 to the TX pin of your microcontroller. Use a voltage divider if your microcontroller operates at 5V logic levels to avoid damaging the HC-05.
  3. Set the Mode:
    • For normal operation (data mode), leave the EN/KEY pin unconnected or LOW.
    • To configure the module (command mode), pull the EN/KEY pin HIGH before powering the module.
  4. Pair the Module: Search for the HC-05 on your Bluetooth-enabled device. The default pairing code is usually 1234 or 0000.
  5. Communicate: Use a serial communication protocol (e.g., UART) to send and receive data.

Important Considerations and Best Practices

Example: Connecting HC-05 to Arduino UNO

Below is an example of how to use the HC-05 with an Arduino UNO to send and receive data.

Circuit Connections

Arduino Code

#include <SoftwareSerial.h>

// Define RX and TX pins for SoftwareSerial
SoftwareSerial BTSerial(10, 11); // RX = Pin 10, TX = Pin 11

void setup() {
  // Start the hardware serial communication
  Serial.begin(9600); // For communication with the PC
  // Start the Bluetooth serial communication
  BTSerial.begin(9600); // Default baud rate of HC-05

  Serial.println("HC-05 Bluetooth Module Test");
  Serial.println("Send data from the Serial Monitor to test.");
}

void loop() {
  // Check if data is available from the Bluetooth module
  if (BTSerial.available()) {
    char data = BTSerial.read(); // Read the data
    Serial.print("Received from Bluetooth: ");
    Serial.println(data); // Print the data to the Serial Monitor
  }

  // Check if data is available from the Serial Monitor
  if (Serial.available()) {
    char data = Serial.read(); // Read the data
    BTSerial.write(data); // Send the data to the Bluetooth module
    Serial.print("Sent to Bluetooth: ");
    Serial.println(data); // Print the data to the Serial Monitor
  }
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. Module Not Pairing:

    • Ensure the HC-05 is powered and in range.
    • Verify the pairing code (default is 1234 or 0000).
    • Check if the module is in data mode (EN/KEY pin LOW or unconnected).
  2. No Data Transmission:

    • Verify the TXD and RXD connections.
    • Ensure the baud rate matches between the HC-05 and the microcontroller.
    • Check for proper voltage levels on the RXD pin.
  3. Unstable Connection:

    • Avoid interference from other RF devices.
    • Ensure a clear line of sight between the HC-05 and the paired device.
  4. Cannot Enter Command Mode:

    • Ensure the EN/KEY pin is HIGH before powering the module.
    • Use a serial terminal to send AT commands and verify the response.

FAQs