lcd outputs gibberish

as stated in the title, a persistent problem is that whenever i trigger an external load, the lcd displays random characters. this does not always happen, but instances have been happening too frequently to be ignored. i am sure i wired it correctly and program is not the problem also. so what can i do to eliminate this problem?

btw, i’m using 16x2 LCD, 16pins, in 4 bit mode with the LiquidCrystal library.

so what can i do to eliminate this problem?

My crystal ball indicates that your load is inductive, probably a relay and it is powered by the same source as your Arduino.

The solution may be as simple as a capacitor across pins 1 and 2 (the power pins) of your LCD. There are many forum threads dealing with this problem, one as recent as yesterday.


not really. my relay is powered by another supply, different from my arduino. only the ground connection is common.

This is a common and vexed complaint. It has a lot to do with wiring layout, ground loops and such.

You need to ensure that all connections to devices - including power feeds - are paired; ribbon cable is good for this. This means that the power supply to the relay module goes - as a pair - to that module (and you had better cite with a Web link, what module you are using as there are various complications there); the controlled circuit connects to the relay by a twin cable, the control wiring from relay module to Arduino is also paired and the power is fed to the Arduino by paired cable, all the connections to the LCD are bound together as are connections to your sensors or switches.

Push-buttons should always connect from an Arduino input to ground, using either the internal pull-up or an additional pull-up to 5 V.

And finally, use a 22 µF capacitor across pins 1 and 2 of the LCD module.