Arduino Tutorial – LCD

Arduino Tutorial – LCD

In this Tutorial we will learn how to use an LCD (Liquid Crystal Display) module with an Arduino board. We will use a lot of LCDs in our projects! This module is very useful and simple to use. Read this tutorial and you will know how to use LCDs in your projects!


In this section of the Tutorial we will learn how to connect an LCD to an Arduino Board.

We will not use all the LCDs pins, connect the LCD as in picture.

Arduino LCD schematic

As you can see we also have to use a potentiometer. We use it to change the contrast on the LCD.


Here we will learn how to write a sketch for using the LCD with Arduino.

First of all we need to add the Liquid Crystal Library. We can do that in this way: Sketch > Include Library > Liquid Crystal (follow the tutorial: How To add a Library to Arduino IDE).

The second step is to include the library to the sketch:

#include <LiquidCrystal.h>

Then we have to create an lcd object.

const int rs = 1, en = 2, d4 = 4, d5 = 5, d6 = 6, d7 = 7;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

We initialize the lcd object with the values of the Arduino Digital pins.

Then in the setup we have to initialize the interface to the LCD and specify the dimensions of the display using the begin() function.

Moreover there are other useful functions:

  • Using the print() function we print something on the LCD.
  • The setCursor() function: set the position at which the text have to be displayed on the LCD.
  • The blink() functiondisplay a blinking cursor and the noBlink() function for turning it off.
  • The cursor() function is used for displaying underscore cursor and the noCursor() function for turning off.
  • Using the clear() function we can clear the LCD screen.

Here is the code:

#include <LiquidCrystal.h> 

const int rs = 1, en = 2, d4 = 4, d5 = 5, d6 = 6, d7 = 7;

LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup()
void loop() 
 lcd.print("Arduino"); // Prints "Arduino" on the LCD 
 delay(3000); // 3 seconds delay 
 lcd.setCursor(2,1); // Sets the location at which subsequent text written 
                     //  to the LCD will be displayed 
 lcd.print("LCD Tutorial"); 
 lcd.clear(); // Clears the display 
 lcd.blink(); //Displays the blinking LCD cursor 
 lcd.noBlink(); // Turns off the blinking LCD cursor 
 lcd.cursor(); // Displays an underscore (line) at the position to which the 
               // next character will be written 
 lcd.noCursor(); // Hides the LCD cursor 
 lcd.clear(); // Clears the LCD screen 

Now you can use LCDs in your Arduino Projects!!

Leave comments and don’t forgot to follow us on Instagram to know when we post a new article!

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: