Need help with Graphic LCD

Hi,

I'm having trouble getting my graphic lcd to work correctly with my Arduino. The LCD is a model GDM12864H from Sparkfun and I'm using it with a Duemilenove and the ks0108 library.

I am seeing streaked vertical lines on the LCD. Here's a picture of what it looks like:

Imgur

Here's a couple more shots of the way it's wired up. I've checked this a couple times now.

Imgur
Imgur

I am using the same Arduino sketch as a previous project when it was working fine.

Anyone seen this issue before? I've run out of ideas to try and fix it

Are you using the v3 library or the v2 ks0108 library?
Make sure to use the v3 library.

As far as what you are seeing,
I can't really tell much about the wiring in the photos, but
I've seen all kinds of very odd things on glcds, including things like
what you are seeing. Usually it is a wiring issue but
occasionally it is a bad GLCD, sometimes caused by improper wiring.

That type of pattern you have
I've seen when the glcd is not being reset or initialized properly.

Review the wiring.
Usual suspects for wiring errors:

  • improper contrast pot wiring.
  • wiring the glcd backwards (pins 1 & 20 reversed)
  • incorrectly wired pins between glcd and Arduino.

Then run the diags sketch and post the serial output here.

--- bill

Thanks, Bill.

I was using the v2 library, but I updated my sketch to use v3 and I still have the same result.

I've reviewed the wiring one more time and didn't find any errors. However, I neglected to mention in my original post that I am having trouble with reset. When the panel's reset is connected to the arduino reset pin, I am unable to upload the sketch to the arduino and I get this error:

avrdude: stk500_recv(): programmer is not responding

To get around this, I tied the panel's reset to +5v (normal). The the sketch uploaded fine after that. The error is a bit vague and I searched for a solution but didn't find one.

Here's the output of the diags sketch:

Serial initialized

Reported Arduino Revision: 22

GLCD Lib Configuration: glcd ver: 3 glcd_Device ver: 1 gText ver: 1
GLCD Lib build date: Sat 04/23/2011 15:01:49.03
GLCD Lib build number: 421
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
Displaying ChipSelect Screens
Walking 1s data test
Wr/Rd Chip Select Test
Testing GLCD memory pages
Horizontal Page Test Chip: 0 Pixels 0-63
Vertical Page Test Chip: 0 Pixels 0-63
Horizontal Page Test Chip: 1 Pixels 64-127
Vertical Page Test Chip: 1 Pixels 64-127
Full Module Horizontal Page Test:Pixels 0-127
Full Module Vertical Page Test:Pixels 0-127
Tests PASSED
GLCD.SetDot() speed (K ops/sec): 14.1

The output on the LCD is still a mess of vertical streaks.

-- michael

michael,
The diags have passed which means that all the data and control lines are hooked up properly
and the AVR can talk to the glcd and its memory. That only leaves a few glcd pins and mainly the contrast circuit.
That error "avrdude: stk500_recv(): programmer is not responding" is not very useful.
All it means is that avrdude is not communicating with the bootloader. This can happen
for many reasons. But with Arduino bootloaders, it usally means the autoreset is not
working properly.

I went back and looked at your photos.
The reset connection issue bothers me. The reset pin on the glcd is an input and
should not cause any problems when connected to the Arduino reset pin.
Some glcds will not function properly without getting a clean reset signal during or after powerup.
They can do all kinds of wonky things.
We'll come back to this a bit later.

What is going on with the 2 resistors and the button on the right side of the breadboard?
What arduino pin does it go to?
Is it a button input with a pull down on it?

I can't tell how the contrast pot is wired up.
How do you have the contrast pot wired up and what value pot are you using?
one leg should go to pin 18 (Vee) on the glcd
on leg should go to either gnd or VCC. (normally gnd is ok, but this datasheet shows VCC)
The wiper (middle connection) of the pot should go to pin 3 (VO) on the glcd.

As far as display output goes, does it flicker at all when the diags is running?
does it change when you move the pot?

Now back to reset. If the wiring for the contrast pot was correct and connecting the reset
glcd pin 14 to the arduino reset does not work, you can have the glcd library do a reset in software.
To do this you must edit a glcd library file.
Edit the arduino ks0108 pin configuration file. It will be glcd/config/ks0108_Arduino.h
look down near the bottom and uncomment the line with #define glcdRES on it.
This will turn on the code in library to use that pin (d19/A5) for reseting the glcd under software control.

--- bill

As you guessed, the two resistors on the right are just a pulldown for a button input on D3. My sketch is a simple GPS display and the button cycles between different screens of information.

I can see things flickering and moving during the diags sketch (and when I change screens in my sketch). The contrast pot is wired correctly and works as expected.

The reset seems to be happening properly now using the handy feature in the new library. At least I assume it's working since the upload is working without error and the display clears and cycles during restart.

But still no luck. Still have the vertical streaks.

I have lots of questions.

