Bluetooth HC-05 Module Details

HC-05 module is a Bluetooth module, designed for transparent wireless serial (SPP – Serial Port Protocol) connection setup.
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). The 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.
PASSWORD DETAILS:-
Bluetooth name of the device is “HC-05” and default PIN (password) for connection is either “0000” or “1234”.
PIN DETAILS:-
1. EN: It is used to bring Bluetooth module in AT commands mode. If EN pin is set to high, then this module will work in command mode. Otherwise by default it is in data mode. The default baud rate of HC-05 in command mode is 38400bps and 9600 in data mode.
2. VCC: Connect 5 V.
3. GND: Ground Pin of module.
4. TXD: Transmit Serial data (wirelessly received data by Bluetooth module transmitted out serially on TXD pin)
5. RXD: Receive data serially (received data will be transmitted wirelessly by Bluetooth module).
6. State: It tells whether module is connected or not.
HC-05 module has two modes,
1. Data mode: Exchange of data between devices.
2. Command mode: It uses AT commands which are used to change setting of HC-05. To send these commands to module serial (USART) port is used. Bluetooth serial modules allow all serial enabled devices to communicate with each other using Bluetooth.
HOW TO IDENTIFY WHERE MODULE CONNECT OR NOT:-
1. HC-05 has red LED which indicates connection status, whether the Bluetooth is connected or not. Before connecting to HC-05 module this red LED blinks continuously in a periodic manner. When it gets connected to any other Bluetooth device, its blinking slows down to two seconds.
2. This module works on 3.3 V. We can connect 5V supply voltage as well since the module has on board 5 to 3.3 V regulator.
3. As HC-05 Bluetooth module has 3.3 V level for RX/TX and microcontroller can detect 3.3 V level, so, no need to shift transmit level of HC-05 module.
Bluetooth communication between Devices:-
To communicate smartphone with HC-05 Bluetooth module, smartphone requires Bluetooth terminal application for transmitting and receiving data. You can find Bluetooth terminal applications for android and windows in respective app. store.
So, when we want to communicate through smartphone with HC-05 Bluetooth module, connect this HC-05 module to the PC via serial to USB converter.
Before establishing communication between two Bluetooth devices, 1st we need to pair HC-05 module to smartphone for communication.
HOW TO CONNECT BT WITH SMARTPHONE:-
1. Search for new Bluetooth device from your phone. You will find Bluetooth device with “HC-05” name.
2. Click on connect/pair device option; default pin for HC-05 is 1234 or 0000.
After pairing two Bluetooth devices, open terminal software in PC, and select the port where we have connected USB to serial module. Also select default baud rate of 9600 bps.
COMMAND MODE:-
• When we want to change settings of HC-05 Bluetooth module like change password for connection, baud rate, Bluetooth device’s name etc.
• To do this, HC-05 has AT commands.
• To use HC-05 Bluetooth module in AT command mode, connect “Key” pin to High (VCC).
• Default Baud rate of HC-05 in command mode is 38400bps.
• Following are some AT command generally used to change setting of Bluetooth module.
• To send these commands, we have to connect HC-05 Bluetooth module to the PC via serial to USB converter and transmit these command through serial terminal of PC.
Command Description Response
AT Checking communication OK
AT+PSWD=XXXX Set Password
e.g. AT+PSWD=4567 OK
AT+NAME=XXXX Set Bluetooth Device Name
e.g. AT+NAME=MyHC-05 OK
AT+UART=Baud rate, stop bit, parity bit Change Baud rate
e.g. AT+UART=9600,1,0 OK
AT+VERSION? Respond version no. of Bluetooth module +Version: XX OK
e.g. +Version: 2.0 20130107 OK
AT+ORGL Send detail of setting done by manufacturer Parameters: device type, module mode, serial parameter, passkey,etc.
APPLICATIONS:-
1. Wireless communication between two microcontrollers.
2. Communicate with Laptop, Desktops and mobile phones.
3. Data Logging application.
4. Consumer applications.
5. Wireless Robots.
6. Home Automation.
HC-05 DEFAULT SETTINGS:-
Default Bluetooth Name: “HC-05”.
Default Password: 1234 or 0000.
Default Communication: Slave.
Default Mode: Data Mode.
Data Mode Baud Rate: 9600, 8, N, 1.
Command Mode Baud Rate: 38400, 8, N, 1.
HARDWARE FUTURES:-
-80dBm sensitivity.
Up to +4dBm RF transmit power.
Low Power 1.8V Operation ,1.8 to 3.6V.
PIO control.
UART interface with programmable baud rate.
With integrated antenna.
SOFTWARE FUTURES:-
A. Default Baud rate: 38400, Data bits:8, Stop bit:1,Parity:No parity, Data control: has.
Supported baud rate: 9600,19200,38400,57600,115200,230400,460800.
B. Given a rising pulse in PIO0, device will be disconnected.
C. Status instruction port PIO1: low-disconnected, high-connected;
D. PIO10 and PIO11 can be connected to red and blue led separately. When master and slave
are paired, red and blue led blinks 1time/2s in interval, while disconnected only blue led blinks 2times/s.
E. Auto-connect to the last device on power as default.
F. Permit pairing device to connect as default.
G. Auto-pairing PINCODE:”0000” as default
H. Auto-reconnect in 30 min when disconnected as a result of beyond the range of connection.
HC-05 Equivalent Bluetooth Module
HC-02, HC-04, HC-06, HM-11, ESP32, CSR8645.
HOW TO INTERFACE BLURTOOTH WITH ARDUINO:-

