hiive designed a board which has a 4 line Lcd bolted to it, im getting every now and then breakup of the lcd im just wondering if im getting interference from my psu (240), can anybody advice me on mains filtering pleasethank you

It is far more likely that you just don't have enough decoupling on the power connections to the LCD. Either that or your connections are bad.

Your 240V incoming power will be stepped down to a more reasonable voltage, say 9V, before being connected in to the barrel jack on the Arduino? So, a noise of 10% on the mains (24v in 240v) would equate to a 10% noise in the 9V (0.9v in 9v), which after regulation by the on-board regulator down to 5V would disappear completely (that's what the regulator does).

So it is highly unlikely to be the mains power interfering, unless you have your connections to the LCD wrapped around a mains extension cable.

hope you are good, ive been in hospital for a while so my profect/s been on hold for a few months, but picked it up in the last couple of weeks ordered 10 pcbs from china last week worked out £5.2 each, what a bargin ! had quotes in the uk £20

ive managed to use an lcd instead of leds and its looking really nice your current code working very nicely.

the unit was tested on site yesterday worked without fault but the lcd display distorted a bit, it had a bit in the past bearing in mind this was a home made double sided etched board.

yes power supply is 9v and my decoupling c's are 100nf the whole board is 100% ground fill top /bottom

i just wondered if the distortion could be mains related, the lcd is bolted on very close to the 328 thats driving it, th lcd is 5mm from the main board.

Oh, hello - sorry, didn't see you there I seldom look to see who is actually asking the questions, as 99 times out of 100 it's a new user

Right, so now I have some context, and I know you're not someone with no knowledge, so we can get on to proper troubleshooting

It's unlikely to be the power supply (I have seen your PSU arrangement in older images, and it looks fine - pretty much identical to ones I have done in the past). Mains noise is unlikely unless it's in a very very noisy area, which given the number of fans around it may be I suppose.

That being said, you can never have too much decoupling. I'd be inclined to add a capacitor directly to the logic power pins to the LCD - say 100uF or similar - to see if that helps.

Is there any chance you could get a picture of the corruption?

How have you got the LCD connected up? Are you using an I²C interface chip as we talked about once, or have you used another 328 chip? (It looks to me like you're feeding it direct from one of the existing 328 chips? which one is that?)

You might also want to ground pins 7 thru 10. They should have no effect in 4-bit mode, but it's best to remove them from the equation anyway.

When I last saw the code for "A" it was pure polling, so it shouldn't be an interrupt screwing with the communication.

One other thing to check is the flyback diodes on the relays. Without those, as the relays switch on/off (especially off) it could induce massive spikes into the power system, which is far more likely to cause problems than mains noise. A small ceramic capacitor can also help with that.

It's hard to see how you're driving the relays on those pictures. Do you have transistors driving them hidden away somewhere? I can just about see the flyback diodes on the underside - are they the right way round? I can't tell