Introduction
In today’s world of smart devices and wireless connectivity, Bluetooth technology has become an integral part of our daily lives. Bluetooth modules are widely used for wireless communication between various devices. One such module is the HC-05 Bluetooth module.
In this article, we will learn how to interface the “HC-05 Bluetooth module” with Arduino, allowing us to control and communicate with our devices wirelessly.
What is HC-05 Bluetooth Module?
The HC-05 Bluetooth module is a wireless communication module that allows two devices to establish a wireless connection and exchange data over short distances. It is a popular and low-cost module that is widely used in various applications, including robotics, home automation systems, and wireless sensor networks.
The HC-05 module is based on the Bluetooth version 2.0 protocol and supports the Serial Port Profile (SPP), which enables it to establish a virtual serial connection with other devices, such as microcontrollers like the Arduino board. It operates at a frequency of 2.4GHz and has a range of up to 10 meters.

Hardware Components
To interface an HC-05 Bluetooth Module with Arduino, you’ll need the following hardware components to get started:
Components | Value | Qty |
---|---|---|
Arduino UNO | – | 1 |
USB Cable Type A to B | – | 1 |
DC Power for Arduino | – | 1 |
Bluetooth Module | HC-05 | 1 |
Breadboard | – | 1 |
Jumper Wires | – | 1 |
HC-05 Bluetooth Module Pinout

Sl. No | Pin Name | Pin Description |
---|---|---|
1 | VCC | This is the Power supply pin of the module. You can connect 5 V from the Arduino UNO to this pin. |
2 | GND | GND pin of the HC-05 should be connected to the ground connection of your project. This can be connected to the GND pin on the Arduino UNO |
3 | TXD | TXD is the transmit pin of the Bluetooth module. Connect the TXD pin of HC-05 to the RXD pin of the MCU (Arduino UNO PIN 0) |
4 | RXD | RXD is the receive pin of the module. You will send the commands to the module via this RXD pin. Connect TXD Pin of the MCU (Arduino UNO PIN 1) |
5 | KEY | The KEY pin enables you to put the HC-05 Bluetooth module in AT command mode. |
6 | STATE | The STATE pin tells the Arduino UNO whether the HC-05 is connected to a Bluetooth device or not. The STATE pin will be high when it is connected to a Bluetooth device. It will be low when it si not connected to any device. |
HC-05 Bluetooth Module Circuit
Make connections according to the circuit diagram given below.

Wiring / Connections
Arduino | HC-05 Bluetooth Module | LED LIGHT |
---|---|---|
5V | VCC | |
GND | GND | GND |
D0 TXD | TXD | |
D1 RXD | RXD | |
D8 | ANODE + |
Installing Arduino IDE
First, you need to install Arduino IDE Software from its official website Arduino. Here is a simple step-by-step guide on “How to install Arduino IDE“.
Installing Libraries
Before you start uploading a code, download and unzip the following libraries at /Program Files(x86)/Arduino/Libraries (default), in order to use the sensor with the Arduino board. Here is a simple step-by-step guide on “How to Add Libraries in Arduino IDE“.
Code
Now copy the following code and upload it to Arduino IDE Software.
#include <SoftwareSerial.h>
SoftwareSerial MyBlue(2, 3); // RX | TX
int flag = 0;
int LED = 8;
void setup()
{
Serial.begin(9600);
MyBlue.begin(9600);
pinMode(LED, OUTPUT);
Serial.println("Ready to connect\nDefualt password is 1234 or 000");
}
void loop()
{
if (MyBlue.available())
flag = MyBlue.read();
if (flag == 1)
{
digitalWrite(LED, HIGH);
Serial.println("LED On");
}
else if (flag == 0)
{
digitalWrite(LED, HIGH);
Serial.println("LED Off");
}
}
Code Explanation
This Arduino code demonstrates how to control an LED wirelessly using the HC-05 Bluetooth module.
The first line includes the SoftwareSerial library, which is used to create a software serial port on pins 2 and 3 to communicate with the HC-05 module.
The next line initializes the software serial port with the name “MyBlue” and sets the RX and TX pins as 2 and 3, respectively.
The “flag” variable is initialized to 0, which is used later in the code to control the LED. The “LED” variable is initialized to 8, which refers to the digital pin connected to the LED.
In the setup() function, the serial communication is started with a baud rate of 9600 for both the HC-05 module and the serial monitor. The LED pin is set as an output and a message is printed on the serial monitor to indicate that the system is ready to connect and the default password for the HC-05 module is 1234 or 000.
In the loop() function, the code checks whether any data is available on the software serial port. If there is any data available, it is stored in the “flag” variable using the read() function. If the “flag” variable is equal to 1, the LED is turned on and a message is printed on the serial monitor. If the “flag” variable is equal to 0, the LED is turned off and a message is printed on the serial monitor.
Overall, this code demonstrates how to receive data from the HC-05 module wirelessly and use that data to control an LED.
Applications
Here are some applications of the HC-05 Bluetooth module:
- Wireless communication between two devices, such as between an Arduino board and a smartphone or tablet
- Wireless data transfer, such as sending sensor data from an Arduino board to a computer or mobile device
- Remote control of electronic devices, such as controlling an LED or motor from a mobile app
- Internet of Things (IoT) projects, such as connecting multiple sensors and devices to a single hub or gateway
- Voice-controlled applications, such as using a Bluetooth-enabled microphone to control electronic devices
- Wearable technology, such as incorporating the HC-05 module into a smartwatch or fitness tracker to communicate with other devices
- Home automation, such as using the HC-05 module to control lighting, temperature, and other systems in a smart home setup
- Robotics projects, such as controlling a robot wirelessly using a mobile app or computer interface.
Conclusion
Interfacing the HC-05 Bluetooth module with Arduino can open up a world of possibilities for wireless communication and control of devices. With a low-cost Bluetooth module and an Arduino board, we can easily create a wireless control system for our robots, smart vehicles, and home automation systems.