7

When using a diode to deal with the back EMF from a solenoid, common advice is to put the diode as close to the solenoid as possible. Indeed, in pinball machines, I've seen diodes soldered directly to the solenoid's contacts.

I've got a solenoid valve that's sealed (IP 65). Instead of contacts, it comes with wire leads that at are each about 15 inches (almost 40 cm) long. I assume the diode should be closer to the solenoid, and that I should cut the leads much shorter. Is that correct? Or does the distance not matter as long as the diode is closer than the switching circuit that drives it?

Is there a reason solenoids aren't manufactured with snubber diodes built in? It seems the solenoid itself generally dictates the diode selection (at least for low-frequency activation that you would expect from valves).

(I've found answers to related questions, but not one that directly addresses the distance issue, especially when the solenoid comes with long leads.)

Adrian McCarthy
  • 212
  • 2
  • 9
  • 3
    The long wires add a little bit to the inductance of the solenoid. And they add a little bit of resistance, too. But that could just as well be inside the solenoid itself and the parasitic values are likely much smaller than the solenoid's values. I wouldn't worry too much about it. Especially if this is a pinball machine. – jonk Mar 22 '21 at 04:48
  • 1
    If you want faster relaxation of the solenoid, add a series zener arranged in the opposite polarity direction as the diode. Requiring a higher voltage causes a smaller time period needed in order to discharge the stored magnetic energy. – jonk Mar 22 '21 at 04:50
  • Ah, let me see. (1) A solenoid is basically an inductor, that take DC current. (2) For hobbyist 12V, 0.5N, to say 4.5N, solenoids (I guess that is similar to pinball machines, The current passing through the inductor should be in range of 300mA to 4.5A. (3) When the solenoid is on the energy stored is 1/2 * L * I^2 (Note 1). (4) When you switch off solenoid current, the back EMF and huge but short time (Note 2) current flies back through the Shottky diode, (5) Now the wiring from solenoid input contacts to the diode should be short & thick, if possible, to avoid unnecessary heat energy loss. – tlfong01 Mar 22 '21 at 04:56
  • If you are using solenoids like those small to medium guys in this post: Solenoid inductance and energy stored - tlfong01 Rpi.org.forum https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=234552&p=1437882&hilit=solenoid+tlfong01#p1437882, I guess flyback energy is small, and there little to worry about length and thickness of the wriing. – tlfong01 Mar 22 '21 at 05:04
  • 1
    For EMI you often put the diode/varistor/snubber directly *on* the solenoid, in the valve connector. It's even nicer since they sell them ready to use – Lorenzo Marcantonio Mar 22 '21 at 09:11
  • 1
    @jonk If you consider wires about are 1uH/m and solenoids are ~ 1H, there's no incremental effect except the loop radiation pattern, but the discontinuity from the switch current path and diode current path is the path where this transition radiates most if the diode is across the coil. and by reducing this unintended radiator as short as possible with twisted pair and with diode across switch as I answered. – Tony Stewart EE75 Mar 24 '21 at 10:22

2 Answers2

11

In the absence of some means to dissipate the energy stored in a solenoid, when the solenoid is switched off, it can induce high voltage spikes. The free-wheeling diode is there to provide a current path to "snub" these voltage spikes.

If the solenoid is switched by a semi-conductor switch, then it is a primary function of the diode to protect that switch. Semi-conductors are not very tolerant to high voltage spikes. If the solenoid is switched by a relay, the voltage spikes might cause arcing and burning (or welding) of relay contacts. Additionally, one end of the solenoid is often connected to a power supply rail. Voltage spikes may travel through the power rail and damage other parts of a circuit, so the diode also has the responsibility to protect those other parts.

As fraxinus points out in a comment, high voltage spikes can cause breakdown in the insulation in the solenoid, and damage the solenoid itself, so the diode needs to protect the solenoid.

Also, as TonyStewartSunnySkyGuyEE75 points out in comments and in his answer, the collapsing magnetic field may induce voltage in other wires that are not directly connected to the solenoid circuit, i.e. through mutual induction.

The leads of the solenoid have inductive properties just as the solenoid does. To reduce the inductive effects of the leads they should be twisted together.

In the industrial equipment that I have worked on, the switches for solenoids were always enclosed in metal cabinets, whether the switching device was a relay or transistor. The diodes would be on the circuit board for the transistor, or the mounting socket for the relay. I have also seen a pin-ball machine which had diodes soldered directly to solenoids. One difference between these two cases is that the solenoids in industrial settings were environmentally sealed, whereas the pin-ball machine had open wiring underneath the playing surface, and the solenoids were environmentally exposed within that area. Another difference is that the distance between the switch and the solenoid was much greater with industrial machines. Yet a third difference was that, at the time, mosfets were quite expensive, quite prone to failure, and circuit boards in general were expensive. Far more expensive than a solenoid, even a solenoid activated valve. Thus, protecting the circuit-board was paramount. Although the pinball machine had several circuit boards, it mainly relied on electromechanical switches and relays, the relays being comparable in price to the solenoids.

Whether the freewheeling diode should be placed nearer the switching device, or nearer the solenoid, is a design decision whose answer depends upon quite a few factors. If one's main concern is to protect a circuit board, the diode should probably be on the circuit board. Otherwise, factors such as ease of testing, ease of fabrication, ease of access and replacement, concerns about electrical noise etc. may play a significant role in the decision of where to place the free-wheeling diode.

A final note, added at the suggestion of TonyStewartSunnySkyGuyEE75. A single diode is not the only method to "snub" a magnetic device. The peak voltage spike occurs immediately upon the opening of the switch. To reduce the amplitude of this spike, a capacitor may be added. A (non-zener) diode may not dissipate energy fast enough for some purposes. So, a resistor may be added to aid in energy dissipation. In short, a variety of topologies are available.

Math Keeps Me Busy
  • 18,947
  • 3
  • 19
  • 65
  • 2
    The diode / capacitor / both pretty much protect the solenoide as well as the switch. Back EMF of a tyipcal electromechanical solenoide is pretty much able to kill the solenoide itself. The insulation between windings is generally rated for "on" voltage and not much more. – fraxinus Mar 22 '21 at 16:44
  • Good point. Please write an answer, and (if I agree) I will suggest that your answer be the accepted one. – Math Keeps Me Busy Mar 22 '21 at 16:57
  • IF one uses a relay with dry contacts to switch the solenoid, you want the diode directly across the coil leads and **nowhere else** , unless you understand the crosstalk of dI/dt= V/L when dt goes to near zero. Therefore -1 Even better is a RC snubber and Zener+diode if EMI impulse noise is an issue and solenoid return speed is an issue. – Tony Stewart EE75 Mar 23 '21 at 21:13
  • 1
    @TonyStewartSunnyskyguyEE75 the question says nothing about a relay, nor about wetted, nor dry contacts, etc. But if you want to downvote, that is your business. – Math Keeps Me Busy Mar 23 '21 at 21:55
  • THe question is about the optimum location for the diode ( for any application) > So on the technical reasons I gave there are times when it is the only right location. This is one of two reasons why it is never included across a solenoid or relay coil – Tony Stewart EE75 Mar 24 '21 at 01:10
  • people who downvote without giving a reason are confused about constructional feedback on errors. When no assumptions are given, all the more reason to use the worst case reasoning. WHen more people agree with that, what is being taught? – Tony Stewart EE75 Mar 24 '21 at 10:12
  • The diode is ALSO used to reduce the slew rate (LI/R) and also prevent interference with analog and logic by reducing reduce interference, not just to protect the switch. – Tony Stewart EE75 Mar 24 '21 at 10:24
  • @TonyStewartSunnyskyguyEE75 "people who downvote without giving a reason are confused about constructional feedback on errors." Why is this comment under my answer? I did not downvote your answer. I once saw where you accused Andy and he downvoted your answer just to show you he hadn't. Would you like me to do that? – Math Keeps Me Busy Mar 24 '21 at 11:38
  • I cannot control others uncivilized behaviours, perhaps its a misunderstanding but did you disagree with my comments about the ideal location? – Tony Stewart EE75 Mar 24 '21 at 11:41
  • @TonyStewartSunnyskyguyEE75 I am asking you about your behavior. Why is this comment about "people who downvote" under my answer? – Math Keeps Me Busy Mar 24 '21 at 11:42
  • It was intended for the -1 person who may have agreed with your comment that the choice of switch was irrelevant since it was not asked – Tony Stewart EE75 Mar 24 '21 at 11:43
  • The purpose a the diode is more than just to protect the switch, or ease of replacement, perhaps you could have described the dynamics of Rs of the diode during turn-off and trade offs of diode power impact on several parameters to explain why location matters and what size is best as it’s job is different than a SMPS diode. – Tony Stewart EE75 Mar 24 '21 at 22:55
8

Generally the difference is radiated EMI Since you want to have twist pair wires to reduce the EMI to lower the differential EMF , and the current comes from some switch, you want to continue the current path along the same twisted loop with the diode across the switch, as the current continues and the voltage collapses with current decaying. Diodes also slow down the solenoid return from T=L/Rdiode being larger than a snubber or Zener + a diode that can handle it.

  • so across the switch/ diode combo is best so you don’t get a large dI/dt between the switch and the diode across the coil , radiating an H field noise impulse.

Conclusion

There are many ways to protect a switch of any type from flyback arcs in air or high voltage on semis from turning off a magnetic coil current. The reasons given are one why it is not provided. The other is that are faster ways but more parts to create a dampened safe flyback.

Yet for light loads on relays, this diode across the switch is the most common.

Tony Stewart EE75
  • 1
  • 3
  • 54
  • 182
  • Here I put in 2 diodes for you purpose to analyze charge flow simulation where abrupt stops implied high frequency dI/dt or power radiated dP/dt https://tinyurl.com/yz5ykbvm – Tony Stewart EE75 Apr 11 '21 at 22:03