LCD Corruption

hi guys, im brand new to arduino and also this forum. im sure this issue has come up before, but thanks in advance for any advice.

Problem: i have wired my arduino just as its showed via the example for "hello world" (lcd) on the arduino site, and have directly copied and pasted the code as well just to test out my lcd screen. my lcd works well for the first 9.9999999 seconds, however, as soon as the counter strikes 10 seconds on the lcd, the lcd begins to have stripes in the prinotout, and then turns into unidentifiable characters and question marks. The backlight also goes between light and dark every few seconds. ive been looking through different forums to see if i could find a solution however i havent been sucessful.

any help would be much appreciated!

thanks
Zack

Hi Zack,

Welcome to the Arduino community!

I think I know what the problem is but let's "debug" it rather than go straight to the answer as this is a better way forward for a less experienced user and it will help you in your future projects.

Based on your post I am going to need to be sure we are starting without too many unknowns on your setup, I am going to make some assumptions, if any of these are wrong I need to know... otherwise we are going to end up going in circles... and I am not giving 24 hour online support (it is my coffee break!):

  1. You are using an UNO
  2. You are using one of the latest IDE versions, maybe 1.6.3 witht he built in LCD support library
  3. You are using a 16 x 2 display of the same type as the example
  4. You are using the sketch exactly as listed on the site with absolutely no changes

Decided to have anther cup of coffee!

The Arduino IDE is very simple (in software development tool terms) but this is the key attraction for new users. More complex tools let us do things like set breakpoints in the code so we can see what is actually happening at device level, but this is rather more advanced debugging not available under the Arduino IDE. So we are just going to use serial port messages to see what is happening deep inside the software when it is running.

To debug the setup we are going to need to print messages to the serial port, so the next step is for you to to get a serial port printing sketch like the ASCIITable example running and seeing the output in the IDE serial monitor window. Play with this and see if you can change what is printed to the monitor window without introducing a bug.

xxglamisxx:
any help would be much appreciated!

Sure!

Start by reading the instructions!

Notably items 11, 7 and 9.

To debug the setup we are going to need to print messages to the serial port, so the next step is for you to to get a serial port printing sketch like the ASCIITable example running and seeing the output in the IDE serial monitor window. Play with this and see if you can change what is printed to the monitor window without introducing a bug.

You really don't have to go through all of this to get your LCD working. What you do have to do, if you want any kind of help that is more than a guess, is provide us with the information we need to analyze your situation. Paul has pointed you in the direction you need to go.

Don

Yo! Well done Zack, you now have 3 people that want to help. :grin:

As you said "i have wired my arduino just as its showed via the example for "hello world" (lcd) on the arduino site" I already know what your setup is, but I just want to check how exactly it matches. Personally I give you 10/10 for forum decorum :wink:

Thank you all for your responses!

sorry for the delay in responding to you guys, i just got off work.

ok to make sure we are all on the same page it is an UNO board.

the IDE that im using is 1.6.0 with the built in example....the newest version gives me issues when i try to upload to the board.

the lcd is a 16x2 Hitatchi model.

im using the sketch listed on the website under LCD..by fritzing... i believe it is.

i dont know much about the serial port, but ill do some research! thanks a bunch for sharing your coffee break with me rowboteer lol

Paul, the board i purchased didnt come with a set of instructions, but thanks for pointing out the online version!

Don, let me know if there is any other information that you need other than whit ive listed above, thanks!

Thank you all!
Zack

the code is as follows:

/*
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
  • 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.

*/

// 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(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);
}

and im not sure how much this will help, but here is an image:

Well, I did advise you to read the instructions - and you didn't.

Well, you certainly did not follow them.

Do you now expect to continue getting assistance?

Hi Zack,

Looks like you are trying :wink: ... do I mean adjective or verb - you decide :wink:

Well done for spotting that IDE 1.6.3 was one of your problems.

Now we know the details of your "patient" we need to look at the symptoms.

You have got a lot of things right as the sketch and electrical setup is "almost working", this is good! because when nothing is working there are few clues as to where to start looking.

Check your connections, the fact that the backlight (do you mean LED backlight or the LCD contrast changing) is changing suggests that the LCD may not be getting power properly... the signal (digital output) pins can easily provide enough power for an LCD but when the lines change state in certain combinations the power these signal lines provides is lost...

The sketch should print "hello world" and a number that increments every second. Does it really print 9.9999999 ?

Try this in a serial comms sketch such as ASCIITable:

while(1) {
Serial.println(millis()/1000);
}

How does the output in the Serial Monitor window compare to what is printed on the display?

Is this what you expected?

Try changing to:

while(1) {
Serial.println(millis()/1000.0);
}

Did you expect that?

Actually the lcd.print() and the Serial.print() output gets piped through the same software. This is why I suggested you get familiar with the serial interface :wink:

PS Just taking a break from gardening so won't be back online until this evening in the mean time you may like to get the serial link running, this and being able to turn on/off a LED are useful ways to debug programs (when software is the problem!)

and im not sure how much this will help, but here is an image:

It's not much help as it would be if it were properly illuminated. We have to be able to unambiguously follow each wire from the LCD back to wherever the other end is.

