Menu Close

Arduino – Controlling LCD using BT Module HC-05

This tutorial of Robo India explains how to control display of LCD using Bluetooth module HC-05.

1. Introduction:

In this tutorial, we will conduct a communication through a Bluetooth module HC-05, between Arduino and a smart phone and show the messages that are sent from the phone in a 16X2 LCD, connected to the Arduino.

2. Hardware required

S.No.ItemQuantity
1Arduino 1
2Breadboard 1
3i2c LCD Backpack 1
4BT Module HC-05 1
5Male to Female Jumper Wires 8
6Male to Male Jumper Wires 2

 3. Building Circuit

4. Programming:

Once the circuit part is done, Arduino is needed to be programmed.

You may download this code (Arduino Sketch) from here

//Robo India tutorial on LCD Display Control
//Hardware Required: LCD, HC-05 & Arduino
//Bluetooth Application (By RoboIndia)
//https://www.roboindia.com/tutorials 

#include <Wire.h>  
#include <LiquidCrystal_I2C.h>
#include <SoftwareSerial.h>
#include <stdio.h>
#include <ctype.h>

SoftwareSerial Bluetooth(5,6);      // (TXD, RXD) of HC-05
LiquidCrystal_I2C lcd(0x3F,20, 4);  // SET I2C Address
char BT_input;
int n = 0;
char text;

void setup() 
{
  lcd.init();
  lcd.backlight(); // makes Backligh ON. 
  lcd.clear();     // Clears LCD
  lcd.home();      // Sets cursor at Column 0 and Line 0
  lcd.print("ROBO INDIA");  
  Bluetooth.begin(9600);
  Serial.begin(9600);
}


void loop()  
{
  if (Bluetooth.available())
  {
    BT_input=(Bluetooth.read());
    Serial.write(BT_input);
      if(BT_input == '@')
      {
        lcd.clear(); 
        lcd.home();
        lcd.print("ROBO INDIA");
        n=0;
      }
    if (isalpha(BT_input) != 0 || isdigit(BT_input) !=0 || BT_input == ' ')
      {
        text = BT_input;
        lcd.setCursor(n,1);
        lcd.print(text);
        Serial.print(text);
          if(n<15)
          {
            n++;
          } 
          else 
          {
            n = 0;
            lcd.clear();
            lcd.home();
            lcd.print("ROBO INDIA");
          }
      }
  }
}


5. Mobile app

You may download the LCD Display control App on Playstore from here.

1. Download this Application.

2. Pair your phone with HC-05. for doing this go to Settings->Bluetooth->Scan device->select HC-06 and pair it. Pass code to pair is ‘1234’.

3. Now, open the app and connect the HC-05 module by clicking on the Connect button. Here is the screen shot of phone with this application.

If you send any text, Arduino will display this text on connected 16X2 LCD.

6. Troubleshooting:

If LCD displays nothing, try adjusting contrast by rotating preset.

Still not working: Download the I2C Scanner Library File from here.

or check Robo India tutorial on I2C LCD with Arduino: https://www.roboindia.com/tutorials/i2c-lcd-arduino

If you have any query please write us at support@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
https://roboindia.com

1 Comment

Leave a Reply