HC-05 Bluetooth module interfacing with arduino with LED control example

HC-05 Bluetooth module Interfacing with Arduino Bluetooth is a way of communication which makes the world wonder about it. Bluetooth is now provided in everything which is designed for some type of communication. It is available from smartphones to self-driving vehicles systems. It has interesting history and working system, which proves how versatile it is. It is managed by the Bluetooth Special Interest Group, which set the standards, advance the Bluetooth capabilities.HC-05 Bluetooth module interfacing with arduino with LED control example

History and Naming:

Bluetooth was invented by a telecom specialist Ericsson in1994. It is an alternate of the RS-232 cables. It created above mentioned body which is supported by Intel and takes care of development and licensing. Any company who want to use the standards or market products with the technology is required to become the member of above committee. The Promoter members are:

  • Ericsson
  • Intel
  • Microsoft
  • Nokia
  • Lenovo
  • Toshiba
  • Motorola

How the name Bluetooth came to being? Ericsson, the company that started Bluetooth is from Sweden, which is part of the Scandinavian region, a historical and cultural-linguistic part of Europe. The name comes from an epithet of a tenth-century King of Denmark and Norway named Harald “Bluetooth” Gormsson. In the local language, he was called Blåtand or Blåtann, which translated in English, became ‘Bluetooth’. He was known for uniting the Vikings in ages past, from which the idea of the communication standard came, something that was a single unifying standard for mobile technologies. The logo, in fact, is a combination of two Nordic runes called ‘Hagall’ and ‘Bjarkan’, which were the initials of King Harald “Bluetooth” Gormsson.

How Does Bluetooth Work?

Bluetooth operates in the standard Industrial, Scientific and Medical (ISM) short range frequency band of 2.4 GHz. Specifically, it operated in the 2400–2483.5 MHz frequency band, which includes guard bands as well. It uses something called Frequency Hopping Spread Spectrum (FHSS), which is basically a multiple access method in which data packets are divided based on frequency over 79 designated Bluetooth channels. Each channel has a bandwidth of 1 MHz. The newer Bluetooth 4.0 standard, however, uses 2 MHz steps and thus has 40 designated channels. It uses a variation of FHSS called Adaptive Frequency-hopping spread spectrum (AFH), which theoretically skips channels with interference and results in better communication.

Bluetooth is essentially a protocol with a master-slave architecture, which means that one master device can communicate with up to 7 devices. This was and is a huge advantage to earlier wired communication protocols which could work only with a 1 to 1 configuration. Essentially creating a new standard called Personal Area Networks (PANs), Bluetooth brought about far more effective ad-hoc networks and allows communication without traditional host based networking.

Pin Configuration of HC-05 Bluetooth module 

There are 6 pins available at the output of module. Facing back side, from left to right these are as follows:

  1. EN Used for AT commands. In normal usage it is not required to be connected.
  2. VCC Power supply +5V
  3. GND Power supply ground
  4. TxD Transmitting pin
  5. RxD Receiving Pin
  6. STATE Gives digital output shoeing status whether module is connected or not.

Circuit Diagram of HC-05 Bluetooth module interfacing with arduino 

Connect the circuit as follows:HC-05 Bluetooth module interfacing with arduino

  • Bluetooth Tx with                             Arduino UNO Rx (D0)
  • Bluetooth Rx with                             Arduino UNO Tx (D1)
  • Bluetooth VCC with                             Arduino UNO +5V
  • Bluetooth GND with                             Arduino UNO GND
  • No need to connect any other pin as given in figure.

NOTE: Make shore you plug out the Tx and Rx pins out of Arduino before uploading the program. After uploading the program connect them back. Otherwise you can get an error.

Video lecture

Code for HC-05 Bluetooth module interfacing with arduino 

int LED = 13; //led pin

int info = 0;//variable for the information comming from the bluetooth module

int state = 0;//simple variable for displaying the state

int checking = 8;

void setup() {

Serial.begin(9600); //making serial connection

pinMode(LED, OUTPUT);    //defining LED pin

digitalWrite(LED, LOW);  //once the programm starts, it's going to turn of the led, as it can be missleading.
  pinMode(checking, OUTPUT);


void loop() {

  int sta = digitalRead(checking);


  if(Serial.available() > 0){  //if there is any information comming from the serial lines...

    info = Serial.read();  

    state = 0;   //...than store it into the "info" variable


  if(info == '1'){                //if it gets the number 1(stored in the info variable...

    digitalWrite(LED, HIGH);    //it's gonna turn the led on(the on board one)

    if(state == 0){              //if the flag is 0, than display that the LED is on and than set that value to 1

      Serial.println("LED ON");  //^^that will prevent the arduino sending words LED ON all the time, only when you change the state

      state = 1;



  else if(info == '0'){

    digitalWrite(LED, LOW);      //else, it's going to turn it off

    if(state == 0){

      Serial.println("LED OFF");//display that the LED is off

      state = 1;




Android App:

  • Download the “Arduino Bluetooth Controller” App from android playstore on your android phone.
  • Open the app and connect with HC-05 Bluetooth.
  • Select Terminal mode.
  • Send 1 to turn on the LED.
  • Send 0 to turn off the LED.

Leave a Comment