[SOLVED] Trouble with LCD 1602 Arduino (compatible with Hitachi HD44780 driver)

I try to use the LCD 16x2 supplied with my kit. I did all the wiring as explained in the lesson. When I power the Mega 2560 controller, in the first line is displayed 16 full white rectangles and nothing in the second line. I downloaded the HelloWord sketch but that changed nothing. What can be wrong ? I tested another LCD and get the same result. I cheked the wiring, it's correct for the Mega 2560. I modified pin number according to the specs.

Have you tried turning the contrast potentiometer?

If the potentiometer doesn’t help:
As there are so many chances to either:

  • wiring something wrong
  • using a non-compatible LCD library
  • messing with the constructor etc. etc.

→ please post:

  1. your sketch (using code tags (</>))
  2. your wiring scheme
  3. what library do you use?

rpt007:
If the potentiometer doesn’t help:
As there are so many chances to either:

  • wiring something wrong
  • using a non-compatible LCD library
  • messing with the constructor etc. etc.

→ please post:

  1. your sketch (using code tags (</>))
  2. your wiring scheme
  3. what library do you use?

Thank you for your help (Sorry, I am french and never used this forum before today, I don’t understand what the </> means)

First, the potentiometer helps, it makes the pixels from blue (not visible) to full white.

I am doubting about the harware of this LCD display because I don’t think it’s normal that when it is powered up, it has this first line of rectangles whites and the second line empty. Nonetheless, above the
Answer to points 1.2.3. : my sketch including the wiring and the Library used which is Arduino 1.8.0 →

/*
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 7
* LCD Enable pin to digital pin 8
* LCD D4 pin to digital pin9
* LCD D5 pin to digital pin 10
* LCD D6 pin to digital pin 11
* LCD D7 pin to digital pin 12
* LCD R/W pin to ground
* LCD VSS pin to ground
* LCD VCC pin to 5V
* 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 (http://www.ladyada.net)
example added 9 Jul 2009
by Tom Igoe
modified 22 Nov 2010
by Tom Igoe

This example code is in the public domain.

http://www.arduino.cc/en/Tutorial/LiquidCrystal
*/

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

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {
// set up the LCD's number of columns and rows:
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:
lcd.print(millis() / 1000);
}

I don’t understand what the </> means

Apparently you did it right → putting your code in these characters does exactly what we see now → your code in a separate window, selectable and scrollable. Good job for first time poster!

I don’t think it’s normal that when it is powered up, it has this first line of rectangles whites and the second line empty.

This is normal for the case, that the display is powered, backlight works, but the constructor doesn’t match with your wiring.

I did all the wiring as explained in the lesson.

As we don’t know, what lesson you are referring to - we need to see how you wired the Mega with your LCD.

Reason:
The constructor in your sketch:
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
means, that your LCD has to be connected accordingly to the pins, which are assigned by the constructor as … lcd (rs, enable, d4, d5, d6, d7) and thus only works when you have wired your display as follows:

Arduino pin → LCD pin
7 → rs (RS)
8 → enable (EN)
9 → d4
10 → d5
11 → d6
12 → d7

The LCD’s “RW”-pin has to be wired to GND of the Arduino when using that constructor;
for more information see:
https://www.arduino.cc/en/Reference/LiquidCrystalConstructor
You can also use other pins of your MEGA, but then you have to adjust the pin assignment in the constructor as described above; the only condition is, that the constructor’s pin assignment corresponds to your wiring.

So pls check again, if all of your wiring is EXACTLY as I listed here (identical with the instructions in your example sketch). Even if so - a common issue for beginners with LCD displays is, to have no solid connections between Arduino and LCD display.

We had newbies here which didn’t solder the wires at all, just bent them around the pcb hole → this is a no go and will never work! Also: “cold” solder spots are no good idea. Your connections have to be solid, anything else will fail or cause trouble.

And: when you had to make modification(s), use the potentiometer again as it might work after your modification, but the contrast of the display is not set right.

The following link gives you an alternative wiring and especially refers to a Mega and a 16x2 LCD display: http://www.allaboutcircuits.com/projects/interface-an-lcd-with-an-arduino/ Although, solid connections and wiring according to the constructor given, should work with your original sketch.

