Connecting LCD display to Arduino

Error message

Notice: Undefined index: secondary-links in menu_block_view() (line 462 of /home/aproject/public_html/modules/menu/menu.module).
lcdwired.png509.29 KB

At first I thought that connecting and controlling a LCD display with Arduino is something complex and can be done only by people with good electronics background. I was wrong. It took me half an hour to figure out the steps to do to connect a newly bought LCD display. The only thing to note - the LCD display should be Hitachi HD44780 compatible. I bought my two LCD displays on eBay: LCD Display HD44780. Why did I buy two of them? Just because of the shipping costs and for some reserve for future projects.

Ok, let's get to basics of connection. You don't need any resistors, capacitors or anything, just plain wires. I used the prototyping jumper set that I bought at the local electronics store - something like this one: WJW70: Assorted Jumper Set. Had to bend some of the jumpers to connect the display with Arduino Diecimila. I did no soldering just because I wanted to test the connection and find out how it works before doing something wrong. To connect a LCD display to Arduino board you need 8 free arduino digital output pins. Which should all be connected to correct LCD display pins + you need 2 power and 2 ground connections for the LCD - as far as I understood - one of each for the backlight and one for the letters themselves. If you don't want to adjust LCD contrast, you can free one Arduino digital output pin by grounding the LCD contrast pin. That will set the LCD display to maximum contrast. Ok, enough talking, let's start connecting. Each display has an explanation about the pins. Mine had a small table on the eBay page:

LCD Pin Number Symbol Function
1 Vss Display power ground
2 Vdd Display power +5V
3 Vo Contrast Adjust. Altered by adjusting the voltage to this pin, grounding it sets it to maximum contrast.
4 RS Register select
5 R/W Data read/write selector. Its possible to read information from a display however there's no need for it here so grounding it sets it permanently write.
6 E Enable strobe
7 DB0 Data Bus 0
8 DB1 Data Bus 1
9 DB2 Data Bus 2
10 DB3 Data Bus 3
11 DB4 Data Bus 4
12 DB5 Data Bus 5
13 DB6 Data Bus 6
14 DB7 Data Bus 7
15 A
LED backlight power +5V
16 K LED backlight power ground

If we look at the Arduino LiquidCrystal library that you can use to interact with the LCD display, all we need from this table is:

LiquidCrystal(rs, rw, enable, d4, d5, d6, d7)

Which means that we need to connect the 4th, 5th, 6th, 11th, 12th, 13th and 14th LCD display pin to arduino digital output pins (be sure you are not using the 1 and 0 pins on Arduino, as these are reserved for serial communication and as far as I understood can't be used here. Besides connecting these LCD pins to Arduino, you also need to connect the +5V power and ground from Arduino board to respective pins on LCD display. And .. don't forget to ground the LCD contrast pin.

To be sure I connect everything correctly I put up a small table on a sheet of paper that held LCD and Arduino pin relations:

Arduino Pin LCD Pin LCD Pin Name
2 4 RS
3 5 RW
4 6 Enable
5 3 Contrast (could be simply grounded, but I chose to manually adjust contrast using the analogWrite function)
9 11 Data 4
10 12 Data 5
11 13 Data 6
12 14 Data 7

When you're done with this, just connect the Arduino board and upload a sketch from LiquidCrystal documentation page with the correct pin numbers:

#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 9, 10, 11, 12);
void setup(){
  lcd.print("hello, world!");
void loop() {}

.. and the result is:


thanks for posting this ingus- been struggling with getting my lcd running and finally got it working after reading this!!(had the pins backwards)

This is very useful, and I like your elegant wiring. I just rewired my arduino/lcd setup to match your circuit (thought including the 5th pin might help), but I'm still getting a weird result. This after I burnt out the LED in my backup LCD (after only a few minutes of use, and I shouldn't need a resistor for a 5V LCD, right?). So I'm on pins and needles and trying to get this to work.

My problem is frustrating: I can usually get a hello world going, but I actually want to use this display to do a little more than display one line of text. And I can go a little beyond that, but stray too far and something will wonk out. So either my LCD or Arduino has a minor flaw, or there is a pin that is not fully connected or a _very_ subtle and rarely used pin that is completely unconnected.

My instructor gave the class a sample project, that basically had a short char* array that lcd.print would pull from in the loop. I get through about 5 of the 7 of the lines, then I get the top row wonking out full grey, then the text sequence changes to strange letters-- big and small Os, degrees symbols, japanese characters, arrows, slashes, multiple blink characters in the same line.

Why would the display work only kinda-sorta?

When I went into class last week, my instructor got it working again by resoldering. Tried that a minute ago, no luck. It doesn't help that the documentation for these hitachis and liquid crystal is either totally vague or engineering-complex.

But anytime I try to get it running at home, disaster ensues. No one else in class seems to have an issue. I would swear off liquid crystals but I've got a final project that is all about them.

heres a video of what happens:


I admire your elegant wiring. I actually rewired my previous setup to match your (thought the LCD's pin 5 might actually make a difference).

If anyone feels like being stumped, please take a look at the video of my problematic setup and give troubleshooting ideas in the comments. Arduino code is in the description.