Tag Archive: Bluetooth HC05

The Bluetooth module HC-05 is a MASTER/SLAVE module.The Role of the module (Master or Slave) can be configured only by AT COMMANDS.

By default the factory setting is SLAVE.

This post walks you through the AT commands of Bluetooth module .Through AT Commands you can change the ROLE of the module. Name,Password of the Module can be changed .The list of AT commands can be downloaded HERE 

Remember the models HC-04 or HC-06 are SLAVE only modules .HC-05 is the module of interest in this post.To identify the model you can see the pin count.If the module has 5 or 6 pins it is HC-05.If the module has only 4 pins then it is HC-04 or HC-06.

The firmware for HC04 is LINVOR & for the HC05 it is HC05 itself.If you scan for bluetooth devices from your Android phone you can see this name.

The extra pins in HC-05 are the KEY & STATE pins.The KEY pin is used to enter the Command mode.


     hc-05_2                         hc-04

HC05 Pin count is 6    MASTER/SLAVE             HC-04 Pins 4  SLAVE ONLY

The slave modules can not initiate a connection to another Bluetooth device, but can accept connections.Master  module can initiate a connection to other devices. Be sure not to make the mistake of buying 2 slaves (HC-04) .

To enter the Command mode you can either use an USB TO TTL Module or your Arduino UNO board.

usb-ttl     OR     arduino

       USB TO TTL DEVICE                            ARDUINO UNO

First let me explain how to use the Arduino board for the configuration.We need to use the USB – UART portion of the Arduino board bypassing the bootloader function of ATMEGA328.For this connect the Arduino to PC & just upload an empty sketch


void setup()



void loop()




Connect    Rx (pin 0) of Arduino to  Rx of Bluetooth module.

                 Tx (pin1) of Arduino to Tx of Bluetooth module.

Yes,I’m correct.The connection is one to one while using Arduino as USB-UART board.It is not the other way (Tx  to Rx while using USB-TTL board).

Before connecting the power to HC05 module  you should know that there are there are two ways of activating command mode on these devices.

One is to hold pin 34 high (KEY) as the device is powered on and it should enter command mode at 38400,8,N,1

The other is to hold pin 34 low then set it high after the module has been powered on and it will enter command mode at the pre-programmed speed (default is 9600,8,N,1).

Let us complete all the connections and finally provide power to the module.

  HC-05      ARDUINO

           Tx –—>  Tx (1)

           Rx –—>  Rx (0)

           Vcc ––> 5v 

           GND –-–> GND,

           KEY –—> 3.3V

   Now provide the power to the module by connecting USB cable to Arduino

The Status LED starts blinking slowly (once per 2 secs).This indicates that the module has entered the command mode at the BAUD RATE 38400.

You can use the SERIAL Monitor of the Arduino to feed AT commands.

At the bottom of the SERIAL monitor ensure that you select  “BOTH NL & CR” .This will feed /r/n   after each command.Generally while using Arduino ,the println() statement), appends both carriage return and newline .(In case of PIC or 8051  you should add terminator ( “0x0d 0x0a”) to the program.)

HC 05 module needs a CARRIAGE RETURN & LINE FEED after each command .

Now open the Serial monitor of Arduino with settings BOTH NL & CR , Baud Rate 38400

Type in AT  & click on Send.

You should get a OK response from the module.



The default ROLE of HC-05 is SLAVE .To change this to MASTER type in


The module responds with OK.

To confirm , type in AT+ROLE ?

The module will reply the status as ROLE 1.

You can also use a Terminal software like TERATERM to feed the AT Commands.

Close the Serial monitor of Arduino & then start the TERATERM terminal.

Select Serial at the start up window of TERATERM.

Under SETUP –> Terminal  select CR+LF of Transmit & tick mark the LOCAL ECHO (to see what you type)



Under SETUP –> SERIAL PORT select the BAUDRATE 38400 , 8N1


Now you are ready to feed the AT commands.


To query a condition like Name, Password ,etc. you need to use a question mark after the command.

To change the condition use the equal to mark = after the command.

For e.g to query about password you type in  AT+PSWD? 

To change the password you type in AT+PSWD=1234

