Arduino 16×2 LCD Tutorial: Interfacing LCD with Arduino Hello World

As you know, LCDs are widely used in projects and various products in order to display the processes and output values. Furthermore we have decided to publish many arduino lcd projects in the upcoming weeks. So it’s a prerequisite to have a good knowledge on interfacing LCD with arduino before we move on further.

We have already published a detailed post on LCD interfacing with PIC microcontroller long time ago when we were discussing about basics of PIC microcontroller. You may refer that for a deeper understanding of 2×16 LCD display including the various pins involved.

Arduino hello world

In contrast to many other microcontroller platforms, Arduino LCD control is very simple as it has many inbuilt library functions. You only need to initialize the pins for connecting LCD display to arduino and define the LCD type- number of columns and rows.

Circuit Schematic

Interfacing LCD with Arduino

Interfacing LCD with Arduino

Components Required

  1. Arduino Board
  2. LCD
  3. Resistor 1K


  • LCD can be used in two modes- 4 bit mode or 8 bit mode. In 8 bit mode we require 8 data pins and 3 control pins whereas in 4 bit mode, data is sent using 4 data pins and 3 control pins.
  • R/W pin is always grounded so we require only 6 pins in 4 bit mode, thus saving no of pins.
  • First initialize the library and then define pins using the command LiquidCrystal lcd(RS, E, D4, D5, D6, D7), pins are assigned in this order.
  • LiquidCrystal lcd(12, 11, 5, 4, 3, 2), here RS pin to 12, Enable pin to 11, D4 pin to 5, D5 pin to 4, D6 pin to 3 and D7 pin to 2 respectively.
  • Then in setup function write the message to display as lcd.print(“message”).
  • We can print message anywhere in the LCD by selecting column and row, it’s done by writing lcd.setCursor(column, row). However there is one thing to consider, that’s the number of columns and rows start from zero. For example, to print a message on 2nd row 1st column, write “lcd.setCursor(0,1);” before the print command. Similarly for 5th column and 3rd row, we write lcd.setCursor(4,2).
  • You can use “lcd.write()” to send characters. To print zero on 2nd colum 2nd row, type lcd.setCursor(1,1); lcd.write(48); where 48 is the decimal equivalent for ACII ‘0’.

Interfacing LCD with Arduino programming

Let’s summarize our program into the following steps.
Step1: Initialize the library for LCD.
Step2: Define LCD columns and rows in setup function.
Step3: Write the data to display.
Step4: If you want to display variables on LCD, write it in loop function. Loop function is a must for all arduino sketches.

[cc lang=”c”]


// initialize pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
// Define LCD’s number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print(“hello, world!”);
lcd.print(“i-St@r “);

void loop()


After all, I hope you realized how things are getting easier with arduino. Stay tuned as further projects are on their way.

3 thoughts on “Arduino 16×2 LCD Tutorial: Interfacing LCD with Arduino Hello World

  1. Pingback: Arduino 16×2 LCD Tutorial: Interfacing LCD with Arduino Hello WorldDiagramRef | DiagramRef

  2. HAI SIR,

    Will lcd damage due to wrong lcd doesn’t show any thing.only back light is shining.please reply as soon as possible.

Leave a Reply

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