I'm rather new to electronics and Arduino.
I fear it's a generic question and rather basic, and not really LCD specific, so I put it here.
I've got an Arduino UNO and a 20x2 LCD Display (Epson EA-D20025AR = Hitachi LM032L = HD44780) connected via a 30 cm (1 ft) flat cable with GND, 5V, RS, E, D4 .. D7 from the LCD to the Arduino (GND and 5V go to a breadboard, where I also added a 47µF cap)
RW is connected to GND at the LCD, and the contrast pin is wired to a pot between LCD pin1 and pin2 (0V / 5V) next to the LCD module as well.
I'm using the LiquidCrystal library, and in general, all works well.
If there's nothing else than described above, my sketch runs for days, proving that millis() on my Arduino is wrong by about 0.1 % (a minute per day)
Goal is not to check this by watching myself, but compare it with pulses derived from mains ( 50Hz in Europe ) , which I get via an optocoupler, whose emitter is tied to GND and the collector is fed via 4.7k from 5V. When looking at the collector signal via analogRead(), it's nearly square between 5V and 0.5V
Connecting it to pin2 (next to pins 4... feeding the LCD), it works fine for a while, but suddenly (typically when I leave it alone after a few minutes) the LCD displays garbage in locations where I nerver write anything, and Arduino needs a reset to recover.
I'm pretty sure the optocoupler is wired correctly, provides a galvanic separation, so I fear this low power lcd module (2mA ?) is rather sensitive catching noise from the air? Is that possible/normal?
Is it ok to leave LCD D0..D3 unconnected?
Do I need a shielded cable? Pull down lcd signals?
In my use case, I do not read back from the LCD, thus all Arduino pins should be outputs always.
How can the arduino sketch itself be affected?
In an additional test I added a blink output to pin13, which sometimes stops as well until reset ???
edits: just spelling