HC-05 Bluetooth Module Interfacing with Arduino UNO

Bluetooth is a wireless communication protocol used to communicate over short distances. HC-05 Bluetooth module uses serial communication to talk with microcontrollers.

152.8k views1 min readUpdated Aug 8, 2023
HC-05 Bluetooth Module Interfacing with Arduino UNO

Overview of Bluetooth

 

HC-05 Bluetooth Module
HC-05 Bluetooth Module

 

HC-05 is a Bluetooth device used for wireless communication with Bluetooth enabled devices (like smartphone). It communicates with microcontrollers using serial communication (USART).

Default settings of HC-05 Bluetooth module can be changed using certain AT commands.

As HC-05 Bluetooth module has 3.3 V level for RX/TX and microcontroller can detect 3.3 V level, so, there is no need to shift TX voltage level of HC-05 module. But we need to shift the transmit voltage level from microcontroller to RX of HC-05 module.

For more information about HC-05 Bluetooth module and how to use it, refer the topic HC-05 Bluetooth module in the sensors and modules section.

 

Connection Diagram of HC-05 with Arduino

Interfacing HC-05 Bluetooth Module With Arduino Uno
Interfacing HC-05 Bluetooth Module with Arduino UNO

 

 

Note : Default Bluetooth name of the device is “HC-05” and default PIN (password) for connection is either “0000” or “1234”. 

 

Send Message using Bluetooth HC-05 With Arduino

Here, we will transmit data from Smartphone via Bluetooth to the Arduino Uno and display it on Serial Monitor of PC.

Download and install a Bluetooth terminal application on your phone and use it to connect to the HC-05 Bluetooth module.

Data is sent from the Smartphone using the Bluetooth terminal application.

 

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 */
    }
}

 

Video of HC-05 Bluetooth Communication With Arduino Uno

Components Used

Powered byMouser Electronics
  • Bluetooth Module HC-05

    Bluetooth is a wireless communication protocol used to communicate over short distances. It is used for low power, low cost wireless data transmission applications over 2.4 – 2.485 GHz (unlicensed) frequency band.

    713-113020008

  • Arduino UNO

    Arduino UNO

    782-A000073

  • Arduino Nano

    Arduino Nano

    782-ABX00033

Downloads

Comments7

Join the discussion — share a question or tip.

  • TH
    theyno99

    Hello everyone, I want to transfer the voltage I will measure (with shunt resistors) to a smartphone via Bluetooth. can you advise?

    • MA
      MazenSaaed

      first: if the voltage range is not from 0 to 5 then you should use op-amps to make the voltage ranges from 0 to 5. second: take the voltage as an analog input for your Arduino. third: in your Arduino IDE convert the voltage back to the first range and then send it using Bluetooth to your smartphone.

  • SH
    shankarsiri225

    Hi Sir i tried to interface the and control the light and fan control using home automation with low price throw mobile to switching the lights with relay operation but relay board operates the reverse i change the code the led declaration was change in LED 1 and also modified if condition is it reliable for real time application in home automation ? http://bigbelectronics.in/product.php?product=bluetooth-transceiver-module-ttl-outputs-hc05

    • JD
      JdrzejZieliski

      Yes it is. Your relay can be either high or low level triggered and the no/nc terminals change then, but it has a bit broader consequences as well as exchanging 0 to 1 in code. As i wrote swh, bt module without the device that has like idk rtc or something is just a gods angel that repeats what it was told, if you want to have real automation you have to have something to tell to those what should they do, when, where, and how. However, without any transpitters and/or recievers/both (zigbee or wifi as well as even IR) there's no communication between devices, it is very much as trying to talk to someone in the void; this person wont hear your voice and mcus need some kind of Hermes to deliver and recieve info. Just sayin.

  • CH
    chandrasekhar3841

    how to control the robotic car using bluetooth? http://bigbelectronics.in/product.php?product=hm-10-ble-bluetooth-4-0-cc2540-cc2541-serial-wireless-module

  • AV
    avsingh999

    nice But how can I send my sensor data to pc by bluetooth?

    • JD
      JdrzejZieliski

      by default mcu triggers bt to send data over the air so you are going to need something that speks in the language of a sensor as well as a bt module in between of them