Pantech.AI

How to Interface HC-05 with Arduino UNO

Overview of Bluetooth

HC-05 Bluetooth Module

The HC-05 is a Bluetooth module used for wireless communication with Bluetooth-enabled devices, such as smartphones. It communicates with microcontrollers via serial communication (USART).

The default settings of the HC-05 Bluetooth module can be modified using specific AT commands.

Since the HC-05 module operates at a 3.3V logic level for its RX/TX pins, and microcontrollers can detect 3.3V signals, there is no need to shift the TX voltage level from the HC-05. However, you will need to shift the transmit voltage level from the microcontroller to the RX pin of the HC-05 module.

For more information on the HC-05 Bluetooth module and its usage, refer to the “HC-05 Bluetooth Module” topic in the Sensors and Modules section.

Connection Diagram of HC-05 with Arduino

Interfacing HC-05 Bluetooth Module with Arduino UNO

Note: The default Bluetooth name of the HC-05 module is “HC-05,” and the default PIN (password) for pairing is either “0000” or “1234.”

Send Messages Using Bluetooth HC-05 with Arduino

In this setup, we will transmit data from a smartphone via Bluetooth to the Arduino Uno and display it on the PC’s Serial Monitor.

To get started, download and install a Bluetooth terminal application on your smartphone. Use this app to connect to the HC-05 Bluetooth module.

Data sent from the smartphone through the Bluetooth terminal application will be received by the Arduino and displayed on the Serial Monitor.

HC-05 Bluetooth Module Code for Arduino Uno

#include<SoftwareSerial.h>

/* Create object named bt of the class SoftwareSerial */ 
SoftwareSerial bt(2,3); /* (Rx,Tx) */	

void setup() {
  bt.begin(9600);	/* Define baud rate for software serial communication */
  Serial.begin(9600);	/* Define baud rate for serial communication */
}

void loop() {
  
    if (bt.available())	/* If data is available on serial port */
    {
     Serial.write(bt.read());	/* Print character received on to the serial monitor */
    }
}

Leave a Comment

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