I2C LCD 16X2 Interfacing with Arduino

Hello and Welcome to Alpha Electronz.!We provide Tutorials (Post + Videos) about Projects based on Arduino, Raspberry Pi, etc.

In this Tutorial we are going to Interface I2C LCD 16X2 Module with Arduino Uno and display our Name on LCD.

Before starting we should first Understand what I2C is?

I2C Communication Protocol

I2C combines the best features of SPI and UARTs. With I2C, you can connect multiple slaves to a single master (like SPI) and you can have multiple masters controlling single, or multiple slaves. This is really useful when you want to have more than one microcontroller logging data to a single memory card or displaying text to a single LCD.

Like UART communication, I2C only uses two wires to transmit data between devices:

Introduction-to-I2C-Single-Master-Single-Slave

SDA (Serial Data) – The line for the master and slave to send and receive data.

SCL (Serial Clock) – The line that carries the clock signal.

I2C is a serial communication protocol, so data is transferred bit by bit along a single wire (the SDA line).

For more detailed information on I2C Click Here

Components Required for this tutorial :

Circuit Diagram

Arduino I2C LCD Circuit Diagram
Arduino I2C LCD Circuit Diagram

The Connections are as Follows:

GND –> GND

VCC —> 5V

SDA —> A4

SCL —> A5

Code

/*
   Arduino I2C LCD 16X2 Tutorial.
   Created By - Alpha Electronz
   Date Created - 13-01-2020
   For more information - /arduino-i2c-lcd/
*/
#include <LiquidCrystal_I2C.h>
//I2C pins declaration
LiquidCrystal_I2C lcd(0x27, 16,2);
void setup()
{

  lcd.begin(); //Defining 16 columns and 2 rows of lcd display
  lcd.backlight();//To Power ON the back light
  //lcd.backlight();// To Power OFF the back light
}
void loop()
{
  //Write your code
  lcd.setCursor(0, 0); //Defining positon to write from first row,first column .
  lcd.print(" Alpha Electronz "); //You can write 16 Characters per line .
  delay(1000);//Delay used to give a dynamic effect
  lcd.setCursor(0, 1); //Defining positon to write from second row,first column .
  lcd.print("Like | Share");
  delay(8000);

  lcd.clear();//Clean the screen
  lcd.setCursor(0, 0);
  lcd.print(" SUBSCRIBE ");
  lcd.setCursor(0, 1);
  lcd.print(" Alpha Electronz ");
  delay(8000);
}

Hope you like the Tutorial.

If you have any doubts feel free to ask in the comment section.
 
0

Leave a Reply

Your e-mail address will not be published. Required fields are marked *