Not able to get graphic LCD to work with Uno

Hello,

I have an arduino uno and wanted to use the graphic LCD JHD12864E. My further plan is to port the same code to an ATmega32 or similar, but that is not the issue right now.

I am using the library suggested in the playground page here Arduino Playground - GLCDks0108. The LCD has s6b0108 controller in it, and its compatible with the KS0108, on a youtube video they suggest that we use panel B for this lcd. I uploaded the sketch to the arduino but cannot for the life of me get anything to print on it. It just remains blank. What may be the problem? Have tried the troubleshooting page to no avail.

Have you soldered a pot, contrast adjustment? I couldn't see on my LCD till I start to rotate this pot.

Magician:
Have you soldered a pot, contrast adjustment? I couldn't see on my LCD till I start to rotate this pot.

Yes I did, that didn't help.

I tried the GLCDdiag sketch on my board and got this output repeatedly (tried upto loop 10)

Serial initialized
--------------------------------------------------------------------
Reported Arduino Revision: 1.3
--------------------------------------------------------------------
GLCD Lib Configuration: glcd ver: 3 glcd_Device ver: 1 gText ver: 1
GLCD Lib build date: Mon Dec  5 01:50:07 CST 2011
GLCD Lib build number: 442
Panel Configuration:ks0108
Pin Configuration:ks0108-Arduino
--------------------------------------------------------------------
GLCD:ks0108 DisplayWidth:128 DisplayHeight:64
Chips:2 ChipWidth:64 ChipHeight:64
 CSEL1:14(PIN_C0) CSEL2:15(PIN_C1)
 RW:16(PIN_C2) DI:17(PIN_C3) EN:18(PIN_C4)
 D0:8(PIN_B0) D1:9(PIN_B1) D2:10(PIN_B2) D3:11(PIN_B3)
 D4:4(PIN_D4) D5:5(PIN_D5) D6:6(PIN_D6) D7:7(PIN_D7)
Delays: tDDR:320 tAS:140 tDSW:200 tWH:450 tWL:450
ChipSelects: CHIP0:(14,0x1, 15,0x0) CHIP1:(14,0x0, 15,0x1)
Data mode: 
 d0-d3:nibble mode-Non-Atomic
 d4-d7:nibble mode-Non-Atomic
--------------------------------------------------------------------
Diag Loop: 1
Initializing GLCD
GLCD initialization Failed: BUSY wait Timeout (status code: 1)
--------------------------------------------------------------------
Reported Arduino Revision: 1.3
--------------------------------------------------------------------
GLCD Lib Configuration: glcd ver: 3 glcd_Device ver: 1 gText ver: 1
GLCD Lib build date: Mon Dec  5 01:50:07 CST 2011
GLCD Lib build number: 442
Panel Configuration:ks0108
Pin Configuration:ks0108-Arduino
--------------------------------------------------------------------
GLCD:ks0108 DisplayWidth:128 DisplayHeight:64
Chips:2 ChipWidth:64 ChipHeight:64
 CSEL1:14(PIN_C0) CSEL2:15(PIN_C1)
 RW:16(PIN_C2) DI:17(PIN_C3) EN:18(PIN_C4)
 D0:8(PIN_B0) D1:9(PIN_B1) D2:10(PIN_B2) D3:11(PIN_B3)
 D4:4(PIN_D4) D5:5(PIN_D5) D6:6(PIN_D6) D7:7(PIN_D7)
Delays: tDDR:320 tAS:140 tDSW:200 tWH:450 tWL:450
ChipSelects: CHIP0:(14,0x1, 15,0x0) CHIP1:(14,0x0, 15,0x1)
Data mode: 
 d0-d3:nibble mode-Non-Atomic
 d4-d7:nibble mode-Non-Atomic
