LCD modules ( Display text on LCD ) form a very important part of many Arduino based embedded system designs. So the knowledge on interfacing LCD module to Arduino is very in designing embedded systems. This section of the article is about interfacing an Arduino to 16×2 LCD. JHD162A is the LCD module used here. JHD162A is a 16×2 LCD module based on the HD44780 driver from Hitachi. The JHD162A has 16 pins and can be operated in 4-bit mode (using only 4 data lines) or 8-bit mode (using all 8 data lines).

Here we are using the LCD module in 4-bit mode. First, I will show you how to display plain text messages on the LCD module using Arduino and then  I have designed a useful project using LCD and Arduino – a digital thermometer. Before going into the details of the project, let’s have a look at the JHD162A LCD module.

Components Used For Display text on LCD :

  • Arduino or Genuine Board
  • LCD Screen (compatible with Hitachi HD44780 driver)
  • pin headers to solder to the LCD display pins
  • 10k ohm potentiometer
  • 220-ohm resistor
  • hook-up wires
  • breadboard

Description

This example ( Display text on LCD ) demonstrates the use of LCD in the real world. Out of all available LCD modules in market, the most commonly used one is 16×2 LCD Module(it is called 16×2 LCD because there are two rows. in each roe we can write 16 characters)

Quick points

  • This is a basic program for displaying text on LCD.
  • Here, there is a description of each pin in detail.

JHD162ALCD module arduino

  • Pin1(Vss): Ground(GND) pin of the LCD module.Pin2(Vcc): Power to LCD module (+5V supply is given to this pin)Pin3(VEE): Contrast adjustment pin. This is done by connecting the ends of a 10K potentiometer to +5V and ground and then connecting the slider pin to the VEE pin. The voltage at the VEE pin defines the contrast. The normal setting is between 0.4 and 0.9V.Pin4(RS): Register select pin.The JHD162A has two registers namely command register and data register. Logic HIGH at RS pin selects data register and logic LOW at RS pin selects command register. If we make the RS pin HIGH and feed an input to the data lines (DB0 to DB7), this input will be treated as data to display on the LCD screen.
  • If we make the RS pin LOW and feed an input to the data lines, then this will be treated as a command ( a command to be written to LCD controller – like positioning the cursor or clear screen or scroll).Pin5(R/W): Read/Write modes. This pin is used for selecting between reading and write modes. Logic HIGH at this pin activates read mode and logic LOW at this pin activates write mode.Pin6(E): This pin is meant for enabling the LCD module.
  • A HIGH to the LOW signal at this pin will enable the module.Pin7(DB0) to Pin14(DB7):  These are data pins. The commands and data are fed to the LCD module through these pins.Pin15(LED+): Anode of the backlight LED. When operated on 5V, a 560-ohm resistor should be connected in series to this pin. In Arduino based projects the backlight LED can be powered from the 3.3V source on the Arduino board.Pin16(LED-): Cathode of the backlight LED. 

Min Req. 15min

A line of code:

#include<LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);  // sets the interfacing pins

void setup()
{
 lcd.begin(16, 2);  // initializes the 16x2 LCD
}

void loop()
{
  lcd.setCursor(0,0);           //sets the cursor at row 0 column 0
  lcd.print("16x2 LCD MODULE"); // prints 16x2 LCD MODULE
  lcd.setCursor(2,1);           //sets the cursor at row 1 column 2
  lcd.print("HELLO WORLD");     // prints HELLO WORLD
}

Procedure For Display text on LCD :

  1. Take Breadboard.
  2. Take LCD(16X2) it will have 8 data pins.
  3. Now take 2 M-M jumper wires
  4. Before wiring the LCD screen to your Arduino or Genuine board we suggest soldering a pin header strip to the 14 (or 16) pin count connector of the LCD screen, as you can see in the image above.
    To wire your LCD screen to your board, connect the following pins:

    • LCD RS pin to digital pin 12
    • LCD Enable pin to digital pin 11
    • LCD D4 pin to digital pin 5
    • LCD D5 pin to digital pin 4
    • LCD D6 pin to digital pin 3
    • LCD D7 pin to digital pin 2

    Additionally, wire a 10k pot to +5V and GND, with its wiper (output) to LCD screens VO pin (pin3). A 220-ohm resistor is used to power the backlight of the display, usually on pin 15 and 16 of the LCD connector

  5. Fix them to connected line with Lcd( To understand more about Breadboard connection click here )
  6. UNDERSTANDING OF CODE:
  7. 1st loop
  8. initialization of 16×2 LCD.
  9. 2nd loop
  10. set the cursor at 1st position of LCD which is row 0 and column 0.
  11. THE BASIC LOGIC OF THIS EXAMPLE IS TO DISPLAYING ON  LCD
  12. Check once again with a circuit to avoid any short circuit.
  13. Connect Arduino to your Laptop/PC by USB Cable.( we use A to B USB cable for Arduino which is also used in printers )
  14. Open Arduino IDE ( You can download it from here or you can use online platform Arduino Web editor )
  15. Go to File > Examples > Basic > Displaying text on LCD.
  16. Check program and then upload it.
  17. You can change text and see the output according to that.