Garbled 16 x 2 LCD on science instrument

We've built these boxes from scratch; Arduino drives a Gecko controller that drives a small stepper to move a cone valve and deliver plastic sand to our river experiments (www.emriver.com).

After hundreds of hours of prototyping; we built production boxes and then this happens; part of the display goes haywire. Program still running, machine works, everything OK otherwise. Any ideas where to start troubleshooting other than replacing parts? I know it's not the code, and it happens intermittently.

Middle one in attached photo shows how the display is supposed to look. Thanks!

Harvard_media_feeder_Aug 8_FINAL.ino (20.9 KB)

I can't see any obvious problems in the code (yet).
In the photo, it looks like unit 2 has a different cable arrangement than the other two. Does it also have the problem with garbled LCD data? If not, I'd look at what is different about its cables that might contribute to its immunity. Unit 3 appears to have a power cable wrapped around the data cable (or vice versa) which might be introducing noise into the unit.

Pete

Start by adding 22 µF capacitors soldered across pins 1 and 2 of the LCD board.

Thanks guys, both good possibilities. But now we've run them for hours and can't reproduce the fault! A colleague thinks it may be that I'm simply writing blanks to clear the left hand side of the screen when I update LCD (because SN=XX on the right never changes when it's running).

I'm a pretty terrible coder, btw.

void update_lcd()
{
lcd.setCursor(0,0);
lcd.print(" ");
lcd.setCursor(0,0);
lcd.print (gramSec);

........

And perhaps I'm just "pushing" those characters somewhere and eventually they fill up a buffer or some such. Makes sense because only the part I'm writing over like this is garbled, and it's very consistent.

I've worked on this code for literally years, and probably the writing blank spaces v. lcd.clear() had a purpose at one time, but not now, so I'll use lcd.clear().

The problem is not in the technique that you have posted in your code fragment.

That is a perfectly acceptable method for displaying information, especially when the number of characters in 'gramSec' may change from time to time.

We typically recommend staying away from lcd.clear(), especially in a fast loop since it frequently results in flickering on the screen.

Don

You should tie D0 to D3 of the display to GND - if they are kept floating they can pickup electrical noise and tell the display to enter 8-bit mode and then garble all actions after that point.

// Per.

... if they are kept floating they can pickup electrical noise and tell the display to enter 8-bit mode and then garble all actions after that point

If you believe that then you might also be interested in buying the Brooklyn Bridge.

Don

floresta:
If you believe that then you might also be interested in buying the Brooklyn Bridge.

If I believe it?

It's floating inputs - if the right bit patters appears when the data is sampled the display goes into 8 bit mode.

It CAN be a problem: http://www.avrfreaks.net/forum/can-i-leave-4-unused-pins-floating-lcd-4bit-mode

// Per.

Zapro, could this cause the consistent pattern with the right third of the screen unaffected, though? Seems the whole screen would go bonkers.

Also please note there is a Gecko stepper driver lower right (has LED); very well engineered, but could be noisy, maybe? And also we discovered case was getting up to 150F inside; we fixed that too.

But we ran them all day today and no replication of the problem.

Physical computing for sale is very, very hard, I don't recommend it. Like being a professional musician, you suck all the fun out of it :-/

And I should mention we've used that basic PCB (designed by us) for over 200 units of the controller you see here, worldwide, with zero display problems -- people step on them and break the control knob; otherwise perfect record in the field.

Alix controller how to video

It looks like impulse interference, frequently documented here in the past. I would strongly suggest the 22 µF capacitors.

Paul__B, thanks, but I can't find anything on "impulse interference" searching the forum.

We have 100µF caps in the lab, would that work?

It's floating inputs - if the right bit patters appears when the data is sampled the display goes into 8 bit mode.

They are not floating, they are pulled up internally.

Don

gravelbar:
And I should mention we've used that basic PCB (designed by us) for over 200 units of the controller you see here, worldwide, with zero display problems -- people step on them and break the control knob; otherwise perfect record in the field.

Alix controller how to video

Are the displays from a reputable source? There has been more than one instance of people having troubles like yours when using certain (possibly out-of-spec) displays in the 4-bit mode with the Arduino LiquidCrystal library.

If you experience problems again you might want to try the latest version of the library that JJRaines wrote for the 40x4 displays. That library seems to handle slow (out-of-spec) displays where others don't.

To get a copy start here:--> Google Code Archive - Long-term storage for Google Code Project Hosting. and follow the Downloads link to get to the latest version.

Don

gravelbar:
Paul__B, thanks, but I can't find anything on "impulse interference" searching the forum.

As mentioned in another thread here, searching the forum is difficult. I may call it "impulse interference" but that does not mean other people ever said that in so many words. :grinning:

What is common is intermittent problems with the LCD crashing when relays/ solenoids operate, and adding the capacitor often works if it is only the LCD which crashes.

gravelbar:
We have 100µF caps in the lab, would that work?

Certainly should.

Certainly should.

Paul__B:
As mentioned in another thread here, searching the forum is difficult. I may call it "impulse interference" but that does not mean other people ever said that in so many words. :grinning:

What is common is intermittent problems with the LCD crashing when relays/ solenoids operate, and adding the capacitor often works if it is only the LCD which crashes.
Certainly should.

In very general terms - in an industrial environment you have two kinds of interference - dropping / interrupting the power supply and RFI.
100 pf cap won't do anything for neither one of them - it won't hold the power - way too small and it won't short out the RFI either.
If it is a real problem, so far you did not prove that, you need to find the real source.
Since you said "it was 150 inside the box" - how "industrial strength " is your power supply or is it Walllwart type?

I''l bet that Arduino stuff is good for 68 degrees AC environment only anyway.

Paul__B:
It looks like impulse interference, frequently documented here in the past. I would strongly suggest the 22 µF capacitors.

Can you please post a schema where to put the capacitor exactly. I have here the same problem with a 16x2 LCD when a relay trigger external devices.

I used the schema from the official Arduino page: https://www.arduino.cc/en/Tutorial/LiquidCrystalDisplay

Capacitor between pin 1 and 2 of the LCD module.

Note the polarity.