16*2 LCD getting weird characters

Hi all.

This is my first post so I hope it is at the right place.

I'm working on a project whose objective is to control two ac loads (one ac fan, controlled by phase angle control and one ac motor controlled by a 5V relay) and output to an LCD the room temperature and the % of fan speed.

The code I wrote seem to work fine without the AC loads connected. I tested it for long periods of time (+12 hours) and everything is ok.

The problem is when I connect both (or just one) AC loads, I always end up with my LCD info corrupted like this:

https://1drv.ms/i/s!Ah12lhUG5VG8g9FOhR9Y0ccFTsq2Rg

Sometimes past 2 minutes, sometimes past 10 minutes... It's random but it always end up like this.

I'm guessing it's noise problems due to the loads switching TRIAC/Relay. The TRIAC its connected trough a optocoupler but the relay it's directly connected to the arduino.

First, I put the lcd.clear() function in my code to "rebuild" the info from time to time but it doesen't work 100% and it's not a "clean" solution for the pourpose.

The AC loads are connected to the grid but the arduino is powered from my computer's usb port. Already put an EMI filter into AC main input of my loads but no solution.

Is there a solution to this problem? Any help?
Sorry for my poor english but I'm a little bit rusty.

Regards

Have you tried using the search function at the upper right corner of your browser screen. Try using the search term LCD weird characters .

Don

Yes sir, I did but I ended up in topics where you answer that same thing and no solution was found (or it was but no one reported back) or in links that only show me html code (many) and so.. no solution for me.

For your answer I can see that this is a common problem. I'm sorry for question this once again.

Regards

We knew straight away what the problem was when you wrote something related to "AC switching".

Shortcut to answers: Put a 100 µF capacitor between pins 1 and 2 of your LCD panel.

Hi,

Thanks for your help Paul__B.

I tested today with a 470uF capacitor between VCC and GND of the LCDpanel and happened the same thing. Didn't have a 100uF capacitor but I guess it's the same.

Oh well, you will have to read some of the other posts regarding lead dress and supply isolation.