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
S.No. | Item | Quantity |
1 | Arduino UNO | 1 |
2 | Breadboard | 1 |
3 | Male to Male Jumper wire | 16 |
4 | 16×2 LCD | 1 |
5 | Preset 10K | 1 |
3. Building Circuit
Schematic of circuit
Layout of circuit
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 suppport@roboindia.com
Thanks and Regards
Content Development Team
Robo India
https://roboindia.com