Activate a 220VAC solenoid valve via opto isolated relay

Hi,

My problem: the arduino Mega keeps resetting from time to time (1 to 30 minutes) although a RC snubber is installed for this solenoid valve. The solenoid works with 220VAC. I use two DC sources (one for logic, one for optos).

The VL53L0X laser distance sensor displays a totally erroneous value just before the arduino resets or the value is erroneous and the arduino keeps working.

Note that AC220V cables are shielded with shields grounded. Optocouplers “should” avoid interference between logic and power circuit, so far I think their connection is correct? maybe a ground loop or ground issue?

Any idea to diagnose the problem is welcome, I don't know what to do anymore.

I attached a schematic.

Welcome to the Arduino forum!
Thank you for the nice block diagram! that works as a schematic.

Now, How did you go about debugging your program? Did you run your program for a long time with the 220 volts disconnected? Did the failure still occur? Your symptoms point to commonly occurring coding problems.

Paul

Hi Paul, thank you for your reply.

I run the code 4 hours with a resistive load (light bulb) without trouble, instead of a solenoid valve.

I have noticed something : if the program is running and both DC sources active and a usb cable is connected to my computer: once I remove the USB cable from my computer, the laser reading becomes crazy and at worse, the arduino reboot. Could be a grounding issue? (the computer has a voltage regulator + UPS unit).

Connecting GND of both DC sources together makes the whole thing more stable but still crash sometimes.

Connecting DC12V to a battery and DC5V on powergrid still produces reboot sometimes.

Basically I am trying to figure if I am facing an EMI/RFI problem or a ground/ground loop problem.

From others threads, there is suggestion to use big decoupling capacitor (10,000uF x 50V on my 5V logic circuit). I found some polyester capacitors (0.1uf+120ohm) to put at relays in addition of existing snubber on the solenoid.

I built another circuit with 12V solenoid using TIP darlington transistor and it like a charm. But I really need the 220VAC setup to work.

Hi,

Just an update, I think all my problem comes from bad grounding.

  • my DC supplies have earth connected to the case which is connected to a proper earthing hole in soil.
  • the DC- of my power supplies is not connected to earth. Should I? Else I think I would loose the optocouplers benefits.
  • the cable shields (signal, power) are all connected to case earth.

Do you think there is some better grounding scheme to prevent transient nasty effects on my circuit?

Signal shield should be connected to DC ground, not case/mains earth - this is a likely route for interference.

If you do connect mains earth to DC ground, it should be at a single point, so that a star-ground is
maintained. However I don't think you need to (unless a safety issue)

Are any of the low voltage cables run near/alongside the mains wiring? That's well worth avoiding.

Signal shields should connected to DC ground at one end only, unless they are the only ground in the cable. And
it should be the end that's the centre of the star, ie the Arduino.