HC-05 Bluetooth Module Interfacing with Arduino UNO

HC-05 Bluetooth Module Interfacing with Arduino UNO

Introduction

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.

Interfacing Diagram

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”. 

Example

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.

Sketch for Displaying Data Received Via Bluetooth On Serial Monitor

#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


No comments:

Post a Comment