Relay Interference?

I’m trying out a Fez Connect Relay module on a Panda II w/ the Fez Connect shield and evidently having some interference problems with interrupts and socket communication. When a small 12VDC motor hooked up to the relay turns on, socket communication between the Panda client PC server dies, i.e, a socket connection that has been open and working suddenly closes. Further, a callback on a rising interrupt (which is designed to shut off the motor when called) is called when it shouldn’t be. When i turn the power supply off to the motor so the relay turns on but no 12VDC power is happening, both the interrupt and the socket communication work fine. When I replace the motor with a 12VDC light bulb, socket communication is fine, the interrupt calls inadvertently once, then works fine. When the light bulb is hooked up and being controlled by the interrupt and i hook up the motor independently to the same power supply, both problems happen. Anyone have any similar experience? I’m not sure what the 5V power and ground wires to the Relay module are for or if they could be contributing to the problem. I tried to hook up the relay with just a signal wire and it wouldn’t come on.

Is the 12V power supply also running the Panda II?

If so, you need better filtering in the 12V->3.3V DC-DC power supply. If you’re using the onboard Panda II linear regulator, I’m sure someone here could suggest an easy fix. It might be as simple as a couple filtering caps, I’m not sure.

The motor is an inductive load, they wreak havoc with everything they come in contact with. The light bulb is a resistive load, they’re very friendly.

No, the Panda is supplied through the USB/laptop. So the only connection between the motor and the Panda is through the power supply and relay. I notice that when the power supply is disconnected from the relay, running the motor independently but on the same power supply does not mess with the network communication but can cause the rising interrupt callback to fire. When the relay is disconnected from the Panda, there is no interference at all from the motor. Also the Panda has frozen a few times requiring rebooting when running the relay and motor.

I’d be interested in hearing about possible fixes for the interference. Not sure if i’m using the Panda on board linear regulator–i guess i assumed i was.

I also guess that the relay requires the 5V from the FEZ Connect shield to operate but would be interested in knowing if that is so and if i can power it from an independent source to see if that reduces the interference.

Yes, it seems you are using the onboard regulator (converts USB’s 5V to USBizi’s 3.3V).

Do you have a back-EMF protection diode on the relay’s coil? The relay’s coil is also an inductive load (they’re everywhere, the nasty things), so when it turns off, it dumps a bunch of current back into the wires. A diode placed backwards across the coil gives this current somewhere to “go” (it essentially heats up the diode a bit).

I don’t have any back-EMF protection and could possibly try something. Thanks. Although i don’t know how to connect a diode (backwards or forwards) across the coil of the FEZ relay as it looks like a little black box to me.

I did hook up the relay power to 5V from the power supply rather than use the connector from the Connect Shield. Then hooking up the signal from a GPI/O on the Panda, the relay was able to switch on the motor without interfering with the network but it still interfered about half the time with the rising interrupt callback by causing the callback to fire when it shouldn’t. I’m playing w/ the glitch filter time to see if i can improve the callback performance but not having any luck yet.

My next plan is to try a different relay.

You’re using the relay eblock?

Yes, the GHI e-block relay.

Are you sure there’s no diode on the eblock? Seems like there ought to be. With the proper filtering, there shouldn’t be any ill effects on the Panda when switching the relay. You shouldn’t need anything like a glitch filter on an interrupt line. To me, it seems like improper isolation and/or noise caused by the relay or load.

Have you tried running the system from a separate power supply instead of USB?

Frankly, i would have thought the e-block would have some kind of protection, but i don’t know and haven’t heard about it. Haven’t seen any discussion in the documentation beyond how to plug it in to the Connect Shield and hook up a load. I haven’t tried running the Panda from a different power supply as i ony have one to which i hook up the motor. I will try that and see what happens, but i would guess it would open the door for more interference rather than less–but who knows?

On the eblock there should be a diode. It’d look like a smooth black resistor with a silver band on one end. If there’s not one there, I’d try adding one.

Depending on how much current the relay draws (and whatever else you have attached), the USB port on your computer may not be supplying enough, and the voltage may be sagging, causing all sorts of weirdness. Use a powered hub, or a separate power supply.

