Project 1 - Interfacing a 16*2 LCD with Arduino using I2C protocol
Interfacing a 16*2 LCD with Arduino using I2C protocol
Overview of the Project:
In this project implementing the Code for “Interfacing a 16*2 LCD with two Arduino’s (one for Master and one for Slave) using Inter-Integrated Circuit (I2C) communication protocol” by sending the message to LCD using I2C communication protocol and display the message on LCD screen.
Goals:
- Communication between Arduino and 16*2 LCD using I2C protocol.
- Displaying the message sent by Master and received by slave i.e. LCD display.
Key Highlights of the Project:
- Using the inter-integrated circuit communication protocol, transferring the data i.e. the message we want to display is sent to the LCD.
- Two Arduino’s connected to the LCD display and the communication is executed using I2C protocol between Arduino and the LDC display.
Deliverables of this project:
- Communication between the Arduino’s and LCD using I2C.
- The message passed from master to slave and displayed on the 16*2 LCD.
Objective:
To send a meaasge from slave to master using Inter-Integrated Circuit (I2C) communication protocol in arduino and display the message on 16*2 LCD screen.
CIRCUIT:


The analog pins A4 and A5 in arduino are used for used for I2C communication. The digital pin 2 is connected to RS of LCD. Digital pin 3 connected to E of LCD. The Digital pins 4, 5, 6, 7 are connected to DB1, DB2, DB3, DB4 of LCD. Input supply 5v and Gnd are connected to the LCD from arduino. The potentiometer is used to turn ON and OFF the LCD.
CODE:
//MASTER
#include<LiquidCrystal.h>
#include<Wire.h>
LiquidCrystal lcd(2,3,4,5,6,7);
char MasterReceive[16];
void setup()
{
Serial.begin(9600);
Wire.begin();
lcd.begin(16,2);
lcd.clear();
}
void loop()
{
Wire.requestFrom(8,16);
lcd.setCursor(0,0);
lcd.print("MASTER");
lcd.setCursor(0,1);
int i=0;
while(0<Wire.available())
{
MasterReceive[i]=Wire.read();
i++;
}
lcd.print(MasterReceive);
delay(1000);
Wire.end();
}
//SLAVE
#include<LiquidCrystal.h>
#include<Wire.h>
LiquidCrystal lcd(2,3,4,5,6,7);
void setup()
{
Serial.begin(9600);
Wire.begin(8);
Wire.onRequest(send);
lcd.begin(16,2);
lcd.clear();
}
void loop()
{
lcd.setCursor(0,0);
lcd.print("SLAVE");
lcd.setCursor(0,1);
lcd.println("Message sent ");
}
void send()
{
char ch[17]="Slave Message ";
Wire.write(ch);
}
OUTPUT:

The message sent from slave is received by master and displayed in 16*2 LCD. The communication between the master and slave arduino was implemented using I2C protocol.
Expected Outcomes:
- Students will get the Knowledge of I2C communication Protocol and the Arduino.
- The Hardware connection of all components used in this project.
- Displaying the message sent by master (Arduino) and received by the slave (16*2 LCD display).