I'm having some complications when I'm trying to control 16 Relays using 2 595, these relays control loads connected to 5V, 12V and 220V. There are 8 loads at 220V using the 8 LSB from my SPI communication with the 595.

Everything works great as long i have connected 5V and 12V to the relays, when i connect 220V relays turn on and off randomly, sometimes they work just right, as I change the registers. Using an oscilloscope I've seen some noise in VCC (5V), but I've been unable to eliminate it.

I've tried:
-Connecting different power supplies to my arduino and to the relay module. I'm using a pc power source for 5V and 12V.
-Changing Serial freq.
-Using a low pass filter at latch. To avoid a noise induced data storage.

I'm using there relays:
SainSmart 8-Channel Relay Module

I'm completely out of ideas, so any kind of insight will be appreciated.



Here is my circuit schematic, i've checked that everything works except when i connect my relays to 220V

595 and relay connection schematic


This is the schematic i've found:

Relay board schematic

As you can see and I had forgot to mention relays are drive by pulling 595 pins to ground.

  • 3
    \$\begingroup\$ You have schematics and oscilloscope output and cant see where the problem is. We have neither and should be able to see it? \$\endgroup\$ – PlasmaHH Mar 19 '15 at 21:37
  • \$\begingroup\$ Thanks for pointing it out so nicely, I've added my circuit schematic. \$\endgroup\$ – Tomas Guajardo Mar 20 '15 at 15:07
  • \$\begingroup\$ Do you have a data sheet or a schematic for the relay module? The reason I'm asking is because there's a little circuitry supporting each relay (a transistor, a couple of resistors, a diode, a ceramic cap(?) and what appears to be an optocoupler) and I can't figure out the wiring from the picture. \$\endgroup\$ – EM Fields Mar 20 '15 at 16:10
  • \$\begingroup\$ @TomasGuajardo - I've edited my answer to reflect your changes. It seems obvious that you're getting 220 leakage from somewhere. Does it matter which relay pin you connect 220 to? Are you connecting any part of the circuit other than a relay contact to 220 (like circuit ground)? \$\endgroup\$ – WhatRoughBeast Mar 20 '15 at 19:04

If your AC loads are inductive and/or the wire runs to them are long, there's a good chance that when you switch the loads off they'll generate electromagnetic pulses which can wreak havoc on the rest of the system.

One solution is to dissipate that energy with a snubber located close to the load and to shield or, perhaps, use twisted pair for the control wiring.

  • \$\begingroup\$ This did the trick 2 RC snubber. \$\endgroup\$ – Tomas Guajardo Apr 23 '15 at 20:19
  • \$\begingroup\$ @TomasGuajardo: I'm pleased that I could help, and thanks for the accept. :-) \$\endgroup\$ – EM Fields Apr 23 '15 at 23:07

You need to learn how to read data sheets. Start with the 595 http://www.nxp.com/documents/data_sheet/74HC_HCT595.pdf So you're looking at the maximum current limits (25 mA) and that's more than your relays require (15-20 mA), right?

Nope. Look at V(OH) lower part of page 8. This applies to the 74HCT595, but that's OK because it's running at 5 volts, and the output drivers are the same between HC and HCT - it's only the input structure that changes.

For an output current of 6 mA, the worst-case output voltage is 3.7 volts, and it just gets worse as the output current increases. To put it simply, the 595 simply doesn't have a strong enough set of output pins to reliably drive the relay cards. I'd guess that the only times you actually get some relays activated is when only 1 or 2 channels are driven on.

In order to get reliable operation, you'll need to buffer the 595 output with something a bit stronger.

EDIT OK, using pull-down discredits my answer. Sorry for doubting you. Your 595s ought to be working. Just like you said.

  • \$\begingroup\$ Actually everything works fine until i connect 220V, i can drive all the other relays without problems. I can even drive all 16 relays, as long as i don't connect 220V to it. \$\endgroup\$ – Tomas Guajardo Mar 20 '15 at 14:47
  • \$\begingroup\$ He's using 74LS outputs as sinks, so the CMOS output voltage VS load current curves don't apply. \$\endgroup\$ – EM Fields Mar 20 '15 at 18:53
  • \$\begingroup\$ Sorry - brain fart. \$\endgroup\$ – WhatRoughBeast Mar 20 '15 at 19:07
  • \$\begingroup\$ Still learning how to correctly ask questions, it was harder than i thought. \$\endgroup\$ – Tomas Guajardo Mar 20 '15 at 19:16

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.