I2C LCD Controller (the Easy Way)





Introduction: I2C LCD Controller (the Easy Way)

I am working on an alarm/weather station project and I wanted to use an LCD but dint want to have a lot of wires so I order a controller. This is just a very basic tutorial on how to hook it up, for the beginners like my self.

Step 1: Parts

Parts list:




1. LCD in this case a 16x02


1. I2C 1602 LCD Controller ($1.99 on ebay free shipping)


4. Jumper wires


1. Arduino ( I have a mega)    


Step 2: Soldering

Now we solder the LCD and the controller. make sure you have the correct pin arrangement. Mine doesn't have a mark for pin one, but I just looked at the 5+ and GND inputs to figure it out.

Step 3: Connecting

it is very simple to connect only 4 wire 5+ and GND and  SDA goes to Arduino pin 20 and SCL to pin 21 on my arduino mega. depending on what you have it might be different.

Step 4: The Code

Since the seller doesn't provide any info I neede to find the address for the module so I ran an I2C scanner
 //Written by Nick Gammon
// Date: 20th April 2011

#include <Wire.h>

void setup() {
  Serial.begin (115200);

  // Leonardo: wait for serial port to connect
  while (!Serial)

  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
  for (byte i = 1; i < 120; i++)
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() {}

Step 5: The Code Part II

the code is very simple..................................but you are going to need F Malpartida's   LCD LIB https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads Once again very basic very simple.                                                                                                                                                                                                                            
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>  // F Malpartida's NewLiquidCrystal library

#define I2C_ADDR    0x20  // Define I2C Address for controller
#define BACKLIGHT_PIN  7
#define En_pin  4
#define Rw_pin  5
#define Rs_pin  6
#define D4_pin  0
#define D5_pin  1
#define D6_pin  2
#define D7_pin  3

#define  LED_OFF  0
#define  LED_ON  1
LiquidCrystal_I2C  lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup() 
  lcd.begin (16,2);  // initialize the lcd
// Switch on the backlight

void loop()  

// Reset the display 
// Print on the LCD
  lcd.print("Hello, world!");

8 People Made This Project!


  • Epilog Challenge 9

    Epilog Challenge 9
  • Paper Contest 2018

    Paper Contest 2018
  • Science of Cooking

    Science of Cooking

We have a be nice policy.
Please be positive and constructive.



Hello. I am trying to see if my LCD works and after I use this code I can not see any information. Which can be the root cause? I mention that my compiling and uploading works without errors. Thank you!


guyss pleasee help me for this. it wont work

Arduino: 1.8.5 (Windows 7), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Users\admin\Desktop\LCD\LCD.ino:1:17: fatal error: LCD.h: No such file or directory

#include <LCD.h>


compilation terminated.

exit status 1

Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with

"Show verbose output during compilation"

option enabled in File -> Preferences.

Not Working out for me and my Arduino Pro Mini... HELP. Cannot find LCD Address

Does it work with 1604 as well?

why using port 0 thru 6, when using the I2C interface???

Salve ma come devo fare se alla fine della scritta si accenda i led???? non ci riesco...

The code to search I2C address is awesome...Very Helpfull!


were can you find the LCD.H Library

You need to install this library