LCD help

Alright I attempted to search the forum but couldn't get an answer really.

I have a Duelmilanove wired up to a bread board.
In the bread board I have the 10K potentiometer and a 16x2 LCD I bought from Adafruit.

Using this pin set up and this code:

  LiquidCrystal Library - Hello World
 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the 
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.
 This sketch prints "Hello World!" to the LCD
 and shows the time.
  The circuit:
 * 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
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)
 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (*)
 example added 9 Jul 2009
 by Tom Igoe
 modified 25 July 2009
 by David A. Mellis


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

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of rows and columns: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:

I have also added a 5V and GND for the back light.
(but of course this shouldn't matter or change anything what so ever)

Now for the problem..

I am getting the back light and I am able to control the contrast.
But I am not getting the "Hello World!". :-/

A picture of your breadboard layout and connections would help greatly. Mixing up LCD pins is a very very common and easy to make mistake.

Does your sketch upload properly?

Yes it uploads just fine.
Currently I have it dismantled I will rebuild the setup again tomorrow.
(it's almost 1 AM here in NY)

I will upload pictures then.

Take note that I have rebuilt this three times today.

I'm with Things on this one, I think the problem will be fixed when you rebuild it.

Another thing to check though, is the RW Pin (aka pin 5 on the LCD), with this setup on LiquidCrystal, the RW pin must be grounded (GROUND = WRITE) since you're not able to read from HD47780 LCD's, no reason to be able to set the pin high to be able to "read".

So, put a jumper from GROUND to PIN5 on the LCD, it's just before Enable and just after RS.

I think that should do it!:smiley:

I'm not sure if that's been pointed out or not, but I'm sure it'll be a fix in 0018! But regardless, it's something that should be mentioned right after the pin description. And I know you said you're using the 10k potentiometer, but I read the example and it says "10k resistor, ends to 5v and ground" lol... it's late... I read it like 5 times before realizing it was suppose to be a potentiometer.


You are displaying the message "hello, world!" in setup(), which is correct -
You immediately proceed to loop() where you immediately cover up the message with the first millis() count
You are immediately covering that count with the next, etc. etc. etc

You need a delay at the end of setup() which will let you read the "hello, world!" message. You also need a delay within loop() which will give you time to read a millis() value before it is covered up with the next one.

You could probably get by with just one delay, at the beginning of loop() .


Thank you everyone who has replied, I will be rebuilding this as soon as I get home tonight.

Are you sure I should put a delay after the lcd.print in the setup loop?

I may just put this code in and see if it works.

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
  lcd.begin(16, 2);
  lcd.print("hello, world!");
void loop() {
digitalWrite(13, HIGH);
digitalWrite(13, LOW);

Does this code look good to everyone?
Therefore there is no rewrite to the lcd after "hello world!".
Only change after is the pin 13 light should flash.

EDIT: Heck for good measure I could even throw a delay() in the setup.

By the way that was the release code under examples.

By the way that was the release code under examples.

No. The example program has an empty loop() function so that the "hello, world!" message is not immediately covered up as yours was (or would be if everything else is ok).



I'm having similar problems with the same example. I'm using a Mega with a 4x20, both from adafruit. I've rebuild the breadboard three times. The back light comes on and I can adjust the contrast, voltages on pins 2 and 3 make sense.

The example with the milliseconds display came from the 0017 examples. the example with a void loop {} came from the tutorial.

Maybe someone who is experienced could please double check to make sure the various versions of 'helloworld' work? I can't tell if it is the display or the software, although it's probably the keyboard to chair interface....

Thanks for taking care of a couple of newbies!


oops - I overlooked the setCursor which puts the millisecond display on the second row.

I'll build this up later this evening and get back to you.


Thanks for taking the time to check this out!

There are several examples out there, with .cpp and .h files to go with them. Is there some special way to keep the .pde, .cpp, and .h files under control? put them all in arduino-0017\hardware\libraries? When it compiles an example, how does it know where to look for the .cpp and .h files? What's your method/technique that works?

Thanks, Rich.

Well it works for me. Here's what I did.

First I connected just the power and the contrast and verified that I got a blank screen with the pot set to one end and a row of dark boxes on the top row with the pot set to the other end. I readjusted the pot until the row of boxes was barely visible.

Next I built up the rest of the circuit. I used the description of the connections given in the comments. I also made sure to ground pin 5, the R/W pin. You may have missed this key step.

I downloaded a pristine copy of Arduino v0017, unzipped the archive and created a shortcut to arduino.exe.

I opened the IDE and cut and pasted the program code from the original post into the blank sketch.

I did a verify followed by an upload and got the "hello, world!" message on the top row and a incrementing count on the second row.


Update -

I added this code to loop()

digitalWrite(13, HIGH);
digitalWrite(13, LOW);

and now the LED on pin 13 flashes as well.


VDD pin is 5V correct?

VDD pin is 5V correct?



Cool! I'll try to do exactly what you said, tomorrow. and I'll post the results.

Another exciting adventure!

Thanks, Rich.

I am wiring this up as we speak.

This would be much easier if my bread board jumper wires came in today ::slight_smile:

Well I got it to SORT of display Hello world...

Just.. It is now distorted..

Hmm. Would the lcd be distorted if it was not getting enough power for some reason? what would cause this? picture in a second..

It's only showing contrast on the right two rows... :-?

I am using a Duemilanove and a 4X20 display bought from hacktronics. They recommend just a 1k resistor from contrast (pin3) to ground, which gives me good contrast. Also, just shorting pin 3 to ground gives good contrast. The "hello world" code from the Aduino version 17 examples worked fine for me.

Now my question: I am using the "serial input" code, again directly from the V17 library. If I put in more than 20 characters, the text wraps from line 1 to line 3, then to line 2, then to line 4. Why? I tried changing the parameters in the call to lcd.begin, first to the (20,4) matching my LCD, then to various other numbers, but it made no difference in the text wrapping, so:

  1. Why the odd wrapping order, and
  2. What exactly does lcd.begin do?


They recommend just a 1k resistor from contrast (pin3) to ground, which gives me good contrast. Also, just shorting pin 3 to ground gives good contrast.

I guess that's why they are called hacktronics. Seriously - It may work on the display that they sell (it works on mine too) but it is a good idea to stick with the manufacturers recommendations if you want the same code to work on your next display.

Why the odd wrapping order

A full explanation can be found by using the LCD Addressing link at .

What exactly does lcd.begin do

It lets you specify the configuration of your LCD so that the setCursor() can hopefully work correctly. I say hopefully because there is still at least one bug, for the 16x4 displays.


Here is that image of the weird contrast I talked about in my other post.

That picture is a prime example of why I have never tried to make any phone calls with my camera.