8
\$\begingroup\$

sorry for the length.

This is a continuation of my recent question. I have an optocoupled 8-relay board that I’m trying to connect to my microcontroller. I have placed a 74HC595 shift register inline to consolidate the input ports. In doing so however the board has been exhibiting some strange behavior.

enter image description here

If I don’t plug anything in, or just a small load into the relays all works fine using the shift register. They turn on and off without a problem. As soon as I plug a 1+ amp pump onto the relay you can hear the relay trip on then it quickly trips off. IN1 (diagram above) LED lights up for a split second as well. Sometimes though (1 in 5) the relay and pump actually stay on. Now this is where it gets weird; if I remove the shift register and directly connect the pins to the microcontroller it works fine at turning on the pump.

So interference on the shift register was brought up but as far as I understand the relay board design, the shift register is only powering the LED in the optocoupler (U1) and is in no way connected to any other part of the circuit (shift register and controller were powered by battery). The board is also Active Low, so as I understand it the shift register is sinking current from the optocoupler. Could it be the optocoupler is requiring more current to switch the higher load than the shift register can sink? I may be way off as this has me baffled. Also, is there are way interference could make its way in even though it's isolated and on a battery?

All tests where done with a Battery powering the microcontroller \ shift register, and a very simple sketch that targeted only a single shift register pin by byte.

The 8-relay (Info): It’s currently configured with a separate 5V wall wart powering the Relays. The microcontroller provides 5V to power the optocoupler only.

I appreciate any help you can give me. enter image description here

Update Aug 13:

Still no go but I did a bunch more testing: I moved the shift register and Arduino 3 feet away from the relays and mains power. Both were powered by a 9V battery. The only thing connected to the relay board was a 5V rail from the Arduino and the 8 wires from the shift register to the relay board inputs. Same results, 100W light works great, pump causes it to trip out. If I remove the shift register and plug the output pins in directly to the Arduino the pump turns on without problems.

Just to verify nothing was going on with the dedicated 5V wall wart that powers the relays, I unplugged it and replaced the jumper on JD-VCC and VCC and attached the Arduino GND. Same result, 100W light works, pump causes it to trip.

It has to be shift register.

I also placed a 47uf decoupling capacitor on the power rails, as well the shift register has a 104 right next to it.

Tonight I will try putting a Multimeter in line with one of the output pins, I want to see how much current the optocoupler is pulling.

I just got an oscilloscope too, so I’m still learning how to use it but maybe I can figure out how to measure any interference on the 5V rail or in the output lines.

Update August 14:

I managed to capture it failing with my oscilloscope. Rigol wfm files below. Channel one is attached to an output pin on the shift register. Channel two is attached to the 5V rail.

WFM Files

I just did some testing and I managed to reproduce a 500mv-1V spike (sometimes it was a drop) on both the 5V rail and one of the output pins from the shift register. That's the problem right? Would that type of spike make the shift register trip out and act wierd?

August 15:

Below is a capture when I manually switch on\off the pump. Not using the shift register to do it. The Blue line is the Shift Register output pin 1, the Yellow line is 5V.

I have also taken some pictures of the setup:

enter image description here

Full Size

enter image description here

Full Size

enter image description here

I also have a forum post that I have been updating results to as well: Arduino Forum

August 16:

I was able to capture a way better picture today. I didn't realize the oscilloscope only captures so many points when running at 1 second intervals (totally makes sense now). Here is the evil emi over Pin 1 from the shift register:

2us

200ns

I'm going to pickup all the recommneded components this weekend and try adding them on one by one.

August 18:

Problem confirmed. The pump was causing so much noise that nothing I could do on the low power lines could contain the ripples. Those ripples where making there way into the shift register clock\latch\data pins and causing corruption \ resets.

So I went to the far extreme and tore out a high power APC Rack surge protector circuit and put it in front of the pump.

enter image description here

Now there is barely a blip on any of the lines anywhere. Hurray!

Now the whole point was to keep this contained in that enclosure footprint so I'm going to see if I can make a more compact version, as I think this board is overkill and I would need one for each of the 5 pumps I have. I will start with just a single MOV and see how much it cuts down the noise.

Issue Solved: I decided to buy a Line Filter to see if I could filter out the pump noise right at the source. I bought this: Delta High Performance Filter. Now I don't even get so much as a blip on the oscilloscope.

Thanks for all the help everyone, I wish I could mark you all as solvers but I can't so I just gave it to whomever offered the most tips.

\$\endgroup\$
  • \$\begingroup\$ Have you added a decoupling capacitor to the power pins of the shift register? \$\endgroup\$ – Bruno Ferreira Aug 13 '12 at 0:29
  • \$\begingroup\$ Yes, I have a 104 attached. Since it's isolated wouldn't a decoupling issue be a problem all the time, I'm asking cause im not sure? Everything works correctly if I dont plug in the pump(s). \$\endgroup\$ – Exist Aug 13 '12 at 0:44
  • \$\begingroup\$ Have you removed the jumper between Vcc and JD-Vcc? \$\endgroup\$ – Oli Glaser Aug 13 '12 at 1:17
  • \$\begingroup\$ Yes it's removed, I have a dedicated 5v wall wart connected to Gnd and JD-VCC. \$\endgroup\$ – Exist Aug 13 '12 at 2:37
  • 1
    \$\begingroup\$ Rigol WFM files, what's that? How are we supposed to read those? \$\endgroup\$ – stevenvh Aug 15 '12 at 8:35