--------------------------------------------------------------------
Diag Loop: 2
Initializing GLCD
GLCD initialization Failed: BUSY wait Timeout (status code: 1)
--------------------------------------------------------------------
Reported Arduino Revision: 1.3
--------------------------------------------------------------------
GLCD Lib Configuration: glcd ver: 3 glcd_Device ver: 1 gText ver: 1
GLCD Lib build date: Mon Dec  5 01:50:07 CST 2011
GLCD Lib build number: 442
Panel Configuration:ks0108
Pin Configuration:ks0108-Arduino
--------------------------------------------------------------------
GLCD:ks0108 DisplayWidth:128 DisplayHeight:64
Chips:2 ChipWidth:64 ChipHeight:64
 CSEL1:14(PIN_C0) CSEL2:15(PIN_C1)
 RW:16(PIN_C2) DI:17(PIN_C3) EN:18(PIN_C4)
 D0:8(PIN_B0) D1:9(PIN_B1) D2:10(PIN_B2) D3:11(PIN_B3)
 D4:4(PIN_D4) D5:5(PIN_D5) D6:6(PIN_D6) D7:7(PIN_D7)
Delays: tDDR:320 tAS:140 tDSW:200 tWH:450 tWL:450
ChipSelects: CHIP0:(14,0x1, 15,0x0) CHIP1:(14,0x0, 15,0x1)
Data mode: 
 d0-d3:nibble mode-Non-Atomic
 d4-d7:nibble mode-Non-Atomic
--------------------------------------------------------------------
Diag Loop: 3
Initializing GLCD
GLCD initialization Failed: BUSY wait Timeout (status code: 1)

Is it a shield or stand alone LCD?

Post your code and images of how you have it connected and list of which LCD pins go to whih Arduino pins.

Anyone that is going to try and help you need to know where you are starting from.

No its just the LCD. I am following the connections as given in the playground page here Arduino Playground - GLCDks0108, if you look down the page there is a table, I am following the panel B column.

The code is as included in the library examples folder. The example is called GLCDdiag, you can look at the code here. Google Code Archive - Long-term storage for Google Code Project Hosting.

But I have also tried the hello world program, that doesn't work too. Google Code Archive - Long-term storage for Google Code Project Hosting.

When I see the signals through a scope all the lines are high. Maybe I need a resistor to pull up. Is there a way I can send a command so that I can turn off the lcd so instead of 0x00 status I will recieve a 0x20 status.

Have you soldered a pot, contrast adjustment? I couldn't see on my LCD till I start to rotate this pot.

Yes I did, that didn't help.

Did you feed one end of the pot from a negative power supply? This supply is typically provided at pin 18.

Don

tack:
...
Post your code and images of how you have it connected and list of which LCD pins go to whih Arduino pins.
...

You have done none of this. You have instead posted links to what you are attempting to do, not what you have actually done. We have to see if you have interpreted the information properly.

Don

Okey, okey. Maybe I am confusing everyone. Lets keep it simple, right now I am using the hello world sketch which is something like this.

// include the library header
#include <glcd.h>

// include the Fonts
#include <fonts/allFonts.h>

void setup() {
  // Initialize the GLCD 
  GLCD.Init();

 // Select the font for the default text area
  GLCD.SelectFont(System5x7);

  GLCD.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):
  GLCD.CursorTo(0, 1);

  // print the number of seconds since reset:
  GLCD.print(millis()/1000);
}

Here is a video of me tweaking the pot to change contrast, and sadly nothing happens. - YouTube

Here are some pictures of the board

Another thing I tried was to just read the D7 pin of lcd connected to the pin 7 of the arduino and send over serial like this.

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Serial.println(digitalRead(7));
}

Even then it always reads 1 in my terminal.

What are the pin numberings on your device? Left to right in your picture or right to left?

It's very difficult to make out anything but it looks like the wiper of your trimmer goes to the third pin from the right. It is supposed to be pin 3 so, if that one connection is correct then the pins are numbered right to left.

If I am correct on that the it also looks like the rightmost pin (pin 1) goes to A0, when it should be one of your supply lines

If I'm wrong on the numbering then your trimmer wiper should go to the 3rd from the left.

Like I say, all difficult to make out as your the wiring is all the same colour and a complete mess.

EDIT: I should have watched the video first. It looks like contrast adjustment is fine working, so set that up to just off fully dark for a start. All of the connections are very similar to a standard character based display, RS,RW,EN,D0-D7 plus a few extra ones. Carefully double and triple check all your connections, even if that means pulling them all out and starting again. There are a lot of wires there and it's most likely you have made a wiring error somewhere.

I think the yellow wire is in the wrong place.

