I'm working with a relay module to switch a solenoid with an Arduino, Im having problems because the arduino get some noise in an LCD but I'm not sure where to put the diode, there is 3 pins, In, Vcc and GND. I think there should be a diode between In and VCC/GND but looking at the internet there is a diode between VCC and GND, shouldnt it be in the In because there is a direct connection with the Arduino? Relay 5v Edit1 (sorry for my bad drawing)

I add my diagram, this the connection with the problem, and it only get noise when the valve is connected with the 12v source enter image description here

  • \$\begingroup\$ You'll need to solder the flyback diode directly across the relay coil pins. Make sure you connect it "backwards" to make sure that during normal operation the diode does not conduct \$\endgroup\$ – DerStrom8 Nov 21 '16 at 17:30
  • \$\begingroup\$ Do you have the same problems if you disconnect the solenoid? If so, the problem is with the output of the relay (i.e. the load), not its own coil. As Spehro says below, it's unlikely that you need to add a diode to a relay module which appears to have a transistor input anyway. \$\endgroup\$ – user1844 Nov 21 '16 at 17:40
  • \$\begingroup\$ The tutorial linked to is completely wrong. The diode they add between VCC and GND does absolutely nothing. The relay module already has a diode across the relay coil which provide the protection (for the transistor) required. \$\endgroup\$ – Jack Creasey Nov 21 '16 at 19:32
  • \$\begingroup\$ @WillDean nop, the problem is only when the 12v source is working with the valve \$\endgroup\$ – Pulse9 Nov 21 '16 at 22:02
  • \$\begingroup\$ @AndrewMorton I update the post with the diagram \$\endgroup\$ – Pulse9 Nov 21 '16 at 22:03

There is undoubtedly already a catch diode in that module, so adding one won't help one bit.

You should get a module with opto-isolation and supply the relay coil power from a separate power source with no connection to the Arduino power.

Also keep the wires to the contacts well away from the wires to the LCD module.

You should, however, connect a diode across the solenoid (assuming it is a DC type!) so that it is reverse biased.

If it is an AC type then there is not much that can be done. An RC snubber will help a bit, as will a MOV or TVS but they are not greatly effective in reducing this kind of electrical noise and things will only get worse as the contacts wear.

  • \$\begingroup\$ I update with a diagram, so I should connect a diode between the two connections of the relay (the right side)? \$\endgroup\$ – Pulse9 Nov 21 '16 at 22:04
  • \$\begingroup\$ Yes, but you must make sure that the polarity is correct or you will burn out your relay. If the + side of the power supply goes to the coil, then that should connect to the side of the diode with a band (and the other side goes to the other side of of the coil). This will greatly reduce the electrical noise when the relay opens. \$\endgroup\$ – Spehro Pefhany Nov 21 '16 at 22:21
  • \$\begingroup\$ In my diagram, the cathode from my diode (white band) should be on the valve and the anode in the GND of my source right? \$\endgroup\$ – Pulse9 Nov 21 '16 at 23:08
  • \$\begingroup\$ Mark the polarity of the supply on your diagram. The diode goes directly across the valve, preferably AT the terminals. \$\endgroup\$ – Spehro Pefhany Nov 22 '16 at 5:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.