Interfacing 20x4 LCD With Arduino

Introduction: Interfacing 20x4 LCD With Arduino

About: An electronics enthusiast... #Complexity simplified

A liquid-crystal display (LCD) is a flat panel display, electronic visual display, or video display that uses the light modulating properties of liquid crystals. Liquid crystals do not emit light directly.
Here, in this i'ble we're going to use a monochromatic 20x4 alphanumeric LCD. 20x4 means that 20 characters can be displayed in each of the 4 rows of the 20x4 LCD, thus a total of 80 characters can be displayed at any instance of time.

Step 1: Material Required

List of requirements is as follows:

1. Arduino/or any other clone

2. 20x4 LCD

3. Breadboard

4. 1k, 220R Resistors

5. Connecting wires

Step 2: LCD-Pinout

The LCD we are using has 16 pins. Description of each pin is as follows:

Pin No Symbol Level Description

1 VSS 0V Ground

2 VDD 5V Supply Voltage for logic

3 VO (Variable) Operating voltage for LCD

4 RS H/L H: DATA, L: Instruction code

5 R/W H/L H: Read(MPU?Module) L: Write(MPU?Module)

6 EH H->L Chip enable signal

7 DB0 H/L Data bus line

8 DB1 H/L Data bus line

9 DB2 H/L Data bus line

10 DB3 H/L Data bus line

11 DB4 H/L Data bus line

12 DB5 H/L Data bus line

13 DB6 H/L Data bus line

14 DB7 H/L Data bus line

15 A 5V LED +

16 K 0V LED-

Step 3: Schematic

1. Study the schematic carefully.

2. Place your LCD on the bread board.

3. Make connections as per the schematic.

4. Instead of the potentiometer, you can use a 1k resistor and connect Pin 3 of LCD to Vcc via the resistor.

5. Carefully check whether all the connections are tight and correct.

6. Power up your Arduino via USB and check whether the LCD lights up. If yes, proceed.

Step 4: Code

There are two options that you can follow, either you can build up your own code, if you know how to or you can use the example code from the built-in Arduino library "LiquidCrystal.h".

I have used the HelloWorld example from the library. You can find this example in Arduino IDE following the path: File->Examples->LiquidCrystal->HelloWorld.

Now connect the Arduino to any of the USB ports and upload the code.
Once the code is uploaded, you must be able to see "hello, world" printed on the LCD.

Step 5: That's All

5 People Made This Project!

Recommendations

  • Game Design: Student Design Challenge

    Game Design: Student Design Challenge
  • Big and Small Contest

    Big and Small Contest
  • Make It Bridge

    Make It Bridge

17 Comments

1
AntonS83
AntonS83

2 years ago

Pin 15 which is LED+ must be supplied through a 220Ω resistor to limit the current. Your schematic does not show that, although your list of parts has the 220Ω resistor listed !

1
KD0JXE
KD0JXE

3 years ago on Step 5

The instructions call for a 20x4 LCD. The Helloworld sketch uses a 16x2 LCD. It does not work when you change the lcd.begin(16, 2); command to lcd.begin(20, 4); does not work.

0
TimKern
TimKern

Question 3 years ago on Step 5

OKAY, with my 2004A display, each position (of 20) in rows 1 and 3 (of four rows) lights up with a 5 pixel wide x 8 high rectangle. (Rows 2 and 4 are plain blue and look like the background.) Is it hooked up properly?
Display GND ==> Arduino GND
VCC ==> +5v
SDA ==> A4
SCL ==> A5
Here's the sketch:
-----
#include <Wire.h>
#include <WeightAndCG_OK_1a>
WeightAndCG_OK_1a lcd(0x27, 2,1,0,4,5,6,7,3, POSITIVE);
void setup() {
{
lcd.begin(20,4);
lcd.setCursor(0,0);
lcd.print("Weight is 07240");
lcd.setCursor(0,2);
lcd.print("0212 pounds under limit");
lcd.setCursor(0,3);
lcd.print("F______*__________R");
lcd.setCursor(0,4);
lcd.print("CG is within limit");
}
}
-----
Next, when I use a pre-made test sketch or write my own (changing only the message), I get a "No such file or directory" error, even though I've just saved it.
Where can I put the file, so the verifier can find it? Thanks.

0
Jorgealv
Jorgealv

5 years ago

Its work for me after I made the following changes:

void setup() {

delay(2000);// add to give some time to start the LCD
// set up the LCD's number of columns and rows:
lcd.begin(20, 4); //
// Print a message to the LCD.
lcd.print("line 1 8901234567890");
lcd.print("line 2 8901234567890");
lcd.print("line 3 8901234567890");
lcd.print("line 4 8901234567890");
}

0
babul786
babul786

5 years ago

You are posting this instruction for 20*4 since you have used 16*2 in your program??

0
ScottL3
ScottL3

6 years ago

This is a very good instructable as I have a need to test an 20x4 LCD display that was attached to a smart reprap board.

Thanks

0
kishorekumarr
kishorekumarr

7 years ago

Hi,

I am working with 4x20 LCD ...how to select 4 lines plz helpme... i dont have proper datasheet..

0
Medo best
Medo best

Reply 7 years ago

lcd.setCursor(x, y);
Set x as the charcter pos. And y for the line..

0
ebi86
ebi86

7 years ago

hi dear

excuse me in page 3 you wrote:

4. Instead of the potentiometer, you can use a 1k resistor and connect Pin 3 of LCD to Vcc via the resistor.

there is a problem. pin 3 can be connected to GND via a resistor; not to vcc

thanks

0
apoorveinstein
apoorveinstein

Reply 7 years ago

It can be done.

The pot acts as a voltage divider, if I connect Pin3 to Vcc via a resistor, it'll still work as the Pin3 will have a floating ground. Thus, it solves the purpose of voltage division.

0
ebi86
ebi86

7 years ago

please write a sample code in bascom version thanks

0
LeonardoB3
LeonardoB3

8 years ago

Estimado, lo hice y no me funciona, el diagrama es exacto.

Hasta probé modificar el

lcd.begin(20, 4);

Alguien me dijo de modificar la librería, vos lo hiciste o te anduvo de primeras?.

Gracias.

0
LeonardoB3
LeonardoB3

Reply 8 years ago

Ya lo resolví, le saqué el potenciómetro y le puse una resistencia de 10k.

Saludos!.

0
dorgan1983
dorgan1983

8 years ago

Save yourself some I/O pins and get an I2C version

0
apoorveinstein
apoorveinstein

Reply 8 years ago on Introduction

I2C and serial versions of LCD does save pins but for beginners, I think this is better to use and understand.