How to Use Bluetooth Module (HC-05) with Arduino

Posted by

Bluetooth communication makes Arduino projects much more exciting. Imagine controlling LEDs from your phone, building a wireless robot car, or sending sensor data without cables. That’s exactly where the HC-05 Bluetooth module becomes useful.

If you’re a beginner, the wiring and code may look confusing at first. Most beginners make this mistake: they connect the module directly without understanding TX and RX communication. The result? The module doesn’t respond, or the upload fails.

Here’s the thing — once you understand the basics, using the HC-05 with Arduino is actually very simple.

In this guide, you’ll learn:

  • What the HC-05 Bluetooth module is
  • How it works with Arduino
  • HC-05 pin connections
  • Arduino code for Bluetooth communication
  • How to control an LED from a smartphone
  • Common mistakes and troubleshooting tips

Let’s understand this step by step.


Table of Contents

  1. What is the HC-05 Bluetooth Module?
  2. Components Required
  3. HC-05 Pinout Explained
  4. Circuit Connection with Arduino
  5. Arduino Code for HC-05
  6. How to Connect HC-05 to Mobile Phone
  7. Common Problems and Fixes
  8. Real Project Ideas
  9. Conclusion
  10. FAQs

What is the HC-05 Bluetooth Module?

The HC-05 is a popular Bluetooth module used for wireless communication between Arduino and devices like smartphones, laptops, or tablets.

It works using serial communication (UART), which means Arduino can send and receive data wirelessly through TX and RX pins.

The module is cheap, beginner-friendly, and widely used in DIY electronics projects.

Features of HC-05

FeatureDetails
Communication TypeBluetooth Serial
Operating Voltage3.6V – 6V
Default Baud Rate9600
RangeAround 10 meters
ModeMaster and Slave

In real projects, this matters a lot because stable wireless communication is essential for smooth control.


Components Required

Before starting, gather these components:

  • Arduino Uno
  • HC-05 Bluetooth Module
  • LED
  • 220Ω Resistor
  • Jumper Wires
  • Breadboard
  • Android Smartphone

Optional but recommended:

  • Voltage divider resistors for RX pin safety

HC-05 Pinout Explained

Understanding the pins first makes wiring much easier.

HC-05 PinFunction
VCCPower Supply
GNDGround
TXDSends Data
RXDReceives Data
EN/KEYAT Command Mode

Most beginners confuse TX and RX connections.

Remember this simple rule:

  • HC-05 TX → Arduino RX
  • HC-05 RX → Arduino TX

The communication lines cross each other.


Circuit Connection with Arduino

Now let’s connect the HC-05 Bluetooth module with Arduino Uno.

Connection Table

HC-05Arduino Uno
VCC5V
GNDGND
TXDPin 10
RXDPin 11
LED PositivePin 13
LED NegativeGND via resistor

We’ll use SoftwareSerial because the default Arduino serial pins are needed for uploading code.


[Image: HC-05 Bluetooth module pin diagram]
Alt text: HC-05 Bluetooth module pinout with TX RX VCC GND

[Image: Arduino HC-05 wiring setup]
Alt text: Arduino Uno connected with HC-05 Bluetooth module


Arduino Code for HC-05 Bluetooth Module

Now comes the fun part — coding.

This example allows you to control an LED using your smartphone.

Send:

  • “1” → LED ON
  • “0” → LED OFF

Arduino Bluetooth Control Code

#include <SoftwareSerial.h>

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

char data;

void setup() {
pinMode(13, OUTPUT);

Serial.begin(9600);
BT.begin(9600);

Serial.println("Bluetooth Ready");
}

void loop() {

if (BT.available()) {
data = BT.read();

Serial.println(data);

if (data == '1') {
digitalWrite(13, HIGH);
}

if (data == '0') {
digitalWrite(13, LOW);
}
}
}

How This Code Works

Let’s break it down simply.

SoftwareSerial Library

#include <SoftwareSerial.h>

This library creates virtual serial pins for Bluetooth communication.

Bluetooth Pins

