Problem: Arduino & LCD with KS0066 / SPLC780

Hi Folks!
Hope you can help me! I've got a Problem with my LCD 20 x4 Display. I wired it up as explained on the adafruit website ( Arduino Tutorial - connecting a parallel LCD)
But it doesn't work. The Backlight and the "Blocks" are visible, but I don't get any message to the LCD. I already tried some othere libraries like the LCD4Bit but it didn't wor either. I now found out, that the display hasn't the HD44780 Chip but an other which is almost the same. I found the data sheet here:
http://www.yaoyu-lcm.com/english/admin/Software/20086171462569145.pdf

Could you please help me to fix this problem?

(sorry for my bad english, I quit school some years ago :D)

greetings kuhni

You should have had two rows of blocks on a 20x4 display.

I hope you didn't miss this line - it's several lines below the photo of the 'blocks', just above the next photo. "As mentioned, we'll not be using the RW pin, so we can tie it go ground. That's pin 5 as shown bere:" Connecting this pin to GND is not optional as the word 'can' implies, it is necessary.

If that is not the problem then we will need a cut/paste copy of the actual code you are using along (not a link to the code that you think you are using) with a photo that clearly shows the LCD <--> Arduino connections. Forget about LCD4bit.

Don

This is the code I used. The Hello World example. I only changed the 16, 2 to 20, 4 .

