Interfacing HC-05 bluetooth module with arduino uno is a best way to serial communication with other Bluetooth unit. We know any data can be transmitted by serial communication through HC-05 bluetooth module. For that we have to connect HC-05 bluetooth module with arduino uno board via UART port. So before entering the project discussion if you have doubt in what is UART port? And how serial communication conducted via UART port? Then please refer my previous post that is “ Arduino serial communication “ .
Before starting the discussion of interfacing HC-05 bluetooth module with arduino uno, we should know something about HC-05 bluetooth module. So main two things we should know about HC-05 bluetooth module.
- What is HC-05 bluetooth module?
- How it work?
HC-05 bluetooth module
Lets talk about HC-05 bluetooth module. HC-05 bluetooth module is built for wireless serial communication. HC-05 bluetooth module can be used as a master and slave configuration. This serial port bluetooth module is fully qualified Bluetooth V2.0+EDR (Enhanced Data Rate) 3Mbps Modulation with complete 2.4GHz radio transceiver and base band. By default factory setting of HC-05 bluetooth module work as a slave configuration. But we can configure it in master configuration by AT command. Master module can initiate a connection to other devices. So we can use it as a wireless serial communication connection between microcontroller and GPS unit, Computer to our embedded project and lots more.
Here we can see the hardware and software specification of HC-05 bluetooth module. Those hardware and software features which is given bellow. Those are mention at datasheet of HC-05 bluetooth module.
Hardware features
- It has typical ‐80dBm sensitivity.
- Maximum RF transmit power up to +4dBm.
- It is capable to low Power 1.8V Operation, 3.3 to 5 V I/O.
- It is a PIO control device.
- Communication done by UART interface with programmable baud rate.
- It has integrated antenna.
- It has edge connector.
Software features
- It has slave default Baud rate: 9600, Data bits: 8, Stop bit: 1, Parity: No parity.
- PIO9 and PIO8 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.
- It has ability to auto‐connect to the last device on power as default.
- It permit pairing device to connect as default.
- It has ability to auto‐pairing PINCODE:”1234” as default.
- Another ability is auto‐reconnect in 30 min when disconnected as a result of beyond the range of connection.
Connection with Arduino uno
Come to the main point that is interfacing HC-05 bluetooth module with arduino uno. It can be done by UART port of arduino board. Pin numbers 0 and 1 are used for those purpose. But we should always keep in mind that it connect TX of arduino with Rx of HC-05 and RX of arduino with Tx of HC-05. So see the bellow diagram for proper connection.
Finally if we connect HC-05 bluetooth module with arduino, it look like bellow diagram.
As we know in Arduino Ide sowftware, it has a serial terminal tools. Using this terminal tools, we can see the receive data through UART port.
Now lets see the main thing of my project “Interfacing HC-05 bluetooth module with arduino uno “ is embedded C program.
// Author : Subham Dutta
// Date : 05-02-18
// Website : www.nbcafe.in
void setup()
{
// initialize both serial ports:
Serial.begin(9600);
}
void loop() {
if (Serial.available()) {
unsigned int inByte = Serial.read();
Serial.write(inByte);
}
}
In bellow see the complete project video to understand the project easily.