# Need a protection diode if only connected by common ground?

I have many solenoids running on 25VDC. Some are controlled by MOSFETs which are powered by a 5VDC circuit, and others are controlled by physical switches in the 25V lines. The 5V and 25V circuits have a common ground. I put protection diodes on the solenoids that are MOSFET controlled, but I'm not sure if I need them on the switch controlled solenoids? I've been running into a weird phenomenon where if I activate the switch controlled solenoids enough then the MOSFET controlled ones will start randomly firing in unison, and the only reasoning I can come up with is that the surge from the solenoids is going over the common ground or something and messing with the MOSFETs. If I do need a protection diode on the switch controlled solenoids, would it be possible to just put one in parallel with their busses to protect all of them?

(ignore the upper switch connected to the transistor, that's not what I meant by switch controlled. the upper switch is actually an arduino out with a 10k pulldown resistor)

You do need the protection diodes. When you activate a solenoid, it creates a magnetic field. This is what causes the mechanical action. This magnetic field also represents stored energy. How much? Well, a solenoid is an inductor. The energy $E$ stored in an inductance $L$ with current $I$ flowing through it is:

$$E = \frac{1}{2}LI^2$$

When you interrupt the current by opening the switch or turning off the MOSFET, the magnetic field goes away. But if it's stored energy, it can't just vanish. It must be converted into an equal amount of energy somewhere else.

Another property of inductors is that the current through them can't change instantly. It changes at a rate proportional to the voltage applied to them:

$$\frac{dI}{dt} = \frac{V}{L}$$

If the inductor can't find a place to keep the current flowing, then it will make one, perhaps by making a spark across the switch or frying a transistor.

The diode is there so that the inductor only needs to make 0.6V to keep the current flowing. The current can then flow in a loop around the inductor and the diode until all the energy has been converted to heat by the resistance of the diode and wire in the inductor.

simulate this circuit – Schematic created using CircuitLab

If you close SW1 for some time, a large current will be flowing in L1, limited only by its internal resistance. When you open the switch, that current can keep flowing through D1. The voltage across the inductor will be about 0.6V, because this is what it takes to forward-bias a silicon diode, and the current will die down at a rate given by the 2nd equation above.

You can not share one diode like this among several inductors. The point of the diode is to give each inductor a place to dump its stored energy that doesn't affect something else. If you are sharing diodes then you aren't doing this.

There seems to be another problem with your circuit: the gate of Q1 is floating when J1 is open. That is, it isn't connected to anything. This will make it very sensitive to stray electric fields (like, the really big one set up when S2 arcs across J2 because there's no diode). I bet you can also get it to turn on and off randomly by touching it with your finger. Add a resistor of maybe $10k\Omega$ so that it's either definitely on or off (it's hard to tell which you intended) when the switch is open.

I've modded your circuit with notes. I'm sure the mosfet being upside down is a circuit diagram mistake but unless you put pull-down resistors on the gates to 0V they'll be triggering on any amount of EMI local to the circuit. I'd use 10kohms.

I'd also put diodes across the loads being switched by normal switches too, if only to elongate the switch's life and reduce EMI.

• yes, the upside down is just a circuit mistake. I only use the diagram software to make rough sketches Jun 10, 2013 at 18:27
• @zacaj does this mean that maybe you did actually fit a pull-dwon resistor to the gate? Jun 10, 2013 at 19:12
• yes, I did that too. Since these replies have been put up I went and soldered diodes onto every solenoid and it's still not working :\ The transistors are actually being controlled via an arduino. I suspect the voltage is somehow overflowing the control pins or something now... Jun 10, 2013 at 21:45
• @zacaj dude, what was the point of the circuit diagram if you fitted pull-downs but didn't show them. -1 Jun 10, 2013 at 22:01

For an ideal inductor with a given inductance, the rate at which current changes and the voltage in the inductor will always be proportional to each other. Apply voltage across the inductor and the current will change at a rate proportional to the voltage. Force the current to change and a voltage will appear across the inductor proportional to the rate of change. In many situations, the fact that current changes in response to applied voltage will limit the extent to which external circuitry can hold a voltage across the inductor, and the fact that voltage appears across the inductor in response to a current change will limit the extent to which circuitry outside the inductor can force the current to change, but with an ideal inductor the proportional relationship holds absolutely.

A typical real inductor will behave much like an ideal inductance in series with some resistance. This resistance will create a difference between the voltage applied to the real part and the "ideal inductor" voltage; the biggest effect of this is to cause the voltage across the ideal inductance to drop as the current increases. Nonetheless, if current is flowing through a real inductor, stopping it will require a voltage essentially proportional to the desired rate of change. If one tries to stop the current instantly, the voltage will increase as much as necessary for the current to find a path. If the current can't find a path at a voltage which is low enough to avoid damaging anything, then the voltage will cause damage.

One point which is often not mentioned in discussions of solenoid driving is that using a flyback diode to limit the voltage that appears across an inductor will limit the rate at which the inductor can be switched off. This may cause the mechanical behavior of the solenoid to be "spongy". Adding a resistor or Zener diode in series with the flyback diode may improve the mechanical performance, at the expense of increasing the voltage seen by the switching transistor. Such components will dissipate the flyback energy as heat. Alternatively, if one switches both the high and low side of the coil, and diode-clamps clamps each side to the opposite rail, one may arrange to have the flyback energy dumped back into the supply. If one does this, one must ensure that the supply has enough capacitance to absorb such energy safely, but in some cases recapturing the flyback energy from a frequently-exercised coil may noticeably reduce the amount of power required by a device.