Problems with lcd 20x4 compatible hitachi h44780


I've followed the tutorial on the main site of arduino ( to connect an lcd display 20x4 blue compatible hitachi h44780, but it doesn't work. Initially it didn't power up (it seems like turned off), then I've connected a 220 ohm resistor to the 5V and the 15th pin of the lcd and I've powered the 16th with the gnd. Then it turned on, but nothing appeared on the screen.

I've adjusted the number of the pins in liquidcrystal lcd with 7, 5, 3, 2 and the lcd.begin with 20,4. It doesn't work. I found many tutorials on the internet: most of them sugget the same workaround and one or two suggest another method, but the images are in small resolution.

Anyone can help me to connect the lcd to Arduino Mega 2560?

Thank you!


Edit: I've tested the potentiometer with an arduino sketch and it seems like it doesn't work: it gives random values.... Is there a way to connect the contrast pin (3rd) to arduino without using a potentiometer? I tried to connect it to the 5V using a 220 ohm resistor without succeding in.

We will probably need a photograph of your setup in order to determine if you have interpreted the tutorial correctly, I suspect not.

Here my generic step by step approach that should work:

(1) If the module has a backlight ten get it working properly. This involves only pins 15 and 16 on your LCD module. Make sure to use a current limiting resistor if there is none on the LCD module.

(2) Get the power and contrast working properly. This involves pins 1, 2, and 3 on your LCD module. You should be able to see blocks on one row of a two row display and on two rows of a four row display.

NOTE: The Arduino has not been used yet, except as a possible source for the power needed for the first two steps. Do not try to go any further until this is working. If you don't see the blocks then no amount of program code will help.

(3) Connect the LCD R/W pin (pin 5) to GND.

(4) Connect the six control and data wires between your LCD module and your Arduino.

(5) Upload your sketch and it should work.

If you still don't get a display then make sure that your wiring matches the numbers in the descriptor (or vice versa).

//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(7, 8, 9, 10, 11, 12); // put your pin numbers here

If you get a display but it is garbled or has some other problems then try again with a 'static' sketch, one that displays a simple message on the top row of the display and then stops. All of your code should be in setup() and loop() should be empty between the brackets.


You can control the contrast with Arduino software, but it's not just a matter of hooking up the pins, you need a resistor and a capacitor as the Arduino's analogWrite function does not actually output analog voltage -- it's PWM.

However I would recommend you use a three-pin 10K pot (potentiometer) before trying to get software contrast working. The pot's wiper goes to the contrast pin of the LCD, and the other two pot pins go to +5VDC and ground.


I made some photos of my circuit (without potentiometer).
The potentiometer I have doesn’t work: I’ve tested it with a simple Arduino sketch and, on the serial port, appeared random values.
I’m going to buy another potentiometer, but all shops are now closed. I think that I’ve soldered everything well, but I’m not sure of that.
If the potentiometer is the problem, I’ll wait until 24th of August in order to buy another potentiometer.

Thanks a lot!


LCD (2.82 MB)

You appear to be trying to power your LCD and it’s backlight from one of the Arduino digital pins. The backlight alone will probably draw more current than the digital pin can safely produce. Move the white wire from pin 21 to 5v and see what happens.

Try running your LCD with pin 3 connected to GND if you do not have a potentiometer. Many devices work acceptably this way.


I don't see a connection to pin 3, which I believe is the contrast pin? Typically labeled "V0".

How did you connect the pot to the LCD? Did you connect the wiper to the contrast pin and the other two pot pins to +5VDC and to ground?

Also when testing the pot with the Arduino analogRead(), do you have the wiper connected to the analog input and the other two pot pins connected to +5VDC and to ground?

A pot works best when it's not just a variable resistor, but a voltage divider. That's why two pins have to go to +5VDC and to ground and the wiper becomes the pot "output". If you only make two connections to the pot, then the response becomes less linear and more logarithmic, which is generally not useful.

I don't see any LCD control wires (Dx, RS & E)

I don't see any LCD control wires (Dx, RS & E)

Agreed. However, even with those disconnected, you should get one or two rows of "blocks" on the display that you can use to verify the module is working and that the contrast is appropriately adjusted.

I don't see any LCD control wires (Dx, RS & E)

Look at the note after step 2 in my outline. You don't need or want any connections to the Arduino until you get those two steps completed.


You've got plenty of great advice. One thing I didn't see mentioned is that to see something on a transmissive display (like the one you have, I believe, white on blue) you also need to have the backlight connected.
This is what I'd recommend you to start with, to see if you can get the blocks displayed on the screen (as per post #2 in this thread).
*Click to resize.

Thank you!

I've connected the 3rd pin to gnd and I used another 220 ohm resistor between 5V and 15th pin of the lcd.
I've seen the first and the third lines of leds turned on. So, what do I have to do now if I'd like to control the constrast (I may have fixed contrast using a resistor, May I?) without a potentiometer? In this mode I can connect the other pins to Arduino and control the lcd. Can't I?

Thanks a lot.


You need some kind of voltage divider for the contrast. You can also leave it connected to ground, but the contrast is usually too high when you have it set that way.
The easiest way is to use a potentiometer. Pin1 goes to GND, Pin2 goes to VCC, Sweeper pin goes to LCDs Vo (pin3). By turning the pot all the way to one or another direction, you should see the blocks again, then simply adjust it so that the contrast is good for your use.

Now you can connect the rest of the control lines, RS, EN, DB4 - DB7 to your Arduino. Connect RW to GND. Basically follow the instructions in the LiquidCrystal tutorial. Make sure that you declare the correct corresponding pins in the sketch to the ones you physically connected on your Arduino.

When I’ll have a potentiometer, I’ll try.



If you don't want to wait, you can keep Vo (pin3) connected to ground until you get a pot, it won't hurt the display.

If you don't want to wait, you can keep Vo (pin3) connected to ground until you get a pot, it won't hurt the display.

Why didn't I think of that?