20x4 LCD display is not working with Arduino Uno

Hello out there,

I am trying to get my 20x4 Liquid Crystal display to work with my Arduino Uno but I am constantly being unsuccessful. I have followed various different guides but I end up getting the same result over and over again.

I do get backlight which I can control and I can also control the contrast of the character blocks. But I can’t print anything on the display. I only see solid blocks on rows 1 and 4. I really don’t understand where I am making the mistake.

I have taken a picture of my setup. You can see it here: http://ge.tt/2sPc3OA1/v/0

My LCD is a J204A. The data sheet is available here: http://www.electrodragon.com/w/images/8/8d/204A_instructions.pdf

My code is the following:

#include <LiquidCrystal.h>

const int backLight = 13;
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

void setup()
{
  pinMode(backLight, OUTPUT);
  digitalWrite(backLight, HIGH);
  
  lcd.begin(20, 4);
  lcd.print("What is your name?"); 
}

void loop()
{
  lcd.setCursor(0,1);
  lcd.print("Andrea");
  delay(1000);
  lcd.setCursor(0,1);
  lcd.print("      ");
  delay(1000);
}

I really hope you will be able to help me debug this problem. It’s driving me nuts! :~

Edit (12/19/2013): Updated some mistakes in the code.

It looks like you wired it per the code but you didn’t mention if it compiled.
I am assuming that means it compile ok .
Did you save the file in your sketch folder or just paste it in the IDE ?

Thanks for your quick reply! :slight_smile:

Yes, it does compile well without any problems.

I just wrote the code in the console based on some tutorials I found. I don't see why I should put it in the sketch folder?

You are initialising a 1602 display, which fails.
You are using a 2004 display.

 lcd.begin(16, 2);

Good catch !
I totally missed that!

Also, you are controlling the backlight with pin 13.
Are you sure that backlight isn't drawing too much current ?

By the way, those blocks are actually on line 0 and 2.
And why are you printing a bunch of spaces on line 19 ?

Thanks for all the replies! I really appreciate your quick help.

Actually, I did try to instantiate the display with lcd.begin(20, 4); but it didn't work so I tried to instantiate a smaller display. That didn't work either.

Regarding the line lcd.setCursor(0,19); -- that was a mistake! I meant to say: lcd.setCursor(0,1);. The idea is to have the name flashing with 1 second delays.

I tried disabling the backlight but no luck. I don't think it is taking up too much current.

I am really starting to think that I have a faulty display. I can't seem to get any characters to show on the screen no matter what I do. Yet I can't see what I am doing wrong.

I have had the same result by not having library installed correctly or not running program
correctly.
Are you using "File/Examples/etc...?
or
"File/Open" etc."
or
pasting code in IDE window ?
Have you installed the library ?
How ? (exactly)

Did you try using the Arduino LiquidCrystal Tutorial and wiring per that ?

Well, pull it apart, inspect closely and test all the jumper wires with a multimeter or buzz box, and reassemble it.

It would not be the first time that those jumper wires were faulty, and sometimes they have spots of insulating lacquer which just happen to be where you plug them into the breadboard.

Paul__B:
Well, pull it apart, inspect closely and test all the jumper wires with a multimeter or buzz box, and reassemble it.

It would not be the first time that those jumper wires were faulty, and sometimes they have spots of insulating lacquer which just happen to be where you plug them into the breadboard.

Very true.
Another common problem are the actual contacts on the breadboard, over time they get loose or tarnished and make bad contacts,
This is especially true of the "cheaper" breadboards.
I stopped using breadboards years ago simply because there were too many intermittent faults which only got worse as the breadboard was used more and more..
Now I only use veroboard/stripboard or make quick hand drawn PCBs.

I have exactly the same display and it works fine here.

Please wire it like this:

and also connect pin 15 to 5V and pin 16 to ground for the backlight. Also check the soldering on your lcd display. Make sure every contact works.

Also start with getting the example code working first (but change the rows and columns to match your display):

The state you see your display as seen in your photo, is that it is not initialized yet. So double check your wiring and connections.