Your wires are likely going to the correct places since the display does function properly for a while but we can't see how good your solder joints look.

Is there anything else we should know about such as a motor, relay, or hand grenade lurking in the shadows?

Don

Another thought -- in spite of what is in the example sketch it really is not a good idea to try and troubleshoot an LCD problem while the displayed data is changing.

See what happens when you remove all the stuff between the brackets in loop(). Does your "hello, world!" message change after 10 seconds?

Don

Just seen your picture.

That's not a solder bridge on the LCD between D7 and the diode Anode (A) is it? Perhaps this is why your backlight is flashing?

Can you provide any thoughts on why such a solder bridge would not affect the display for the first 10 seconds?

Don

Can we say for certain that there is only one problem with the setup?

The answer to your question is no. How about an answer to mine?

Don

The answer is No! When debugging and you spot something that looks wrong.... do you just go ahead and ignore it because you think it is not relevant? Or do you fix it anyway? Have I spotted a "Latent Fault" do you think? Shall we wait for Zack to answer?

If D7 is linked to the LED Anode what would we observe? D7 is going to look like a PWM signal to the LED with a cyclic value.... could this explain Zacks observation from his first post:

"The backlight also goes between light and dark every few seconds."

The LED is connected via a 100R to 5V, this is absolutely crystal clear in the photo. Why would the brightness of the LED change as Zack described? The power supply collapsing or some other cause?

What would connecting a LED "directly" to a logic line do to the voltage and current on that line, would the reliability of the logic levels be changed... might this redirect the ASCII values to the LCD control registers? Oooh, maybe the answer is yes!

Are we going to work as team to help Zack or are we going to test our bladder sizes (viz contest between two males!)?

I actually get paid to sort problems like this... usually... I often find that a dysfunctional design team is the root cause of repeated design problems. In the process I assess the design team and the manager, then weed out (diplomatically re-assign) the "blockers", the "scape goat seekers", the "too many bosses" and the "de-railers" Once that is done the team pulls together and problems get fixed at last!

Good news all!

after reading your posts and further examining the solder bridge that you guys pointed out, i cleaned up those two pins a tad bit and the lcd works like a charm. thank you all for the multiple set of eyes, patience and guidance!

my guess (and remember im brand new to all of this stuff) is that when the counter struck 10 seconds, the lcd row 2 column 2 either wasnt getting enough juice or there was some type of feedback/interference due to the bridge, that is wasnt getting when only one digit (0-9) was being used on the lcd screen....maybe i should have tried a count down to see if it started garbled with two digits and ended clean when the count was <10s.

as for the ASCII Tables, i used the example from the arduino website and now im playing with some code to see what the serial monitor is capable of.

again thanks!
Zack

Yo! Result!

I won't ask if anybody is eating Humble Pie!

I'm glad you got your LCD working.

I'd like to pursue the reason for the behavior so if a situation like this crops up again we can deal it more rapidly.

the lcd row 2 column 2 either wasnt getting enough juice or there was some type of feedback/interference due to the bridge, that is wasnt getting when only one digit (0-9) was being used on the lcd screen..

Unfortunately this possible 'explanation' is not remotely related to how this type of display functions so the actual explanation lies elsewhere.

What would connecting a LED "directly" to a logic line do to the voltage and current on that line, would the reliability of the logic levels be changed... might this redirect the ASCII values to the LCD control registers? Oooh, maybe the answer is yes!

The phrase 'redirect the ASCII values' initially had me classify this explanation as technical doubletalk - especially since the control registers don't get ASCII values. However, if you rephrase this sentence to read '... might this change the values going to the LCD controller ...' I agree with your yes answer.

This will affect not only the cursor positioning but also the actual information displayed at these now incorrect cursor positions.

It doesn't explain how the display can function normally for the first 10 seconds but I do remember from other threads that problems with D7 tend to have less of an effect than problems with other data lines. There are reasons for this that can probably be explained by analyzing the structure of the instruction set but I won't try to do that now.

If D7 is linked to the LED Anode what would we observe? D7 is going to look like a PWM signal to the LED with a cyclic value.... could this explain Zacks observation from his first post:

If D7 is linked to the LED Anode it would effectively try to hold D7 in logical never-never land at the forward voltage of the backlight diode(s). This should mean that the LCD controller would not receive the proper signals on D7 (which is also D3 due to the 4-bit interface). Possibly the output signals from the Arduino are overcoming this bias thus permitting the display to function properly while also messing up the backlight as you mention.

I still cannot rationalize why it would take 10 seconds for a problem to develop so the logical conclusion is that it is the added data column that is the key, but not for the reasons mentioned previously. I'll have to think about this some more.

It would be interesting to see if you can replicate this problem by deliberately shorting those two pins. If you want to try this you have to do the shorting before you apply power so that the 'fault' will be present during the initialization of the LCD controller.

This test can help rule out the possibility that the real problem was actually due to something else which was inadvertently fixed as a collateral result of your solder bridge repair.

EDIT: If the problem does indeed reoccur I would also like to know what the display looks like if you remove the code from between the brackets in loop().

Don