ARDUINO WITH BLUETOOTH CODE:-
// Include Libraries
#include “Arduino.h”
#include “BTHC05.h”
#include “LiquidCrystal.h”
// Pin Definitions
#define BTHC05_PIN_RXD 10
#define BTHC05_PIN_TXD 11
#define LCD_PIN_RS 7
#define LCD_PIN_E 6
#define LCD_PIN_DB4 2
#define LCD_PIN_DB5 3
#define LCD_PIN_DB6 4
#define LCD_PIN_DB7 5
BTHC05 bthc05(BTHC05_PIN_RXD,BTHC05_PIN_TXD);
LiquidCrystal lcd(LCD_PIN_RS,LCD_PIN_E,LCD_PIN_DB4,LCD_PIN_DB5,LCD_PIN_DB6,LCD_PIN_DB7);
const int timeout = 10000; //define timeout of 10 sec
char menuOption = 0;
long time0;
void setup()
{
// Setup Serial which is useful for debugging
// Use the Serial Monitor to view printed messages
Serial.begin(9600);
while (!Serial) ; // wait for serial port to connect. Needed for native USB
Serial.println(“start”);
bthc05.begin(9600);
bthc05.println(“Bluetooth On….”);
// set up the LCD’s number of columns and rows
lcd.begin(16, 2);
menuOption = menu();
}
void loop()
{
if(menuOption == ‘1’) {
// HC – 05 Bluetooth Serial Module – Test Code
String bthc05Str = “”;
//Receive String from bluetooth device
if (bthc05.available())
{
//Read a complete line from bluetooth terminal
bthc05Str = bthc05.readStringUntil(‘\n’);
// Print raw data to serial monitor
Serial.print(“BT Raw Data: “);
Serial.println(bthc05Str);
}
//Send sensor data to Bluetooth device
bthc05.println(“PUT YOUR SENSOR DATA HERE”);
}
else if(menuOption == ‘2’) {
// LCD 16×2 – Test Code
// Print a message to the LCD.
lcd.setCursor(0, 0);
lcd.print(“Circuito Rocks !”);
// Turn off the display:
lcd.noDisplay();
delay(500);
// Turn on the display:
lcd.display();
delay(500);
}
if (millis() – time0 > timeout)
{
menuOption = menu();
}
}
char menu()
{
Serial.println(F(“\nWhich component would you like to test?”));
Serial.println(F(“(1) HC – 05 Bluetooth Serial Module”));
Serial.println(F(“(2) LCD 16×2”));
Serial.println(F(“(menu) send anything else or press on board reset button\n”));
while (!Serial.available());
while (Serial.available())
{
char c = Serial.read();
if (isAlphaNumeric(c))
{
if(c == ‘1’)
Serial.println(F(“Now Testing HC – 05 Bluetooth Serial Module”));
else if(c == ‘2’)
Serial.println(F(“Now Testing LCD 16×2”));
else
{
Serial.println(F(“illegal input!”));
return 0;
}
time0 = millis();
return c;
}
}
}
Download Arduino Code Here. bt arduino code

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.