So pls check again, if all of your wiring is EXACTLY as I listed here (identical with the instructions in your example sketch). Even if so - a common issue for beginners with LCD displays is, to have no solid connections between Arduino and LCD display.

We had newbies here which didn't solder the wires at all, just bent them around the pcb hole -> this is a no go and will never work! Also: "cold" solder spots are no good idea. Your connections have to be solid, anything else will fail or cause trouble.

And: when you had to make modification(s), use the potentiometer again as it might work after your modification, but the contrast of the display is not set right.

Thanks again for your helpfull advices and HAPPY NEW YEAR

I check again the wiring, everything is as you detailed above, in comformity with the C++ code. For the connections, my LCD 1602 module is out of the box from the Arduino kit and come with 16 pins that fit in the 816 tie-points board. I did other prototypes with this board and never had bad connections. If you think that at power on the module must be as explained (one solid rectangle line), the only remaining problem seems the driver in the librairy. I don't know how to check that...(I am a retired sofware engineer mainly on Windows and have few hardware knowledges).

Can you please attach a photograph showing the connections to the lcd and the arduino.

In addition to @cattledog's advice: Can you measure wire by wire the connections between Arduino and LCD display?

At the end these kind of problems turn out in >90% as connectivity issues.

cattledog:
Can you please attach a photograph showing the connections to the lcd and the arduino.

Here is the photograph (I will check the continuity of the wiring to morrow).

Here is the photograph (I will check the continuity of the wiring to morrow)

If the wires are going to the correct place, be sure to check the wires themselves. The fact that you see the white blocks and not scrambled data, would lead me to suspect the RS,RW, or E connections.

If the wires themselves are not the problem it would be wise to move the lcd to different holes.

Here is the photograph (I will check the continuity of the wiring to morrow).

AARRGGHH Why don’t you twist the yellow wires together to make them even harder to follow?

In order to compare your wiring with your constructor we have to be able to unambiguously follow each wire from one end to the other.

Also - it’s hard to see if the blue and red lines that are printed on your breadboard are continuous from one edge to the other. If there are breaks in the lines near the middle of the board then there also are breaks in the horizontal bus and you may not be getting power to pins 1 and 2 of your display.

Don

From reply #5:

The following link gives you an alternative wiring and especially refers to a Mega and a 16x2 LCD display:

His wiring leaves a bit to be desired.

Even more troubling is the contents of loop() in his second example:

void loop()
{
  lcd.clear();
}

Don

floresta:
AARRGGHH Why don’t you twist the yellow wires together to make them even harder to follow?

In order to compare your wiring with your constructor we have to be able to unambiguously follow each wire from one end to the other.

Also - it’s hard to see if the blue and red lines that are printed on your breadboard are continuous from one edge to the other. If there are breaks in the lines near the middle of the board then there also are breaks in the horizontal bus and you may not be getting power to pins 1 and 2 of your display.

Don

I rewired the circuit and joint a photograph. For the continuity of + and -, I add a led at the left side and the +5 gnD at the right side and checked then the continuity.

Your wiring "looks" fine. It should work with the sketch in message #3.

Note that Chinese jumper wires are not always "perfect". I suggest that you test each jumper wire with a DMM before you use it.

If you don't have a DMM, you can just test the jumper continuity with your LED+resistor.

David.

A checked all the wiring, I saw that many of the wires that are supplied in my kit are defectives. I succeed when changing some wires to have 2 lines of solid rectangles. As said rtp007, 90% of troubles are in the wiring. I will send some new after I solved all this. Thank you again for your help.

SOLVED ! That is running fine after changing five défective wires ! The wires supplied in my kit are Junk.

Thank you all for your help and happy new year.

PS, I don't know how to set a forum topic as solved

Congratulations!

So the old year ends with a big success and progress. Happy New Year to all readers and have a successful New Arduino 2017.

I think you as the starter/owner of this thread can edit the headline and add the SOLVED mark here. If I am not right I am sure somebody else will tell us how this is done.

PS, I don't know how to set a forum topic as solved

You may have to go back and edit your original post and do it there. When you figure it out let us know.

Don

floresta: You may have to go back and edit your original post and do it there. When you figure it out let us know.

Don

That's it, done...