I recently built a small system based on the Arduino Yun that monitored the outside temperature, each zone temperature and when my boiler and each zone in the house called for heat, kept some local statistics that were displayed on a 20x4 LCD, and then posted additional info to a website. Everything worked fine except that occasionally the LCD would be blank. It would still post to the website and talk to the remote thermostat through XBees, but the screen would be backlit, but no characters.
I began by stripping down my code, until I replaced the original program with one that just prints ASCII characters to the screen during setup and never does anything else, and instead of going blank the screen would start showing random characters after about 10-20 minutes. The longer it's on the more characters get corrupted, seemingly always starting from the upper left and working left->right.
So I then started unplugging hardware. I'm now down to just having the LCD hooked up and the final culprit: the outdoor temperature sensor, which is just a 10K thermistor that I extended using CAT5e cable. If I unplug the sensor from the breadboard, the LCD stays fine.
I cut the thermistor off the CAT5e and then plugged the thermistor directly into the breadboard, that seems fine. I removed the thermistor again and plugged in just the CAT5e cable, which is now connected to nothing at all. The strange characters returned. The CAT5e isn't even connected to any of the arduino pins, it's just hooked up to the power at this point.
I read through the forum for other strange LCD character issues and tried adding a capacitor for the LCD (pins 1&2) and then even trying one on the CAT5e line. Still no luck.
Why does this CAT5e wiring, even when it is connected to nothing, corrupt my LCD output through just the ground and +5V? And how do I then fix the issue?
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 6, 7, 8);
const byte LCD_PIN = 9;
void setup()
{
digitalWrite(LCD_PIN, HIGH);
pinMode(LCD_PIN, OUTPUT);
lcd.begin(20, 4);
lcd.print("1234567890ABCDEFGHIJ");
lcd.setCursor(0, 1);
lcd.print("KLMNOPQRSTUVWXYZabcd");
lcd.setCursor(0, 2);
lcd.print("efghijklmnopqrstuvwx");
lcd.setCursor(0, 3);
lcd.print("yz<>?[]{}|+-=!@#$%^&");
}
void loop() {
// put your main code here, to run repeatedly:
}