HC-05 Bluetooth


The HC-05 Bluetooth Module [Product link] can be used in a Master or Slave configuration, making it a great solution for wireless communication.You can use it simply for a serial port replacement to establish connection between MCU and GPS, PC to your embedded project, etc.


HC-05 Bluetooth Module
HC-05 Bluetooth Module
  • Protocol: Bluetooth Specification v2.0+EDR
  • Frequency: 2.4GHz ISM band
  • Modulation: GFSK
  • Emission power: ≤4dBm, Class 2
  • Sensitivity: ≤-84dBm at 0.1% BER
  • Speed: Asynchronous: 2.1Mbps(Max) / 160 kbps, Synchronous: 1Mbps/1Mbps
  • Security: Authentication and encryption
  • Profiles: Bluetooth serial port
  • Power supply: +3.3VDC 50mA
  • Working temperature: -20 ~ +75 Centigrade


The HC-05 Bluetooth Module has 6 pins- Vcc, GND, TX, RX, Key, and LED. It comes pre-programmed as a slave, so there is no need to connect the Key pin, unless you need it change it to Master Mode.

The major difference between Master and Slave modes is that, in Slave mode the Bluetooth module cannot initiate a connection, it can however accept incoming connections. After the connection is established the Bluetooth module can transmit and receive data regardless of the mode it is running in. If you are using a phone to connect to the Bluetooth module, you can simply use it in the Slave mode. The default data transmission rate is 9600kbps.

The range for Bluetooth communication is usually 30m or less. The module has a factory set pin of “1234” which is used while pairing the module to a phone.

HC-05 (Bottom View)
HC-05 (Bottom View)

Pin Connections

Arduino GND 3.3V/5V RX/SoftRx TX/SoftTx Pin 9 Not Connected


You will need to install a Bluetooth Terminal App on your phone to establish a connection to the HC-05 Bluetooth module and transmit/receive data from it. Works best with Android phones.

This code is written by Lakshay Chutani and Jasmeet Singh for Wiki.JMoon.co
In this code, sending 1 or 0 from the Phone to the HC-05, turns the LED ON or OFF.

#include <SoftwareSerial.h>
char ch; // Character to be received/transmitted via the SoftRx/SoftTx pins

SoftwareSerial mySerial(10, 11);
/* 10- SoftRx, 11-SoftTx
Any 2 digital pins can act as the SoftRx and SoftTx pins.
If Serial Monitor is not used, the RX and TX pins of the Arduino board can be used directly without need for SoftwareSerial library.
In such a case, instead of using 'mySerial', the 'Serial' command can be used directly.
Note- When uploading the code to the Arduino board, the Bluetooth module's TX and RX
must not be connected to the RX and TX of the Arduino board.*/

void setup(){
Serial.begin(9600); // Establish Serial connection between PC and Arduino
mySerial.begin(9600); // Establish Serial connection between HC-05 and Phone
pinMode(13,OUTPUT); // LED pin on the Arduino Uno

void loop(){
if (mySerial.available()){ // If the bluetooth module has some incoming data from the phone
ch=mySerial.read(); // Read the data, one character at a time
if(ch=='1') // 1 received
digitalWrite(13,HIGH); // Turn LED ON
else if(ch=='0') // 0 received
digitalWrite(13,LOW); // Turn LED OFF
Serial.write(ch); // Write char received via Bluetooth to the Serial Monitor of Arduino IDE


Bluetooth Terminal Apps for Android [Link1] [Link2] [Link3]

Possible Application Areas

1. Remote Controlled Robot Car [Link]


So empty here ... leave a comment!

Leave a Reply

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