Menu Close

Arduino – 16X2 LCD

This tutorial is to explain how to use a 16×2 character LCD on Arduino board. Tutorial is explained through circuits and sketches. This tutorial is based upon LiquidCrystal Library of Arduino.

1. Introduction:

This tutorial is for 16×2 character LCD (Hitachi HD44780 driver based.) This tutorial uses original LiquidCrystal Library.

Here is Arduino’s official reference for this header.

1.2 Pinout of 16×2 LCD.

2. Required Hardware

Following Hardware will be required to perform this LED fade in and fade out circuit.

S.No.ItemQuantity
1.R-Board with FTDI or Arduino Board1
2.Bread Board1
3.Male to male Jumpers 20
4.16×2 LCD1
51K Potentiometer1
6.LCD Board – (LCD Base)It is optional. If you have this you
will not require breadboard and potentiometer.
1

3. Building Circuit

To run these practical examples make following circuit with the help of above mentioned components.

3.1 You may go with Robo India’s R-Board(UNO Compatible)-

or

here is the schematic:

3.2 You may go with original Arduino UNO Board-

here is the schematic:

4. Programming:

Once we are done with circuit part, here is our programme to this circuit. All of the commands are explained in the comment section. Output video is attached at the last of this tutorial, This example will be clear after watching the video.

Following diagram will help you to understand declaration of LCD on Arduino.

You may download codes (Arduino Sketch) from here.

This sketch explains various important commands of LCD library. It prints, clears, set cursor location and prints variable. After uploading this code if you find that nothing is being printed on LCD, do check the contrast level of LCD by potentiometer provided in circuit.

/*
16X2 LCD Tutorial by ROBO INDIA
http://roboindia.com/
*/

#include <LiquidCrystal.h> //includes LCD library.


LiquidCrystal MyLCD(12, 11, 5, 4, 3, 2); // Definining LCD.
int counterVal = 0;  // Variable for counter.

void setup() {
   MyLCD.begin(16, 2); // Initializing 16X2 LCD.
   MyLCD.home(); // Home location : 0,0 
   MyLCD.print("Robo India"); // Print on LCD.
   MyLCD.setCursor(0, 1);
   MyLCD.print("16x2LCD Tutorial");
   delay(2000);
  
}

void loop() {
  MyLCD.clear();  // Clearing LCD
  MyLCD.home();   // Cursor set to 0,0
  MyLCD.print("Counter");
  MyLCD.setCursor(0,1);     // Setting cursor 2nd row first column
  MyLCD.print(counterVal);  // Printing counter value.
  counterVal++;             // Increment in counter value.
  delay(1000);              // delay of 1 second.  
}


5. output:

Here is the output of this tutorial. Above code is implemented on Robo India R-Board and Arduino UNO Both.

6. Utility of Robo India LCD Breakout board-

The following image is taken of LCD in action on Breadboard-

And the image below is LCD in Action with Robo India LCD Breakout Board-

So we can clearly see with Robo India LCD board, lesser wires and ease of use. 

If you have any query please write us at info@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
http://roboindia.com

2 Comments

Leave a Reply