top of page
Writer's picturejugaad club

Session 5 : LCD Display

Updated: Jun 5, 2021



An LCD (Liquid Crystal Display) screen is an electronic display module and has a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. The 16 x 2 intelligent alphanumeric dot matrix display is capable of displaying 224 different characters and symbols. This LCD has two registers, namely, Command and Data.

Command registers stores various commands given to the display. Data register stores data to be displayed. The process of controlling the display involves putting the data that form the image of what you want to display into the data registers, then putting instructions in the instruction register. In your Arduino project Liquid crystal library simplifies this for you so you don't need to know the low-level instructions. Contrast of the display can be adjusted by adjusting the potentiometer to be connected across VEE pin.


Types of Lcd Display/16x2 Display Equivalents:


1. TFT LCD display


With the TFT display you can display colorful images or graphics. This module has a resolution of 480 x 320. This module includes the SD card socket and SPI FLASH circuit.



2. TFT LCD touchscreen display


This module is similar to the TFT LCD display, but it has touchscreen.




3. Dot matrix


The dot matrix has 64 leds, 8×8. You can control each led individually to display letters, numbers, figures, etc.You can attach several dot matrices, to have a bigger area.


4.White OLED display

This is a tiny display with just 1 x 0.96 Inch. This display has a black background, and displays characters in white. There are other similar displays that can show the characters in other colors.



5. 16×2 character LCD display


This usually the first display most people use when they first start using the Arduino board.

It displays 16 characters in 2 rows (there are also other sizes available). These displays come with a blue or green background and with a backlight.




6. 5110 LCD display


These are the kind of displays used in old Nokia cell phones.

The background is grey and the characters or pictures are displayed in darker grey. They are very cheap and easy to use.



7. 4 Bits Digital Tube LED display


This display allows you to display 4 digits with seven segments. It’s useful to display data from a temperature sensor, for example.




16×2 Liquid Crystal Display Constructions


In the LCD the registers are used to store the data and commands. The command registers store the data of different functions that can be performed on the screen. The Data registers help to store the data and then pass it to the controller. The Data and command registers are only able to store the operation of basic light control. The liquid crystals are placed between the two glass sheets on the screen. The two sheets are also placed between these sheets. The sheets are used to stop the light.




Working Principal


The basic principle in LCD is by the passing of light from one layer (sheet) to another layer with the use of modules. The modules vibrate and align their position at 90 degrees, which allows the polarized sheet to pass the light through it. The molecules are responsible for showing the data on each pixel. Each pixel uses the light-absorbing method to show the digit. To show the value, molecules need to change their position to change the angle of light. So this deflection of light will make the human eye see the light of the remaining part which will make the dark part as a value and digits on the grid pixels. Thedata, we can see, will be the part where the light gets absorbed. The data will pass towards the molecules and will be there until they are changed.


The LCD consists of Data, Command and control registers. All the register helps to control the different kinds of functions on the LCD. The data and command registers take the input from digital pins D0-D7. Then controls pins help to differentiate between command/data registers. The LCD is made up of liquid crystals and the below image represents the two ICs which makes it control the LCD with the external devices.



To control the LCD there are two kinds of methods. The first method is by understanding the internal registers operating method and then use it. Therefore, the second method is easy and simple. in this method, the only Library needs to use. Due to the wide usage of LCD in almost every field, All the boards and microcontrollers have LCD libraries. In both cases, the control method and circuits will different.



CONNECTING THE LCD TO THE ARDUINO


The LCD has 16 connection pins, numbered 1-16 from left to right.



The Pinout of Standard LED





The parallel interface consists of the following pins:

  • Power Supply pins (Vss/Vcc): Power the LCD

  • Contrast pin (Vo): Control the display contrast

  • Register Select (RS) pin: Controls where in the LCD's memory you're writing data to

  • Read/Write (R/W): Selects reading mode or writing mode

  • Enable pin: Enables writing to the registers

  • 8 data pins (D0 -D7): The states of these pins (high or low) are the bits that you're writing to a register when you write, or the values you're reading when you read.

  • Backlight (Bklt+ and BKlt-) pins: Turn on/off the LED backlight


16×2 LCD interfacing with Arduino, Circuit Diagram:




PROGRAMMING THE ARDUINO:


All of the code below uses the LiquidCrystal library that comes pre-installed with the Arduino IDE. A library is a set of functions that can be easily added to a program in an abbreviated format.

In order to use a library, it needs be included in the program. Line 1 in the code below does this with the command #include <LiquidCrystal.h>. When you include a library in a program, all of the code in the library gets uploaded to the Arduino along with the code for your program.

Now we’re ready to get into the programming! I’ll go over more interesting things you can do in a moment, but for now lets just run a simple test program. This program will print “hello, world!” to the screen. Enter this code into the Arduino IDE and upload it to the board:

//include the library code :
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11,6, 5, 4, 3); 

void setup() 
{
 lcd.begin(16, 2); 
}
Void loop()
{
 lcd.setCursor(1,0); 
 lcd.print("hello, world!");
 lcd.setCursor(4,1);
 lcd.print(“29/05/21”);
}



Your LCD screen should look like this:




lcd.scrollDisplayLeft()


This function takes anything printed to the LCD and moves it to the left. It should be used in the void loop() section with a delay command following it. The function will move the text 40 spaces to the left before it loops back to the first character. This code moves the “Scrolling text in LCD Display” text to the left, at a rate of 0.8 second per character:


#include <LiquidCrystal.h>
int pos=0;


LiquidCrystal lcd(12, 11, 6,5, 4, 3);

void setup() {
 lcd.begin(16, 2);
 lcd.print("Scrolling text in LCD Display");
}

void loop() {
for(pos=0;pos<2;pos++)
{
 lcd.scrollDisplayLeft();
}
 delay(800);
}



Check out the session on our youtube:





Written By: Dipanshu

2nd year ECE

University Institute of Engineering and Technology, Panjab University



115 views0 comments

Recent Posts

See All

Comments


bottom of page