LCD error message - current regulation issue?

Thread Starter

av348

Joined Dec 7, 2018
1
I am using a Raspberry Pi to control a 16x2 LCD screen. It displays a countdown timer once per second for several minutes— most of the time it works perfectly, but sometimes (<1% of the time) it writes a random character to the whole display.
Because it’s intermittent and random, it seems like a hardware issue and not software— perhaps a problem with current fluctuations?
I was reading that I should add a capacitor in parallel to the LCD connection to mitigate variable current but I don’t know exactly where to wire it or what capacitance to use. There is a variable potentiometer to control the backlight intensity but otherwise there are no resistors or capacitors in the system.
I would really appreciate any assistance in this, even just some guidance on how to start debugging the circuitry. Thanks!
 

Attachments

JohnInTX

Joined Jun 26, 2012
4,787
It's a good idea to add decoupling capacitors on the supply lines between Vdd and GND. 1uf tantalum in parallel with .1 ceramic is a good starting point. Don't forget good, clean power for the rPI too.

Also, sometimes noise on the LCD's E line can cause this. I usually pull E down with 10K or so - whatever the processor will drive. Keep in mind that the outputs are HiZ when the processor is in reset so you'd want E strapped down to avoid getting the LCD into a funky mode due to stray transitions on E. If your IO goes through HiZ transitions, a pull-down is a necessity. Is your firmware resetting? Are you sharing IO between main and interrupt routines? You wouldn't want to be wiggling E when you're doing interrupt IO.

Beyond that, are the logic levels outputted by the RPi OK for the levels required by the LCD? I don't use RPi but if it's using 3V3 outputs those might be marginal for a 5V LCD.

Keep in mind that some LCD operations require a relatively long time to execute - clear screen, locate cursor etc. Check the LCD datasheet for that and ensure you're respecting the various timing requirements, not only for the normal read/write to the LCD but also allowing for execution times

Just thinking out loud..
Good luck and welcome to AAC!
 
Last edited:

spinnaker

Joined Oct 29, 2009
7,830
It's a good idea to add decoupling capacitors on the supply lines between Vdd and GND. 1uf tantalum in parallel with .1 ceramic is a good starting point. Don't forget good, clean power for the rPI too.
Boy, I would hope something like a Raspberry Pi came with plenty of decoupling on board.

The other thing I would check is all of your connections are good.
 

ebp

Joined Feb 8, 2018
2,332
If your display is connected by longish wires (say a foot, 30 cm or more), the capacitors at the display become more important. LC displays generally aren't very "dynamic" in terms of current, but adequate decoupling is always a good place to start. LED displays can cause all sorts of grief due to changing current.

With long wires, keep the power and ground wires either twisted together or otherwise closely bundled. This reduces the "loop area" which reduces inductance because the opposing magnetic fields in the two conductors at least partially cancel.

The power ground connection for many displays is also the data ground - which always creates a bit a quandary as to where the display ground and processor ground should be connected together. Usually in such a case, connecting them close to the processor board is better than connecting them together near the power supply (which would be better in other circumstances). I suspect power and ground for the display are coming from the same header on the Pi as the data, which is fine.

If the Pi is putting out 3.3 V (which I'm fairly sure is the case) for HIGH and the display has "CMOS compatible" (as opposed to "TTL compatible) inputs and is running on 5 volts, the HIGH from the Pi may be right at the ragged edge. The spec for HIGH for CMOS inputs is often 70% of the supply voltage, so 3.5 V with a 5 V supply. Usually something lower will be OK, but with strange behavior it is something to keep in mind. If the display has TTL compatible inputs, then anything over 2 V is a good HIGH. Any 5 V status or other signal from the display should have a current limiting resistor to keep the Pi input from being overdrive (usual spec is about 0.5 V above the positive supply, so about 3.8 V maximum. Current should be limited to about half a milliamp, so a series resistor of (5 - 3.8)/0.0005 = 2400 ohms. 2400 is a common value, but anything form about 2.2k to 3.3k should be OK.
 
Top