Was this same display working correctly in the past?
(I couldn't tell from your initial post)

Silly question but do your power rails on your breadboard
run all the way across?
Some breadboards don't connect between the individual sections.

Was the display ever miswired even temporarily?
Specifically on the contrast pins (pins 3 and 18)?
(hooking pin 18 even momentarily to gnd or vcc can fry the onboard Vee negative power supply)

What value pot are you using?

Describe more of what you mean by:

The contrast pot is wired correctly and works as expected.

The reset seems to be happening properly now using the handy feature in the new library. At least I assume it's working since the upload is working without error and the display clears and cycles during restart.

So for clarity, there are 3 wires on the pot, 1 end is to 5v, 1 end is to Vee (glcd pin 18), and the middle
wire is going to Vo (glcd pin 3)?

Note: for this next part don't turn the pot all the way, just enough to get the result.
If the contrast pot is working as expected, when you turn it one way all
pixels disappear and the other way they all turn black no matter what the glcd controller
and glcd memory are doing.
Is this happening?

Are you now using the software reset using pin 19?
What do you mean by "display clears and cycles during restart"?

Can you measure a few voltages?
(be very careful not so short out the adjacent pins - its easy to accidentally slip off a glcd pin)

From gnd to VCC as measured at the GLCD. (between glcd pins 2 and 1)
Now remove the wires on glcd signal Vo (pin 3) and Vee (pin 18)
Measure the voltage between gnd and the Vee output (pin 18).
(It should be negative 6 to 10 volts)

Now hookup the contrast pot again.
Measure the voltage from gnd to Vo (pin 3)
This again will be negative when you can see
the pixels but will vary depending on the contrast setting.
I just measured 2 different displays and 1 was -2.5v (green/yellow background with black pixels)
and the other was -6.5v (blue background with white pixels)

--- bill

Hi Bill,

First of all -- thanks for your help here. I really do appreciate it. I recognize that it takes some time to think this through and I appreciate your patience while I'm learning about this stuff. Now, on to your questions....

Yes, this is the same LCD that I have used successfully in the past and my breadboard's power rails go all the way across the different sections.

I don't believe I have ever hooked up glcd pin 3 and 18 incorrectly. It's possible that I had the data pins mixed up for a short period. The reset pin is probably the most likely to have been wired up incorrectly at some point. I'm sorry, but I'm just not certain about this.

I have the trim pot wired exactly as you describe. One end to 5v power, middle to V0 (pin 3) and the other end to Vee (pin 18).

When I move the trim pot one direction all the pixels disappear. When I move it the other way, it doesn't fill every pixel on the whole display with dark pixels. Just the streaked vertical lines get darker and outside of the streaked lines is still clear.

I am now using Arduino pin 19/A5 as the reset signal. When I reset (either by uploading a sketch or just pressing the reset button on the board) the display clears while it starts up. The backlight doesn't go off but I see no pixels. My sketch prints a short welcome message to the serial connection at the start of the setup() function, and the display remains clear until the moment I see that message appear in the Arduino serial monitor. At that point I see the streaks.

Here are the voltages I measured:
GND to VCC (between glcd pin 2 and 1 respectively): 4.99v
GND to Vee (with the contrast pot disconnected): -4.31v
GND to V0 (with the contrast pot hooked up): from +4.99 to -4.07. I can see the pixels on screen while the voltage is between 0.00v and -4.07 range.

-- Michael

hmmm. Everything seems ok. It's starting to look like a glcd issue.
The diags are passing which means all the digital logic is working.
(Handshaking, read/writes/cmds/status to the glcd). For some reason
the module isn't displaying the pixels.

The voltages all look ok. Normally, all the pixels should go black when you
adjust the constrast pot to one side.

I'm not quite following what you mean by "the display clears while it starts up".
Are you meaning that you dont see any type of "streaks" at first?
And then what do you mean by: "I can see the pixels on screen while the voltage is between 0.00v and -4.07 range"?

Is it possible that the module was dropped or subject to any stresses?

What about if you disconnect the backlight does that change the pixels any?

One thing to try is to lightly press on the actual display. When you do this, do you see
any of the normal pixels?

While I've never run into a reset timing issue on any glcd modules so far,
one thing we can try just to rule out any reset timing is to increase the reset delay a bit
before sending the "turn on display" commands.
(If these are sent too soon, the module will not enable any of the pixels)

To do this you will want to edit the file glcd/glcd_Device.cpp

Look for a section of code that looks like:

#ifdef glcdRES
	/*
	 * Reset the glcd module if there is a reset pin defined
	 */ 
	lcdReset();
	lcdDelayMilliseconds(2);  
	lcdUnReset();
	lcdDelayMilliseconds(10);
#else

Change that lcdDelayMilliseconds(10) to lcdDelayMilliseconds(500)

This will change the delay from 10ms to .5 seconds which should be
way more than enough.

Then run the diags again and see if that changes anything.

Check the serial output and make sure you see that it prints a pin value for "RES".

--- bill

Yes, when I wrote "the display clears while it starts up", I meant that I don't see any black streaks at first during startup. No pixels, just the green backlight.

When I turn the contrast pot (and the voltage varies) the streaks are darkest at -4.07 and barely visible at about 0.00v. If I continue to turn the pot further the streaks disappear and all I see is the green backlight.

I didn't drop it. The worst treatment it received was being loose in my parts box for while. Pressing on the screen or the back didn't make the pixels appear correctly.

Disconnecting the backlight doesn't change the streaks. They are still there, just not backlit.

I changed the reset timing as you indicated. I did notice a slightly longer delay between startup and the streaks appearing. The serial output confirms RES: 19(PIN_C5). No change to the streaks, however.

Maybe the glcd is just broken. I could use a second one for another project anyway, so at this point I'll probably just order another one and swap it out to see if that fixes it.

-- Michael