In the next post we shall see how to pair 2 nos. HC-05 modules so that it can replace the physical Serial connection.This can be an alternative to ZIGBEE , but with less range and more data speed (2Mbps).


The easiest & economical way to go wireless in an Embedded project is through a Bluetooth module.Your Serial communication goes Wireless using this module.

The types available in the market are HC-04 , HC 05 &  HC06 .The HC 05 is a Master/Slave module & the other two models are Slave only models.The Slave only models need a Master like Android phone to get paired.

HC05 model can be configured either for a Master or for a Slave mode , thus most preferred for a Microcontroller project.

The HC-05 module can build a connection to other modules, while HC04/HC-06 modules can be a slave only.Two Slave modules  cannot communicate with each other themselves.

HC04 is factory loaded with LINVOR firmware.If you power up the module and scan for Bluetooth devices using your Android phone , you can see the name LINVOR on the phone.If the module is HC05 , you see the name HC05 on the phone.

The square wave like design on the top of module acts as antenna &  the range is about 30 feet.

The specifications of different models of Bluetooth module is on this Wiki page :



Above is the picture of a raw HC05 Bluetooth module .The module operates on 3.3 V DC power & the acceptable TX/RX signal level  is 3.3v & not 5v. The KEY pin (pin 34) on a HC05 module plays an important role in entering AT mode of the module.

I suggest to buy a module on a breakout board and available as JY-MCU modules.The Bluetooth module is mounted on a breakout board and connections provided using header pins.You can safely provide 5v power to this board, as it has an inbuilt 3.3v regulator.Also the board has Status LEDs for visual indication of status of module.


The module is covered with a plastic transparent sleeve.If you need to access all the pins , cut this sleeve out.Mostly the header pin connections extended is enough for connection to a microcontroller.

To connect this module to a Laptop  an USB to TTL converter board built on Prolific’s 2303 IC is required.

This is an inexpensive module with USB at front & header pins for connections.When connected to PC you need to install the driver for Prolific 2303.


DSC00002     DSC00003

The connections between HC05 module & the USB converter are simple as below :


VCC       ——>         5.0V

GND       ——>        GND

TXD       ——>         RXD

RXD     ——>          TXD

Now plug the USB connector to a port on your PC.The power LED on USB board glows & the Status LED on Bluetooth board starts blinking fast , indicating that it looks for a pair.

From your Android phone , go to Settings , switch ON the Bluetooth & under properties Scan for available Devices.

The Bluetooth module will show up as HC-05 under Available Devices.


Touch on the HC-05 & feed the PIN password as 1234.


Touch OK to see the HC-05 under paired Devices.


To communicate with PC you need Terminal software on Android phone as well as on the PC.

From Android’s Market search for “BLUETOOTH TERMINAL”. Select the one with Bluetooth symbol  and install it.


Open the installed Bluetooth terminal.On the top you can see a Connect button & to its left bottom a small drop down arrow is seen.Touch that drop down to see the available devices.

Touch on the HC-05 & then Connect


Now the fast blinking of LED on HC05 SLOWS DOWN TO ONE BLINK per second indicating that it has been paired with a Master ( Android phone).

Now we’ve to install a Terminal software  like Putty or CoolTerm on your PC.

PuTty download link : http://the.earth.li/~sgtatham/putty/latest/x86/putty.zip

Open Putty & under Session select Serial.Enter the COM port allotted to the USB-TTL board (here it is COM 10).This can be noted down from the Device Manager’s COM port allocation.

Enter the Speed as 9600 which is the Baud Rate of communication.


Under Terminal Settings ensure that Local Echo – Force ON is selected.This enables you to see what you type on Putty screen.

Click on Open to see the Terminal window for communication.


If the connection is lost Touch Connect again on the phone.


Type in some characters on the Phone & touch SEND.

You can receive the characters on the Putty screen.


Same way type in some characters inside Putty screen to see them received on the phone.Thus a 2 way communication is established.


You can also test a Loopback method.

Connect the Tx & Rx of Bluetooth module together .For this test PC 7 USB board are not required.Just you need to provide 5v power to module & loop the Tx/Rx.

Now the characters sent will be received back.


Watch this support video :