In other words, we have to be able to unambiguously follow each wire from the display to the Arduino. This typically means a nice neat layout, preferably with wires of different colors.

We also have to be able to determine if you have properly soldered the wires to your display.

Don

I am telling you guys, all the lines are perfectly soldered and in the correct place. I have ripped them out and rewired it like 15 times and double checked with a dvm continuity test every time.

Then it should be working. :wink:

The library has been thoroughly tested on many different glcds, so it is unlikely to be a library problem.

Having written the glcd library initialization code, the diag sketch,
and worked with MANY users of the library, I can tell you that
99+% of the time, the problem is incorrect wiring or wiring issues.
Of the remaining non wiring issues, it is a bad glcd.
And when the GLCD is bad, it is almost always due to previous incorrect wiring.
And of the glcds that were bad, the majority would still pass diagnostics, they just
wouldn't display any pixels because the negative power supply needed for the
contrast circuit was blown.

I can also say that in the vast majority of the cases, the users believe that their wiring is correct.

My recommendation is to stick with the diag sketch until things start working, it is the best tool for trying to diagnose the problem.

During initialization, the library code will first check for 2 things.

  • the glcd to indicate that its internal RESET is complete
  • the glcd is ready to accept a command.

In that order.

What you are seeing from the diag output is that the library gave up waiting for the glcd to say
it is ready to accept a command so the library never even tried to initialize the glcd.
That means that the status bit for BUSY is not transitioning low. This is bit 7 on the data bus.
NOTE: without initialization, no pixels will show up, so turning the pot will have no effect.
Also, reading the ks0108 busy status of the LCD is more complex than simply reading data bit 7
so doing a digitalRead() on pin 7 isn't providing any useful information.

This BUSY timeout condition is more than likely caused by:

  • incorrect chip select configuration in the config file.
  • bad wiring
  • bad glcd.

From looking at the datasheet, it appears the the glcd you have is compatible with the default
chip select configuration which can be seen in the diag output.
CSEL1=1, CSEL2=0 for chip 0 and CSEL1=0, CSEL2=1 for chip 1

That tends to point to a wiring issue.
Wiring issues can be either incorrect wiring, or wires not making proper connections.
In order to work, your wiring for the data and control lines
must match the wiring indicated in output from the diag sketch.
For the other glcd and pot connections, it must be wired according to the documentation
on playground page, or included HTML or PDF files.

It is very hard to tell how things are wired given the blurry photos and all
the wires are the same color.

From the datasheet I can tell the pin 1 should be in the right or along the top of pins
in your photos.
It is VERY hard to tell where the wires are going and it is impossible to tell the quality of the
soldering.

While I can't really tell where the wires go,
there are some things that look suspicious.

In the 2nd photo, I can't see any wire connections going to glcd pins 18 (Vee) and 17(RST)
In the 1st and 2nd photo, it looks like some Arduino digital pin (around 13 or so)
is hooked to glcd pin 20 which according to the datasheet is backlight ground.
The pot doesn't look like it is hooked up correctly. One leg should be going to Vee
but in the photo it looks like it is hooked up to the backlight +voltage input.

Can you take some clear photos so we can see where the wires go?
Use macro mode to get clear images. We need to be able to tell where each wire goes.
A clear photo of the back would be nice to verify the glcd module type and
to have a look at the soldering.

Also, can you indicate how you have wired up everything?
which Arduino pins are connected to which glcd pins and
what is connected to each of the pot connections.
Also what is connected to the other glcd pins that don't connect
to arduino pins.
(all 20 glcd pins should be connected to something)

--- bill

At about 8s into the video the screen goes dark and then light again. That looks to me like the contrast trimmer is doing it's job, but it's done so fast it's hard to see.

Comparing to the examples it also seems the display is upside down in the OP's photo's. The most common mistake would be getting the position of Pin1 wrong and working from that.

It's all difficult to follow though. A drawing showing the row of LCD connections, with which pin each has been taken to, would be useful for an independent verification of whether the wiring is correct.

We all sit and stare at problems where we're convinced we've wired everything correct or coded it correctly, until suddenly we notice the problem or someone else looks and sees it straight away.

I.... I have ripped them out and rewired it like 15 times and double checked with a dvm continuity test every time.

And if you have misinterpreted something you probably have done so consistently, every time.

Don