/*
  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 8 Feb 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(12, 11, 5, 4, 3, 2);

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

Setup is exactly the same as mentionned in the code explanation:
RS to 12
E to 11
D4 to 5
D5 to 4 ...

I see two blocks with one empty line between. Don't tell me about the wireing of 5v and GND, the pins are switched (see the link of the datasheet, I posted before)

Imgur

Here you can see pictures I made from the Arduino wireing. Hope you can help me! :cry:

greetings Kuhni

Don't tell me about the wireing of 5v and GND, the pins are switched (see the link of the datasheet, I posted before)

This part does have me confused. Your LCD controller obviously has the correct power applied otherwise you would see smoke instead of blocks. Your backlight also appears to be on. According to your datasheet pin 1 is the ground (-) for the LCD controller and pin 2 is VDD. This is the normal connection (there are some modules where these are reversed) and you wiring looks correct. Your datasheet also says that pin 15 is the backlight positive terminal, but you have it connected to GND. Similarly the datasheet says that pin 16 is the backlight negative terminal, but you have it connected to +5V.

I am assuming that you can vary the intensity of the blocks from very dark to very light which would verify that pin 1 is near the outside edge of the board which is the normal configuration. What happens if you disconnect one of the green backlight wires?

I cannot follow the four data lines in your photo. Try using different color wire or spread them apart so they can be followed.

Are you sure your sketch is being downloaded properly. You could add some steps to turn the LED at pin 13 ON at the end of setup to check this out.

Don

What happens if you disconnect one of the green backlight wires?

The backlight turns off ;).

Now I changed the wires so everybody will be able to follow them :smiley:
Imgur

I also added a "blink code" to verify the correct uploading--> it works! (the LED! not the LCD :frowning: )

Here's the new 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 (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 8 Feb 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(12, 11, 5, 4, 3, 2);

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

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  digitalWrite(13, HIGH);
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
  delay(500);
  digitalWrite(13, LOW);
  delay(500);
  
}

[edit]I found the Datasheet in the net. On the back of the LCD there is the "Code": YM2004A, so I searched for this code and found the Datasheet i posted in the link.[/edit]

Now I changed the wires so everybody will be able to follow them

Maybe everybody except me.

I've had problems similar to this one where everything seemed to be connected properly using known good code and still the device didn't work. I tracked it down to a poor connection on the solderless breadboard. I suggest that you pull all the wires out and start again using a different part of the breadboard. While you are at it you can reassign the pins, as Lady Ada did, so the LCD wires align nicely with the Arduino without having to cross over one another.

Don

So, to get a better view, i turned the breadboard 180° and wired everything again. Just changed the wireing in the 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 (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 8 Feb 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(2, 3, 9, 10, 11, 12);

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

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  digitalWrite(13, HIGH);
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
  delay(500);
  digitalWrite(13, LOW);
  delay(500);
  
}

Aaaand at last: A picture of the tidied wireing :smiley: :

Imgur

and still nothin works... :cry: What else can I do to may fix it? I already asked the LCD wheter it will work as a christmas present, but it didn't wanted to... damn!

greetings kuhni

It's got to be something simple that we are overlooking. I still suspect a bad connection between the Arduino and the LCD so now it's time to get out the magnifying glass and check the solder connections on the LCD pins. Look for poor joints and for bridges (shorted pins).

The reversed backlight connections that seem to work OK still bother me as well.

Also, you never commented on this (from reply #3)

I am assuming that you can vary the intensity of the blocks from very dark to very light

Can you measure the voltage between GND and pin 2 as well as between GND and pin 3?

Don

I already checked the soldering before I started programming the arduino. Pin 16 wasn't soldered that good, so I wired it again. I checked the other pins by using the "diode" test of my multimeter (one Pin to the soldered Pin, the other to the board. All pins are soldered well).

That's right! By using the Potentiometer, I kan vary the intensitiy of the blocks from very dark to very light. I read of some Problems if the contrast isn't adjusted properly. But I am able to adjust the contrast and tried already all "positions" :slight_smile:

The voltage of GND and Pin 2 is between 5,00V and 5,02V.

GND to Pin 3 is between 0V and 5V regulated by the Potentiometer. The "best legibility" is around 0,35V (the contrast isn't to high, and the blocks are already visible).

There are also no bridges between pins :-/

Slowly I'm getting despaired!

What else can I try to fix this damn problem?

We are back to this "The reversed backlight connections that seem to work OK still bother me as well."

That type of display is almost, but not impossible, to view without the backlight. Try disconnecting both backlight wires and see if you can discern anything on the display when you run your sketch.

Don

so... disconnected pin 15 and 16... aaand: still 2 rows of blocks visible... nothing less, nothing more... :frowning:

really baaad! >:(

Anyone an Idea what else I could do to fix the problem? Don't wanna expend another 22 Bugs on a new LCd... :-/

greetings kuhni

I don't know what happened to all the other LCD guru's. I'm still thinking about it. It almost has to be something to do with one or more of the six data lines between the Arduino and the LCD.

Don

I also tried this code to bar a mistake of the lcd library:

http://webcache.googleusercontent.com/search?q=cache:iXmbLbXGIIkJ:www.arduino.cc/en/Tutorial/LCD8Bits+arduino+8+lcd&cd=3&hl=de&ct=clnk

Your display of two rows of blocks is an indication that the LCD is not properly initialized. This could be due to a wiring problem or a code problem.

I just can't understand why virtually every LCD program author decides that they should deviate from the initialization sequence given in the datasheet. The code you referenced is another example of this, and it's worse than most.

Follow the LCD Initialization link at http://web.alfredstate.edu/weimandn, scroll down to the section on 8-Bit Interface, Initialization by Instruction, and compare it to the code you tried.

The LiquidCrystal library isn't totally correct either and that could possibly be your problem, but it's not likely.

Don

I think the problem is, that the LCD I own seems to have an KS0066 controller but it isn't the LCD mentionned in the datasheet. I have to switch the contacts 15 and 16... Also there is a Timing Diagramm printed, but no exactly times mentionned... So what do you think? What do I have to change in the liquidcrystal library to may make it work? (or to exclude a sofware mistake)

greetings kuhni

Also there is a Timing Diagramm printed, but no exactly times mentionned...

The times are given in the datasheet for the controller, but not always in the datasheet for the module. If you don't have the specific datasheet for your controller then use the one for the 44780 (www.sparkfun.com/datasheets/LCD/HD44780.pdf).

So what do you think? What do I have to change in the liquidcrystal library to may make it work?

Nothing. You might want to try downloading a new copy of the Arduino IDE which will include a new copy of the library. We are really grasping at straws here but it's worth a try. You will probably wind up needing another LCD module, from a different supplier, to pin down the problem.

Don

Hmm... Now tried a new copy of Arduino... Didn't solve the problem, damn! Any other idea, or should I now hav a look on ebay for a new module? :cry:

greetings kuhni

hav a look on ebay for a new module?

That might be your problem right there. I wouldn't choose one of those for my first attempt at using an LCD. Once you have your connections and code verified it would be ok.

Don

Perhaps you should try hard coding it without using the library... it seems to be something with the data / rs lines... did you check continuity on these lines between the controller & the LCD?... i've had similar problems but it was always the connections.....or the way they fit on a breadboard...