I have been fighting with an issue that I think I have pinned down to EMI from a pump causing a Shift Register to reset. Here is the background (opto isolator - Shift Register output to Relays - Electrical Engineering Stack Exchange). I'm just learning but I find this stuff fascinating so I bought a new Rigol Oscilloscope and have been watching a bunch of youtube videos \ tutorials on how to use it. EMI seems like a tricky thing to detect though, so if anyone has any tips or books \ guides that could help me troubleshoot it, it would be most appreciated.
Or even any ideas on how I could reduce the EMI coming over the lines. I have tried physical separation, bypass capacitors (.1 uf and 47uf), shielded twisted pair...
Oh no not more toys! I actually looked at those first but doesn't that just let you analyze the data to and from the shift register?
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 when I turn the pump on and off. It happened every 3 or 4 attempts. That's the problem right? Would that type of spike make the shift register trip out and act weird?
Usualy helps to take a ferrite bead (or a ferrite toroid) and pass ALL the wires (including ground and vcc) through, better to wind 3-4 turns (again - ALL wires) with those wires. Fast transients noise (ie. peaks from switching regulators etc) is almost not possible to filter with capacitors, you need a ferrite beads.
Logic analyzers are useful for digital circuits; however, when looking for transient electrical noise, they are nearly useless. That is a predominantly analog issue and best suited to a oscilliscope.
I agree. My thinking was "the guy is asking about noise but I wouldn't be surprised if it is a timing issue" which was not good thinking at the time. I am biased. Timing issues are the only problem I have ever had with shift registers.
Well, in this case spurious "induced" line noise is likely the issue. My first encounter with noise induced logic state changes came from WAYYYY back when with me. I designed a circuit that used a flip flop and small reed relays... that worked great on the bench. I installed it on my model railway and all worked great until the motor in the engine got close to my circuit on the layout... then it would randomly change state... which was bad.
My fix was multi-fold: 1) better grounding 2) shorter wires 3) decoupling caps 3) 110V noise filters in front of my 5V power source.
Thanks for all the tips so far guys, I'm trying it all. I wish my testing consisted of watching a train though, watching my pump splash water on the floor is getting old fast
I have had some lucky breaking my circuit down. I have managed to get a consistent working response if I only connect the power and a single output pin from the shift register. I was initially testing with all 8 outputs connected from the shift register to the relay board. Those wires where all going through a single cat 5 cable which may have been part of the problem...
This time I will try multiple shielded cat5 cables, with a 5V and ground as a pair, and a pair for each signal wire twisted with ground. I looked around and I don't have any ferrite beads so I pick some up this weekend along with the other items mentioned.
One thing that has me unsure is the way the relay board is active low, so all the input pins on the relay board are outputting 3.3V. I programmed the shift register reversed I.E. 255 is everything off, 0 is everything on. So to keep everything off the shift register is sending 5V to all the pins, on is everything grounded. Does the fact it works like this make it more or less susceptible to emi, or overloading a shift register?
I will take some pictures too, as maybe I have unknowingly created a mega EMI antenna or something.
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:
Better grounding to avoid the antenna effect... good plan.
so all the input pins on the relay board are outputting 3.3V.
Which makes it sound like your board has pullups on the input pins... so it does make some sense.
As to being better or worse? Well, it is usually easier to Interface equipment that was not specifically designed to work with each other, in an ACTIVE low mode... EXAMPLE: using an Open Collector output transistor to drive the input low. Pulling an Input low in this case (with an open collector signal) avoids the problem of a disparity between supply voltages since you are only pulling the input pin to GND potential.
You can call me crazy here... but I actually think you would have better results in this case with a 74HCT596 instead of a 74HCT595.
Have you watched the 5V hacked wall-wart power supply current/voltage values when relays are engaged?
Thanks PWillard, that makes so much more sense now. I will grab some 74HCT596 this weekend too. The Wall Wart is the one thing I haven't watched yet so I will give that a try. I did scope the latch, data and clock pins on the shift register during a relay activation and they all have that same EMI spikes in them. It's worth noting too that the spike on happens 1 in 10 times I try, that or I'm missing it with the scope.
So I bought a bunch of stuff today that was recommended. First up is the inductors, I wasn't sure which ones to get so I got a bunch. Which one would work best, and how many times should I rap the wire around? I can use the same farrite and rap all 8 wires around it correct?
I found some really interesting results today that I figure I should share:
I tested the dedicated 5V wall wart that powers the relays as suggested and I found the same huge spikes in it (swings of 3V+).
Out of curiosity I went to another room (different mains circuit than the pump is on) and plugged a spare wall wart in with the oscilloscope monitoring it. When I monitored it as the pump was turned on and off it measured voltage swings of over 3+ volts (2-8V). Just to be clear, this wall wart had nothing connected to it just the oscilloscope monitoring it, with the pumps and relays in a completely different room on a different circuit. So I’m assuming the pump is causing a ton of noise on the mains throughout the whole condo which the wall warts aren’t able to completely filter.
Even the oscilloscope itself was registering 3V+ swings when I connected a 10K resister between the ground and probe if it was plugged in next to the pump.
Problem solved or should I say confirmed. The pump was causing so much noise that nothing I could do on the low power lines could contain the ripples.
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.
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.