standard 16*2 standard LCD - flipping - messed up characters

hi all,

I turn to this forum, because I'm really desperate. Natively, I speak dutch, so don't mind poor language please.

I am a novice, by the way, I'm learning as I go. After having played around with some basic Arduino stuff, I decided I'd have a go at something a little more advanced.

The image below is a pretty accurate reproduction of my first test-layout-on-a-breadboard . I worked fine then. It simply measures analog stuff and switches relays (to open some 220 v (low current) valves.) The LCD displays the analog values.

(sorry for the type of image, I think this is clearer than a schema I could make)

It was until I made a PCB of it, that problems began. More specificly, I discovered that it still worked fine UNTIL I connect 220v to the relay contacts. The display flips almost every time I do that, and if it doesn't, it'll flip almost certainly the first time one of the relays re-open (after having been closed). I guess that the mini-spark that is generated when adding 220v generates interferance (noise?) with one of the graphics chips on the back of the display.

The arduino still performs it's task, but I can't read the display any more (messed up characters).

It is not a programming fault I think, because it works 100% fine before I connect 220vac.

I searched for similar problems on this forum and some other places, and there seem to be a few examples, but none of the solutions were satisfying to me.

  • I tried turning off/on the display after every loop (but once the LCD flips, it doesn't listen to those commands any more)
  • I tried adding some capacitors at different places, but the problem persists.

any ideas anyone?

thx Turok

Did you connect the arduino gnd to the neutral from 220VAC? I will not do that.

no, I didn't. the only connection between the 220 and the rest of the electronics, would be air, polyester (pcb) and the relays, wich are all intended to be isolating, of course.

I designed the PCB with fritzing, and used a copper fill on the board, so I tought maybe the "220v spark interference" travelled through it, and thus I even tried separating the two areas on the PCB by destroying that copper fill at strategic places.

I also tried to use a higher voltage power supply to the arduino (used 5,5v at first - changed it to 7,5v) , because I thought the relays drew too much power (they're on the same supply), but it didn't help either. It's really when 220v comes in to play that trouble begins.

I haven't tried separating the relays from the pcb to get the source of interference fysically further away from the arduino and display processors. Maybe I should?

I'm thinking I'll have to look for maybe 12 or 24vdc valves. but I bet they'll cost a lot more than the 3€/valve I pay now. since this device should be producable at relatively low cost when working fine, I'm trying to avoid that. It could mean, though, that I could get rid of the relays all together..

I'm talking to myself at the moment, because I still hope someone has an "aha" moment :)

I had junk characters on my LCD when I put its wire too close to a desk lamp base, with transformer inside). Not sure if that matters to you since you said you kept things quite separate. BTW, you're using the hardware serial pins to control the relays. I don't know if that has anything to do with your hardware being unreliable. Keep talking to yourself. It usually happens that a person solves his/her own problem by talking to anyone including self.

The relay contacts are being used to supply 220 volts to ... what?

Don

Liudr, thats exactly the kind of interference I think is messing with my project.

floresta, 220v goes to solenoid valves. The kind you would probably commonly find in dish washers. (edit) the problem even occurs when I just turn the 220V ON, not only when the valves activate. Dirk

I discovered that it still worked fine UNTIL I connect 220v to the relay contacts.

I guess that the mini-spark that is generated when adding 220v generates interferance (noise?) with one of the graphics chips on the back of the display.

(edit) the problem even occurs when I just turn the 220V ON, not only when the valves activate.

Am I interpreting this correctly? In order to power a valve via a relay you have to connect three wires and then actuate the relay. I assume that you have a switch or a plug to disconnect the 220V supply. First you make the connections; one side of the 220V goes to a relay contact, the other relay contact goes to one of the valve connections, and the other valve connection goes to the other side of the 220V. Next you turn on the 220V with the switch or by connecting the plug. Finally you activate the relay with a signal from the Arduino. From what you are saying it looks like the LCD display gets messed up as soon as you turn on the 220V even if you do not activate the relay.

If my interpretation is correct then there should not be any 'mini-spark' generated when connecting the 220V since, at this point, there is no path for current to flow. Are you sure there isn't something else happening that you are overlooking?

Don

exactly!

that’s why Im so desperate :slight_smile:

I am, as said before, a novice, but I do understand the basics of electricity, relays, arduino, resistors, transistors.
so I think it’s wired up the right way.

I don’t know a lot about capacitors yet though…
I tried adding capacitors here and there, but it’s more guessing than knowledge I guess.

could it just be that the 220v is embedded close to the arduino (on the same “shield”, at the business end of the relays)??? I don’t know!

here’s a quick picture of the pcb if that’s any help.

as (I hope) you can see, I damaged the copper fill to Isolate extra, but it didn’t work.

again, as long as 220v is off, no problem. When I activate it, most of the time the LCD flips, and if it doesn’t, it certainly will when any relay switches off after a cycle.

I guess I’ll have to rebuild the thing on a breadboard and see if it persists. If it does, it isn’t a hidden fault on the pcb.

The ribbon cable I see in the picture, is it 40-wire or is it 80-wire?

What happens to the LCD if you don't tuck the cable in the box but stretch it straight away from the board, keeping it away from the rest of the circuit?

By "flipping" do you mean misbehaving?

yes flippin = misbehaving (it's mostly be total jibberish, and sometimes I can still read some intended data through it))

that cable is an old style 40 lead IDE cable. It was added later to see if anything would change if I stretched it, but alas :-)

I've also tried an other LCD, that's not it either.

How are you powering the arduino? Maybe there are not enough power to run the coils without a serial resistor.

Some thoughts:

When the display is misbehaving, if you then disconnect the 220v does it work properly again?

If yes -> looks like it is just the display picking up noise from the 220v wires, not the mcu. Shield the display from the 220v wires using a grounded metal plate or piece of un-etched PCB. Make sure you have the display R/W input grounded if you are not using it. Don't connect the 4 unused data lines on the display to the ribbon cable. What value did you use for the contrast adjustment pot? Putting the pot right next to the display and not connecting the pot pin to the ribbon cable might help. Or perhaps a 100nf capacitor from the pot pin to ground would prevent the pot pin line picking up interference.

When you say jibberish on the display, is the jibberish real characters or not? If not, this would again indicate the problem is the display or its pot pin picking up noise, not the mcu and other logic.

The copper fill around the 220v wiring on the PCB was a mistake. The clearance between it and the 220v pins looks rather small. If you've a powerful enough soldering iron with a large bit, you might be able to lift the corner and then peel it off (heating the copper melts the adhesive that holds it to the fiberglass board). But you might wreck the PCB if you try this.

Alternatively, connecting the copper fill around the 220v direct to mains ground might help.

Keep the 220v wires to/from the relays as far away from the mcu, display and logic as possible