Relay design with large coil loop - Page 1
Forum section: electronics / projects

author: madwolfe
author_rank: Contributor
timestamp: November 24, 2020, 10:00:59 am
content: I'm designing a circuit that is enabled by a relay and the switch to the circuit must be ~2m away from the rest of the circuit.I need to minimise both emissions and immunity, is this a reasonable design for that? I'm not a big fan of the fact that I have a long wire connected to ground going out like an antenna but I don't have too much experience with whether this is a problem or not. The cable is shielded but regardless...Note that the RELAY_OUT node isn't actually how it looks like, I was just doing it like that to be able to see the voltage there and test whether it was working.Any thoughts on how I could improve this? Or is it actually an issue?

author: gcewing
author_rank: Regular Contributor
timestamp: November 24, 2020, 11:24:56 am
content: If there are problems, you could connect a capacitor from the gate of the mosfet to ground. That would form a low pass filter with R1 for any noise picked up by the wire, and might also help to reduce emissions. Another thing you could do for emissions would be to put ferrite beads on wires going in and out. But all of this might be overkill, you'd have to try it to find out.

author: madwolfe
author_rank: Contributor
timestamp: November 24, 2020, 12:03:37 pm
content: Good idea with the capacitor but I'm not super worried about noise being injected to ground through the FET, I feel like it's the other ground wire which would be worse.Ferrite beads are a good idea, perhaps if I do a LC filter with them it will smooth out the worst of the noise. It doesn't need to be super noise immune, I'm more concerned with the emissions

author: madires
author_rank: Super Contributor
timestamp: November 24, 2020, 12:41:40 pm
content: With a p-ch MOSFET connected that way the relay will be always powered because of the MOSFET's body diode.

author: madwolfe
author_rank: Contributor
timestamp: November 24, 2020, 01:21:33 pm
content: Quote from: madires on November 24, 2020, 12:41:40 pmHuh, good catch! I think actually that's Microcap showing the wrong symbol... I selected a FDN337N (N-ch) in it and the simulation worked perfectly

author: Siwastaja
author_rank: Super Contributor
timestamp: November 25, 2020, 10:57:42 am
content: The freewheeling diode is in the wrong place (well the net is the same, and it simulates the same nevertheless, but they way it's drawn, I'm expecting you lay it out next to the relay, which is wrong). Place it right next to the MOSFET. Remember bypass capacitance between the ground and supply at the diode-MOSFET site.As suggested, add extra C on the MOSFET G-S. It offers at least some minimal ESD protection as well. An added zener would be a great idea, to keep the gate at some 10V max and at the same time, clamping negative voltages.

author: voltsandjolts
author_rank: Unknown
timestamp: November 25, 2020, 11:23:34 am
content: Quote from: Siwastaja on November 25, 2020, 10:57:42 amIt's not wrong.

author: Siwastaja
author_rank: Super Contributor
timestamp: November 25, 2020, 03:35:56 pm
content: Not wrong in the sense of moral, but wrong in the sense of proper, optimal engineering. It's often done that way for convenience, though. The OP gave the impression that EMI is a concern. Sometimes it matters, sometimes it doesn't. Just remember it may for this case. Slowing down the edges highly recommended, which the 1k gate resistor does, so there likely is no problem either way.Another thing to remember in this can of worms for OP is, make sure you understand the consequences of using a freewheeling diode instead of the other clamping strategies (zener, TVS, resistor) regarding the switching time and contact arcing. May be a problem sometimes, often isn't.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: November 25, 2020, 07:12:35 pm
content: How a about a piece of string?About 2 meters worth.

author: madwolfe
author_rank: Contributor
timestamp: November 26, 2020, 02:56:47 pm
content: Quote from: Doctorandus_P on November 25, 2020, 07:12:35 pmHa! Unfortunately I don't think it would be optimal in this case.Quote from: Siwastaja on November 25, 2020, 03:35:56 pmWhy is it that the flyback diode must be closer to the FET rather than the relay? The relay coil is what is producing this flyback voltage so wouldn't it make sense to suppress it as close to the origin as possible?In terms of using a diode, it's expected to switch once every couple of days when it is powered on so I'm not requiring fast switch rates etc

author: madires
author_rank: Super Contributor
timestamp: November 26, 2020, 03:15:35 pm
content: Quote from: Siwastaja on November 25, 2020, 10:57:42 amThen it would be in parallel with the MOSFET's body diode in case of an n-ch type?