Things can also get weird when you use multiple power supplies (such as you are, where one is the USB port and the other is the 12V supply) because of possible ground potential differences.

Can’t see anything that looks like what you describe, but there are four very small black objects on the IC. I think i’ll p/u a magnifying glass to help my old eyes. If I were to add a diode “backwards across the coil” I don’t really have a clue as to where to attach. GHI should be able to tell us if there is a diode or other shielding on the e-block relay. Hello?

Right now the relay is being powered by an external 5V supply which eliminates the interference when switching the 12V light bulb and reduces the interference when switching the 12V motor. On the Panda I have a digital liquid level sensor, three Dallas thermometers and an analog pH sensor as well as the Connect shield w/ ethernet connection. I will look into how to connect an external power supply, but right now, the only one i have is powering the motor/lamp and e-block relay.

Thanks for your help with this.

@ matt5 - there’s a crude schematic on the following thread where I have a diode wired across a relay. Maybe it will help you understand.

http://www.tinyclr.com/forum/20/6567/#/1/

When a mechanical relay switches an arc will form across the contacts. You can think of this arc like a small spark gap transmitter, it puts out a wide band of RF and can cause ripples in the voltage source being switched as well. Switching high current and/or inductive loads greatly increases the amount of noise generated.

There are special RC ‘snubbers’ made to place across relay contacts that help to reduce the arcing. take a look at: http://www.galco.com/comp/snubber_network.htm , some folks prefer to use a transorb instead of the RC network.

When controlling motors I always suggest adding a line filter to the AC (mains) feeding the motor as close to the motor as possible; i.e. for a simple induction motor, right before the motor, if the motor has a speed control then right before the speed control. For example: Soigeneris - your resource for hi-tech hobbies (my website). I use these for the spindle motors on small machine tools.

All of this arcing and electrical noise plays hell with USB connected devices. I have a small florescent lamp above my workbench in the shop that will kill all the USB devices hooked to my shop PC when the lamp is switched on/off. Investigating this with the scope I found that switching the lamp caused an 8vPP spike a few ms long on the USB +5V supply! It dipped below ground by 1~2V. A line filter placed in line with the AC feeding the PC greatly reduced the problem. (I have a two stage line filter to test but have not had the time to do so yet.)

Jeff_Birt and ianlee are better at this than I am :slight_smile:

You’re funny, godefroi :wink:

Thanks for the info, IanLee and Jeff. I haven’t had time today to study up, but here are a couple of quick observations:

IanLee – i think i see a diode across the power leads to the relay in your schematic. Should i be concerned about diode spec, as in, do they come in different sizes? Showing my complete ignorance.

Jeff–my inductive loads are all 12VDC. The line filters you describe are for AC. Do they work for DC loads or should i be looking for something else?

Another question: are there solid state relays that aren’t inductive loads? E.g. I have a SparkFun PWM motor driver ( http://www.sparkfun.com/products/9457 ) that i could use in place of the relay. Would i expect less interference from the driver than the relay? I know i still need to deal w/ the motor itself.
In email discussion with GHI whether or not there is a diode or other shielding built into the e-block relay.

Now I get to show my ignorance… I’m no EE. I have a bag of rectifier diodes that I picked up at Radio Shack a year ago. I think they’re good for up to 40V (forward) and 400V (reverse) which is well within the range of most projects I deal with. I can’t read the part number on them or I’d share that with you. There are two voltage numbers generally associated with diodes the max forward voltage (the max you can put into the diode) and the max reverse voltage (the most the voltage can keep out before it allows the circuit to flow backwards). There are plenty of sites on the web that can explain the meanings of these numbers in detail. I’ve been using these diodes w/o any problems an all my FEZ projects. So, I tend to think they’re very tolerant when it comes to low voltage circuits. Someone here can probably tell you all you want to know and more. We’ll learn together :wink:

SSRs aren’t inductive loads, but you’re still switching an inductive load.

Thanks, guys. I’m curious how to best quiet a cheap chinese 12VDC motor. I’m using several in my project.

Replace it with a better, quieter motor or put it in an enclosure. I think that’s one of the “features” you get with cheap Chinese motors :slight_smile: