Embarking on an electronics project and in need of wireless connectivity? Look no further than the HC-05 module, a classic Bluetooth SPP (Serial Port Protocol) adapter that pairs seamlessly with an Arduino board. This article delves into the world of the HC-05 module, its applications, and how to interface it with an Arduino, ensuring you're equipped with the knowledge to streamline your projects.

The HC-05, manufactured by HC-WiFi, is a modern module that facilitates communication between devices. It's compact, affordable, and exceptionally versatile, making it a gold standard in numerous Arduino projects. With a range of up to 10 meters and the capability to connect up to seven devices, it's an asset in various applications, from robotics to home automation.

Understanding the HC-05 Module
The HC-05 operates as a UART-to-Bluetooth adapter. It communicates with a paired device, like an Arduino, using UART (Universal Asynchronous Receiver/Transmitter) and converts the data into Bluetooth for wireless transmission. This makes it an indispensable tool for adding wireless functionality to your projects.

At its heart, the HC-05 is highly configurable. It can act as a master (initiating connections) or a slave (waiting for connections). You can also set its Bluetooth name, password, and communication baud rate, tailoring it to your specific project's needs.
Key Features of the HC-05 Module

The HC-05 module boasts several features that make it a popular choice among Arduino users:
- Easy to setup and use.
- Supports baud rates from 9600 to 115200.
- Operates in both AT and commander modes.
- Can be set to either master or slave mode.
HC-05 baud rates and communication

Baud rate is a critical consideration when using the HC-05 with an Arduino. Ensuring both devices use the same baud rate is paramount for successful communication. The HC-05 supports a range of baud rates, with common ones being 9600 and 115200.
To set the baud rate, use the AT command 'AT+UART_DEF=9600,0,0'. The first parameter sets the baud rate, the second enables hardware flow control, and the third enables software flow control.
Interfacing HC-05 with Arduino

Connecting the HC-05 to an Arduino involves linking the UART pins (TX and RX) of both devices. Here's a simple guide to get you started:
Before you begin, ensure your HC-05 is in slave mode and paired with your intended device. Connect the Arduino and HC-05 as follows:









| HC-05 | Arduino |
|---|---|
| TXD | RX |
| RXD | TX |
| GND | GND |
Arduino example code
Here's a basic Arduino sketch that sends data to the HC-05:
```cpp const int txPin = 2; // Connect Arduino pin 2 to HC-05 TXD void setup() { Serial.begin(9600); // Start serial communication at 9600 baud rate pinMode(txPin, OUTPUT); } void loop() { Serial.print("Hello from Arduino!"); delay(1000); } ```
Final thoughts and further exploration
The HC-05 module is a versatile, user-friendly tool that opens up ample possibilities in wireless communication for Arduino projects. With its rich feature set and easy interfacing, it's a top pick for hobbyists and professionals alike. As you dive deeper into the world of Bluetooth communication, consider exploring the HC-06 module, its sibling, or delving into more advanced topics like BLE (Bluetooth Low Energy) for optimized power consumption.