author: Siwastaja
author_rank: Super Contributor
timestamp: November 26, 2020, 05:51:28 pm
content: Quote from: madwolfe on November 26, 2020, 02:56:47 pmNo, the flyback voltage is generated because theswitchinterrupts the current flowing in the inductance. The inductance tries to maintain the current, generating a high voltage when there is no path for the current.Inductance is the coil inductance + wiring inductance in series.If you provide flyback diode at the coil, you don't provide flyback path for the wiring inductance, which still generates a spike, obviously with much less energy though. So if you really want to add a diode at the coil, please add another at the switch.The diode at the switch provides path for the current because the diode is where the interruption of current happens, the switch.This is discussed again from time to time, refer back to the previous iteration I remember:https://www.eevblog.com/forum/microcontrollers/driving-a-relay-and-led-from-microcontroller-pin/msg3251048/#msg3251048That thread shows quite well the origin of the misunderstanding: some think the relay coil createscurrentspike, and having more loop for that "current spike" would be the problem. In reality, the current is continuous; that's what inductance does by definition, and that's why the freewheeling diode is added; to preventvoltagespike.This is BTW the exact same condition than with a buck converter or a motor controller, yet no one EVER suggests placing the diode further away from the switch, quite the opposite the importance of tight loop (consisting of the two switches + bypass cap) is always emphasised. I guess these applications are more demanding and the wrong diode placement results in magic smoke or other obvious problems, forcing the designer to learn from the mistake. In the case of relay, MOSFET is typically slowed down (for example, with Rg=1k as here), and edges happen rarely (like once ten seconds, not hunderd thousand times a second), so the problem is reduced, or there may not be any actual problem at all.Also, it seems, for some this is about not losing face, and for some, this is about a popularity contest. They pop up every time to poison the threads but can't provide any strong arguments. This is just silly but I think we have to live with that. As a professional designer whose design will be subjected to EMC measurements, you are finally the one who's responsible for figuring out the truth, and for that, you should have enough pointers already. Simulate, test & measure instead of listening to disagreeing interwebz comments.

author: Siwastaja
author_rank: Super Contributor
timestamp: November 26, 2020, 06:14:15 pm
content: Quote from: madires on November 26, 2020, 03:15:35 pmOf course not.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: November 26, 2020, 06:23:10 pm
content: For optimizing the Coil and Fet switching part, do a bit of research on "hot loop" in the context of SMPS circuits, but if your relay ain't monstrously big then PCB layout probably is not very critical and a simple catch diode anywhere in the loop is probably good enough.For the long wires on the MOSfet...First, I've never seen a MOSfet that can tolerate more then 20V on it's gate, so you have to use a voltage divider there.For wires going off a PCB, a bunch of other considerations become important such as EMC and ESD.So if you've already got a few resistors as a voltage divider then add a capacitor and/or inductor to do some filtering, and add a (12V or so) TVS into the circuit just to be sure.If you're worried about EMC radiation from the GND plane into your long wires (which is a valid concern) then add a resistor and inductor or a ferrite bead in series with the GND lead of your switch.EMC is a pretty big subject and many books have been filled with it.

author: madwolfe
author_rank: Contributor
timestamp: November 27, 2020, 09:07:47 am
content: Quote from: Siwastaja on November 26, 2020, 05:51:28 pmVery interesting! Learnt something new today! It makes a lot of sense that dI/dt originates at the switch but it is a bit uninintuative to me

author: madwolfe
author_rank: Contributor
timestamp: November 27, 2020, 09:17:49 am
content: Quote from: Doctorandus_P on November 26, 2020, 06:23:10 pmgood catch on the max V_GS, that's what I get for rushing designs... (and the limit with depending on simulations!)I have already added a couple of ferrite beads, I didn't want to add a resistor because I then at DC I end up with a voltage divider (with the pullup resistor) at the gate that doesn't fully pull it down to 0V

author: voltsandjolts
author_rank: Unknown
timestamp: November 27, 2020, 07:47:26 pm
content: Quote from: Siwastaja on November 26, 2020, 05:51:28 pmLucky you. I wish my designs were only subject to EMC requirements, life would be much simpler.You stated that placing the diode at the relay is wrong, which I object to because it's not necessarily wrong, although quite possibly sub-optimal. My quip was deliberate to mirror your equally short dismissal of that strategy. It's a design compromise which depends on a number of things; simplicity, cost (often the main culprits) then perhaps EMC and field collapse time, which if too slow can of course cause arcing at the relay contacts, depending on load. Often times people 'choose' to put a diode at the coil because it 'seems to work' without being aware of arrangements that might be better in their scenario, which is a shame. Now I think about it, I don't think I've designed-in an armature relay to anything for about 4 years.