SoftwareSerial BT(10, 11);
  • Pin 10 → Arduino receives data
  • Pin 11 → Arduino sends data

Reading Data

data = BT.read();

Arduino listens for incoming Bluetooth commands from the mobile app.

LED Control

digitalWrite(13, HIGH);

Turns the LED ON when receiving “1”.


How to Connect HC-05 to Mobile Phone

After uploading the code:

  1. Power the Arduino
  2. Turn on Bluetooth on your phone
  3. Search for devices
  4. Find “HC-05”
  5. Pair using password:
    • 1234
    • or 0000

Now install any Bluetooth terminal app from the Play Store.

Popular apps:

  • Serial Bluetooth Terminal
  • Bluetooth Electronics
  • Arduino Bluetooth Controller

Once connected:

  • Send “1” to turn ON LED
  • Send “0” to turn OFF LED

That’s it.

You’ve created a wireless Arduino project.


Common Problems and Fixes

Most beginners face a few common issues while using the HC-05 Bluetooth module with Arduino.

1. Upload Error in Arduino

This usually happens when TX and RX pins remain connected during code upload.

Fix:

Disconnect HC-05 TX/RX wires before uploading code.


2. Bluetooth Not Connecting

Sometimes the phone detects the module but fails to pair.

Fix:

Try default passwords:

  • 1234
  • 0000

Also ensure the module LED is blinking.


3. Garbage Characters in Serial Monitor

This happens due to baud rate mismatch.

Fix:

Set both:

Serial.begin(9600);
BT.begin(9600);

The same baud rate is important.


4. HC-05 Heating Up

This can happen due to incorrect voltage connections.

Fix:

Double-check VCC and GND wiring before powering the module.


Real Project Ideas Using HC-05 with Arduino

Once you understand Bluetooth communication, you can build amazing projects.

Beginner Project Ideas

  • Bluetooth-controlled robot car
  • Wireless home automation
  • Smart door lock
  • Mobile-controlled fan
  • Wireless sensor monitoring

In real projects, this matters a lot because wireless control makes systems more flexible and user-friendly.


HC-05 vs HC-06 Bluetooth Module

Many beginners also ask about HC-05 and HC-06 differences.

FeatureHC-05HC-06
ModeMaster + SlaveSlave Only
ConfigurationMore AdvancedSimple
FlexibilityHigherLower
Best ForAdvanced ProjectsBasic Projects

If you’re learning Arduino seriously, HC-05 is usually the better choice.


[Image: Smartphone controlling Arduino using Bluetooth]
Alt text: Mobile phone controlling Arduino LED through HC-05 Bluetooth

[Image: DIY Bluetooth robot car project]
Alt text: Arduino robot car using HC-05 Bluetooth module


Conclusion

Using the HC-05 Bluetooth module with Arduino is one of the easiest ways to add wireless communication to your projects.

Once you understand TX/RX connections and serial communication, things become much simpler. The good part is that the same concept works in many advanced projects too.

Start with something basic like LED control. Then slowly move toward robotics, home automation, or wireless monitoring systems.

Don’t worry if things don’t work perfectly on the first try. Bluetooth projects often fail because of small wiring mistakes or incorrect baud rates. That’s completely normal when learning electronics.

Keep experimenting, test small changes, and you’ll improve very quickly.


FAQs

Can I use HC-05 with Arduino Nano?

Yes, the HC-05 works perfectly with Arduino Nano using the same wiring and code logic.


What is the default password for HC-05?

Usually:

  • 1234
  • or 0000

Can HC-05 work with iPhone?

Not reliably for classic Bluetooth serial communication. HC-05 works best with Android devices.


Why is my HC-05 blinking continuously?

A blinking LED means the module is powered but not connected to any device.


Do I need a resistor for HC-05 RX pin?

Yes, using a voltage divider is recommended because HC-05 RX works safely at lower voltage levels.


Suggested Internal Links

  • Beginner Arduino Projects
  • How to Set Up Arduino IDE

Leave a Reply

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