My MOSFET operated solenoid circuit destroys my Arduino inputs

Your valve is rated at 500mA at 12V. If you supply 16V it will draw somewhat more than 500mA. Assuming it is a resistance, it will draw 667mA.

The absolute maximum current for the MOSFET you used is 500mA continuous. Anything above absolute maximum ratings may destroy the device. This is probably why you are seeing reliability problems.

There is no guaranteed failure mode for MOSFETs, so I'm not surprised that it would fail in such a way to damage the Arduino outputs.

As Jason mentioned in the linked answer, BS170 is a poor choice of MOSFET. You need a better one. Choose one in a TO-220 case that is rated at several amps. You also need to make sure the Vgs is rated for 5V logic-level drive.

Which diode are you using?


The circuit is fine in theory.
Improvement in practice is required.

Adding a gate-source zener diode of say 12V (> Vgate_drive) is a very good idea indeed in all circuits with inductive load. This stops the gate being driven destructively high by "Miller capacitance" coupling to the drain during unexpected or extreme variations in drain voltage.

Mount the zener close to the MOSFET.
Connect Anode to source and Cathode to gate so that the zener does not usually conduct.

The 10k gate drive resistor (as shown) is large and will cause slow turn off and on and more power dissipation in the MOSFET. This is probably not a problem here.

The chosen MOSFET is very marginal in this application.
Far far far better MOSFETs available ex stock at Digikey include:

For 26c/10 Digikey IRLML6346 SOT23 pkg, 30V, 3.4A, 0.06 Ohm, Vgsth = 1.1V = gate threshold Voltage..

NDT3055 48c/10 TO251 leaded 60V, 12A, 0.1 Ohm, Vgsth = 2V

RFD14N05 71c/10 TO220 50V, 14A, 0.1 Ohm, 2V Vgsth.


ADDED

SUITABLE MOSFETS FOR 3V GATE DRIVE:

System just trashed my longer answer :-(. So - MOSFET MUST have Vth (threshold voltage) of no more than 2V to work properly with 3V3 supply controllers.
None of the suggested FETS meet this requirement.
They may work after a fashion on the present load but are underdriven and overly lossy and the solution does not extend well to larger loads.
It seems that IRF FETS in size range concerned that have Vth (of Vgsth) <= 2 volts ALL have 4 digit numerical codes starting with 7 except IRF3708.

OK FETs include IRFxxxx where xxxx = 3708 6607 7201 6321 7326 7342 7353 7403 7406 7416 7455 7463 7468 7470

There will be others but all the ones suggested seem to have Vth = 4V or 5V and are marginal or worse in this application.

Vgsth or Vth needs to be at least one Volt less and ideally several volts less than actual gate drive voltage.


Your valve is rated for ~ 500 mA. A BS170 is rated for 500 mA too, but that is the sales-pitch figure. I would use a (much) higher rated FET here, 500mA through a TO92 makes me nervous. And you have a 1k gate resistor, which is a good idea in most cases, but it might cause the poor FET to switch too slowly to survive the 0.5A.

What diode are you using? It must be rated for the 0.5A, so a 1n4148 won't do. I am not sure, but it might actually get more than 0.5 because the moving part of the value might cause an even larger spike than a plain coil would.

In your picture you have the value return current flowing past the Arduino ground connection. I would cange that to a star: connect the arduino ground to directly to the power supply. Or much better: use an optocouple to isolate the high-current circuit from the Arduino (and use two separate power supplies).