Tutorial – Arduino I2C LCD

Tutorial – Arduino I2C LCD

Have you read the LCD tutorial? Too many wires? yes I know and I know that it makes difficult to make projects with an LCD. But now we have a solution!! The I2C LCD! Follow this Arduino tutorial for I2C LCD and you will learn how to use it and make your own project with it!

We will reduce the number of wires using serial communication, which is basically sending “packages” of data one after another, using only two pins of our microcontroller , pins SDA and SCL which are the analog pins A4 and A5 (for the most Arduino boards).

Schematic

Finally! how easy is it now? Not a lot of wires, just 4. That’s the best part of this module!

So… to use it connect I2C pins module as shown in the schematic. This schematic works also for Arduino nano and other boards. That’s because, as said beforem the pins SDA and SCL are the analog pins A4 and A5 for the most Arduino Boards.

  • SDA -> A4
  • SCL -> A5
  • VCC -> 5V
  • GND -> GND
I2C Schematic

Add the library

Now we need to inport the LCD-I2C library for Arduino.

Download the library from here (github link), and then had it to the Arduino IDE.

If you don’t know how to had a library, click here and follow this tutorial!

Sketch

Then we have to upload the sketch.

That’s a little example, but you can make your own!

  • Include the two libraries: Wire.h and LiquidCrystal_I2C.h
  • LiquidCrystal_I2C lcd(0x27,20,4): set the LCD address to 0x27 for a 16 chars and 2 line display
  • lcd.init(): initialize
  • lcd.setCursor(1,0): choose the position of the cursor where it starts to write
  • lcd.print(“”): write a message to print on the LCD

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4);  //set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
  lcd.init();
  lcd.backlight();
  lcd.setCursor(1,0);
  lcd.print("Hi!Follow us on");
  lcd.setCursor(1,1);
  lcd.print("gatetronics.com");
}


void loop()
{
}

Hope that you enjoyed this Arduino tutorial for I2C LCD! Follow us on Instagram and enable notification to know when we post new contents!

Davide Busco

Davide Busco is an engineering student at Federico II University of Naples. He uses his passion and studies to create his projects. He loves be a maker and spread his knowledge. Moreover he has gained the second place in a national makers-tournament between Italian's Universities.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_GBEnglish (UK)
it_ITItaliano en_GBEnglish (UK)
%d bloggers like this: