Overview of Bluetooth
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
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 |
||
---|---|---|
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. |
X 1 | |
Arduino UNO Arduino UNO |
X 1 | |
Arduino Nano Arduino Nano |
X 1 |
Downloads |
||
---|---|---|
|
HC-05_Bluetooth_Interfacing_With_Arduino_INO | Download |