Circuit Connection:
LCD to I2C Module With Arduino:
connect the LCD to I2C Module VCC pin to Arduino 5v pin, GND pin to GND pin, SDA pin to Arduino pin A4 and SCL to Arduino pin A5
HC-05 Bluetooth Module With Arduino:
connect the HC-05 Bluetooth module VCC pin to Arduino 3.3v pin, GND pin to GND pin, TXD pin to Arduino pin 5 and RXD to Arduino pin 3
Get the Bluetooth Terminal App :
Get the Bluetooth Terminal app (App used in this project):
https://play.google.com/store/apps/details?id=com.locominder.bluetoothserialmonitor
Project Code :
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <SoftwareSerial.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
SoftwareSerial BTSerial(10,11); // RX, TX
void setup()
{
// Initialize the LCD display
lcd.init();
// Turn on the backlight
lcd.backlight();
// Set the cursor to the first column of the first row
lcd.setCursor(0, 0);
// Start the serial communication
BTSerial.begin(9600);
}
void loop()
{
// Check if there is data available on the serial port
if (BTSerial.available()) {
// Read the data and store it in a string
String input = BTSerial.readStringUntil('\n');
// Clear the LCD display
lcd.clear();
// Determine if the input string fits on the first line
if (input.length() <= 16) {
// Set the cursor to the first column of the first row
lcd.setCursor(0, 0);
// Print the input string on the LCD display
lcd.print(input);
} else {
// Print as much of the input string as will fit on the first line
lcd.setCursor(0, 0);
lcd.print(input.substring(0, 16));
// Print the remainder of the input string on the second line
lcd.setCursor(0, 1);
lcd.print(input.substring(16));
}
}
}
Conclusion :
Thank you for reading. Enjoy the project output in the video.