I just got a LCD that I want to connect to Arduino.
I have follow LadyAda Tutoria and got the LCD open (I see the red blacklight glowing). The problem is that I see not character. Only the last row has some square that appear.
The LCD is exactly like this figure:
I have connect the
Pin16 to Ground
Pin15 to the 5Volt
Pin14 to 11 connected to Arduino Pin 12 to 9
Pin6 to 8 Arduino Pin
Pin5 to the Ground
Pin4 to Pin 7 of Arduino
Pin3 to the ground but with a Resistant of 1kOhm (direct to the ground does the same thing but more bright)
Pin2 to the 5Volt
Pin1 to the Ground.
The last few hours has been to search what's wrong and I can't find!
I have downloaded the version 0.18 of Arduino and the code I use is :
#include <LiquidCrystal.h>
// LiquidCrystal display with:
// rs on pin 7
// enable on pin 8
// d4, d5, d6, d7 on pins 9, 10, 11, 12
//LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
//http://www.ladyada.net/learn/lcd/charlcd.html
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
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:
lcd.print(millis()/1000);
}
To adjust the contrast, you need a pot on pin3 of the LCD. Its in the tutorial, but not in your description. The pot/trimmer wired as in the tutorial is crucial. Hooking it to ground via a resistor is not the same thing. The idea is it needs a voltage on there to get the contrast right, once you've established what it needs, it could be achieved with a fixed pair of resistors wired as a voltage divider.
while I would always recommend starting with a potentiometer on a breadboard, the way you describe using a 1K resistor works with a large fraction of LCDs and once you've tested that it works on the breadboard, soldering it directly across the pins of the LCD is quite handy if you keep the leads short. It may not quite give optimum contrast but for many LCDs it is close to the optimum. I plug LCDs into the extra row of pins on a Mega and when I can wire the LCD up this way I don't need any extra connections at all.
the first LCD I bought came from hacktronics with instructions to wire it up this way. My electrical engineering knowledge is too rudimentary for me to have much of an idea WHY this works. presumably there's a little current leak or something that completes the voltage divider circuit in the LCDs this works for.
Have you tried adjusting the contrast? It looks like maybe it needs to be toned down a little.
Try adjusting the contrast...
These are good ideas if the display is blank or if the display is displaying information on both lines but the information is hard or impossible to read.
Since your two line display is displaying a row of blocks on the first line it means that the power is applied correctly and the contrast is usable (but maybe not optimum). You have a problem with the either program or with the Arduino connections.
Since the program is known to work then you must have a problem with your connections. Since the list of connections that you gave matches those in the program code then you may have connected them improperly. Did you notice that Lady Ada uses different color wires for each of her connections? That makes the troubleshooting much easier.
First make sure that the R/W line (LCD pin 5) is really grounded.
... try reversing the 4 data pins.
This may well fix your problem, otherwise is time to remove all six wires between the LCD module and the Arduino and carefully reconnect them.
If that doesn't work then you could try using a different area on your breadboard. Sometimes some of the connections fail on these inexpensive breadboards.
I have used a potentiometer of 5k and I can adjust the brightness. I see the second line with squared block. Nothing in the first line and no character displayed yet.
I think I will remove all wires (I already did that twice without success) and start from scratch again. Thank you for the answer, if you have any ideas feel free to write, I'll be on this case all night!
I see the second line with squared block. Nothing in the first line
When you get it working you will find that your characters are upside down and they are appearing from right to left. That's another way of saying that you are looking at the display upside down!
I have try something else. I see that in the LiquidCrystal.h that it has multiple constructor so I decided to use the one with all pins. I removed all the wire and start from the beginning.
In the LCD I can see "JHD 162A" This might not be 100% compatible with Hitachi HD44780. I'll continue to search, I have seen some thread in this forum about it, most wasn't able to make it works too!
I have try what been shown in this page since a lot of post from this forum was linked to it : http://www.skpang.co.uk/content/view/29/42/ But it doesn't work event if I modify the .cpp to get the good pins.
I am totally lost. Does it means that the LCD I bought, the JHD162A is broken or it's me that I do something wrong? How can I know is it damages or not? :-/
Don't give up yet. Your JHD162A appears to be compatible as far as I can tell.
Please redo your connections so that they are nice and neat - similar to the ones shown with the Adafruit tutorial.
Post a photograph that clearly shows all the connections between your LCD module and the Arduino board.
Post the code that you used with the connections in the photograph.
Make sure you are using the LiquidCrystal library provided with Arduino v0018 and that you have NOT modified any of the associated files. Download a new version if you are not sure.
The SK Pang page is where I started, its simple and it works, I soon ditched the old 4bit library because the included LiquidCrystal library is much better. It works with the same circuit by adjusting the pin numbers it the sketch. All the LCDs I use are cheapos off Ebay, Most of the time, problems on here with LCDs are wiring related.
You could try duplicating them at the other end and shifting the LCD up two spots on the breadboard.
His power and contrast connections are obviously correct since he gets the display of 'blocks'. Since he has identified those pins correctly the others are probably where he expected them to be as well.
OK, I had solder pin to be able to connect to my bread board and some of them are not very strong. I will redo the soldering to those and rewire everything when I come back from work. I will make this thing work by the end of the weekend, I won't give up yet
The code is exactly the one from the example folder of Arduino 0018 HelloWorld:
/*
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 (http://www.ladyada.net)
example added 9 Jul 2009
by Tom Igoe
modified 25 July 2009
by David A. Mellis
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(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:
lcd.print(millis()/1000);
}
Your picture does not clearly show the LCD connections but from what I can see the yellow and green wires seem to be connected to adjacent LCD pins. The green wire (R/S) should connect Arduino pin 12 to LCD pin 4. The Yellow (E) wire should connect Arduino pin 11 to LCD pin 6. LCD pin 5, which should be between the yellow and green wires, must be connected to ground.
Oops - I just saw the link to the full-size picture and now I see that there is a wire between the green and yellow wires and it seems to be correctly grounded. I still cannot verify the correct LCD pin numbers for those wires.
I doubt that the LCD module is defective since it does display the 'blocks'. I am more inclined to believe that there is a bad connection in one or more of the six wires between the Arduino and the LCD module.