6
\$\begingroup\$

How is the shift-register wired? Do you have a 0.1uF bypass capacitor across the power leads close to the IC package?

It sounds to me like a noise issue, particularly since it's only triggered when you have a load on the relays. The fact that it results in the shift-register register-state getting reset makes me think it's a power issue.


Also, how are you wiring the shift-register.
With a 74HC595, you need to:

  • Tie the two register clocks together (Pins 11 and 12)
  • Pull the master-reset pin high (tie pin 10 to VCC)
  • Pull the output-enable line low (tie pin 13 to ground)

Lastly, you need a 0.1 uF bypass capacitor between pin 16 (Vcc) and pin 8 (Gnd).

\$\endgroup\$
  • \$\begingroup\$ I have a 104 across the vcc and gnd of shift register. \$\endgroup\$ – Exist Aug 13 '12 at 3:09
  • \$\begingroup\$ @Exist - and you have not left the reset pin floating, or anything, right? \$\endgroup\$ – Connor Wolf Aug 13 '12 at 3:10
  • \$\begingroup\$ The only thing I can think of at this point is to try and switch a non-inductive load (e.g. a 60W light bulb, or something), and see if that also triggers the issue. If it doesn't, you're having EMI issues when your pump turns on. if it does, I'm a bit bewildered. At that point, start looking at your supply rails when the system switches, see if something strange is happening on them. \$\endgroup\$ – Connor Wolf Aug 13 '12 at 3:12
  • \$\begingroup\$ Nope, I dont even think the shift register is reseting as it continues to keep other relays on even if it can't power on the pump. \$\endgroup\$ – Exist Aug 13 '12 at 3:14
  • \$\begingroup\$ let us continue this discussion in chat \$\endgroup\$ – Connor Wolf Aug 13 '12 at 3:14
3
\$\begingroup\$

Try moving the Arduino as far away from the relay module and pump as is practical. Also make sure any (pump) power related cables are not nearby the Arduino.

Then use some twisted pair or CAT5 cable to send the on/off signal from the Arduino.

I can't open the wfm file (I guess it's some hex values but this will be hard to visualize if opened anyway), but from your description it sounds like you have captured the event.
This spike (which may be faster/larger than shown on your scope depending on BW and settings) will likely be the problem. How such a spike is getting onto your rails remains to be figured out - I think at this point a photo or two of your setup would probably help a lot, and if possible a detailed diagram of all your wiring (pump, relay module, all power supplies, arduino, etc)

Is the relay adaptor and arduino ground tied together?

EDIT - looking at the picture, the layout doesn't look great, it's a bit cramped. It seems there are mains cables going underneath the relay module - these may be coupling to the isolated Arduino side. Try to move these away if you can.
Also you should really be using the CAT5 or similar for the shift register signal - run it together with the 5V to lessen loop area.
At this point I would also try adding a couple of reverse biased diodes to 5V and ground from the shift register output, to clamp any spike that does appear (5V zener optional, but good idea if you have one)

Back to back diodes

You could also place a smallish capacitor from the line to ground (e.g 100nF) as it's only a switch signal.
To make completely sure there is no connection between anything there shouldn't be, it's probably worth testing for continuity between Arduino ground and Relay module ground, and Arduino 5V and Relay 5V.

\$\endgroup\$
  • \$\begingroup\$ Do you mean the shift register too? It's currently mounted in the power bar assembly but I could detach it and move it further away. Are you thinking it's picking up noise? \$\endgroup\$ – Exist Aug 13 '12 at 2:47
  • \$\begingroup\$ Yes, move this too and use the cable from the shift register output to the module. It sounds like it is radiated EMI if it's still happening whilst powering the Arduino from the battery. \$\endgroup\$ – Oli Glaser Aug 13 '12 at 2:51
  • \$\begingroup\$ @Exist - did you try the above? If so did it make any difference? \$\endgroup\$ – Oli Glaser Aug 13 '12 at 6:14
  • \$\begingroup\$ I did, results posted above. \$\endgroup\$ – Exist Aug 13 '12 at 20:11
  • \$\begingroup\$ Hmmm, somethings amiss here :-) If you have a scope now then start probing the signals and power during the relay switching, you should get an idea of what is happening. Post a picture of the results if you are not sure what to make of them. \$\endgroup\$ – Oli Glaser Aug 14 '12 at 4:24
1
\$\begingroup\$

This certainly sounds like an Electromagnetic Interference issue.

The Arduino power supply Ground should be connected to the "green ground" of your local power system. A blank plug with a single wire to the 'green ground' could be used.

Try to separate the pump wiring physically from the microcomputer stuff.

You also might add a "surge suppressor" MOV (Metal Oxide Varistor) across the pump to absorb the spikes that can happen when the load is switched.

What voltage and current levels is the pump?

Your wiring looks right.

\$\endgroup\$
  • \$\begingroup\$ I updated my post with some more testing. I agree it seems to be EMI, Fake was pushing me that way yesterday too. I'm having a hell of a time tracking it down though. When you say to connect the ground does that still apply if the Arduino is battery powered? The pump is 120V 1.2 Amps. Thanks \$\endgroup\$ – Exist Aug 13 '12 at 20:18

protected by Community Feb 7 '14 at 15:29

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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