Modules

HC-05 Bluetooth Module: Everything You Need to Know (Setup & Code)

Welcome to the community! It’s always exciting to meet another tech enthusiast. This space is built by creators, for creators. Today, we’re diving into the HC-05 Bluetooth Module. This classic little module is one of the easiest ways to add wireless communication to your Arduino or ESP32 projects. Whether you want to control a robot from your phone, send sensor data to an app, or create a wireless remote control, the HC-05 is a reliable and beginner-friendly choice. Let’s break down how it works and how you can start using it today.

What is HC-05 Bluetooth Module?

Metadata; Photo of an HC-05 Bluetooth Module

The HC-05 is a low-cost, Bluetooth 2.0 + EDR (Enhanced Data Rate) serial communication module that works as a slave or master device. Consequently, it is one of the most popular choices for hobbyists and students who want to add wireless serial communication to their projects. This module creates a virtual serial port over Bluetooth, allowing you to send and receive data just like using UART. Therefore, it is perfect for connecting your Arduino to smartphones, tablets, PCs, or other Bluetooth-enabled devices. Additionally, it supports SPP (Serial Port Profile) and comes with easy AT commands for configuration.

Working Principles of HC-05 Bluetooth Module?

Bluetooth Classic Communication: First, the HC-05 uses Bluetooth 2.0 + EDR to establish a wireless connection with another Bluetooth device (usually your phone or computer). As a result, it creates a transparent serial bridge – whatever data you send over UART gets transmitted wirelessly, and vice versa.

Master/Slave Mode: Moreover, the module can operate in slave mode (default) or master mode. In slave mode, other devices can pair with it. In master mode, it can initiate connections to other slaves.

AT Command Configuration: In addition, you can enter AT command mode (by holding the EN/KEY button during power-up) to change settings like name, password (default 1234 or 0000), baud rate, and role.

Hardware Overview of HC-05 Bluetooth Module?

The HC-05 is a small blue PCB with the Bluetooth chip, antenna, status LED, and six-pin header (some pins optional).

Metadata; Close-up of HC-05 module with LED and pins

The LED blinks slowly when not connected and stays solid or blinks fast when paired. As a result, you can quickly tell the connection status. Some versions have a KEY/EN pin to enter AT mode.

Supporting Circuitry: Additionally, it includes a 3.3V regulator (so logic level is 3.3V – use level shifter for 5V Arduino TX). Consequently, the module is very power-efficient and reliable.

Technical Specifications of HC-05 Bluetooth Module?

  • Function: Wireless UART/Serial communication over Bluetooth.
  • Bluetooth Version: 2.0 + EDR (Class 2).
  • Range: Up to 10 meters (line-of-sight).
  • Data Rate: Up to 115200 bps (default 9600).
  • Operating Voltage: 3.6V to 6V (logic 3.3V).
  • Current Consumption: ~30-40 mA connected, ~80 mA peak.
  • Default Settings: Name: HC-05, Password: 1234 or 0000, Baud: 9600.
  • Pinout: VCC, GND, TXD, RXD, KEY/EN, STATE.

HC-05 Bluetooth Module Pinout?

Metadata; Photo of an HC-05 Bluetooth Module Pinout

  • VCC: Power supply (3.6V–6V, commonly 5V)
  • GND: Ground
  • TXD: Transmit (connect to Arduino RX)
  • RXD: Receive (connect to Arduino TX) – 3.3V logic
  • KEY/EN: Hold high during power-up to enter AT command mode
  • STATE: High when connected (optional)

Using HC-05 Bluetooth Module with Arduino

In this part, we will learn how you can use the HC-05 with Arduino Uno, Nano, or Mega to create a wireless serial link in just a few minutes – even if you’re a beginner.

What You Need:

  1. Any Arduino board (Uno recommended)
  2. HC-05 Bluetooth Module
  3. Jumper wires
  4. Level shifter (recommended for Arduino TX to HC-05 RX)
  5. Android phone with Bluetooth Serial app (e.g., Serial Bluetooth Terminal)

Wiring Diagram:

Metadata; Wiring Diagram of HC-05 Bluetooth Module with Arduino Uno

Basic Connections to Arduino:

  • VCC: Connect to 5V on Arduino
  • GND: Connect to Arduino GND
  • TXD (HC-05): Connect to Arduino RX (e.g., pin 10 via SoftwareSerial)
  • RXD (HC-05): Connect to Arduino TX (e.g., pin 11) – use level shifter!

Code:

No special library is required – just use SoftwareSerial. Here’s a tested simple code – just copy-paste into your Arduino IDE.

#include <SoftwareSerial.h>

SoftwareSerial BT(10, 11); // RX, TX

void setup() {
  Serial.begin(9600);
  BT.begin(9600); // Default HC-05 baud rate
  Serial.println("HC-05 Bluetooth Ready! Connect from phone...");
}

void loop() {
  if (BT.available()) {
    Serial.write(BT.read()); // Send data from Bluetooth to Serial Monitor
  }
  
  if (Serial.available()) {
    BT.write(Serial.read()); // Send data from Serial Monitor to Bluetooth
  }
}

Note: This is a basic example using SoftwareSerial – no external library needed.

Metadata; Example of HC-05 Bluetooth communication in Arduino Serial Monitor

After uploading, pair your phone with HC-05 (password 1234 or 0000). Open a Bluetooth terminal app, connect, and start typing – whatever you type on the phone appears in the Serial Monitor, and vice versa!

Wrapping up

That’s a wrap on today’s guide! I hope this walkthrough made it easier to understand how this component fits into your next big idea. Technology is all about experimenting and learning as you go. If something didn’t click, or if you’re hitting a wall with your wiring or code, don’t sweat it! Just drop a comment below. I’m always here to help you troubleshoot and get your project back on track.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button