I am trying to control a MOSFET with an Arduino. I have followed few tutorials and created schematic below. When I made circuit it did work, but I managed to destroy two Arduino nano clones with it. It did work fine with lightbulb on J4, then I was experimenting with fan which also worked, and small 12v air pump. With air pump it worked until I turned it off and Arduino was no longer working. It was powered with 12v from bench power supply.

The MOSFET show below is actually RFP30N06LE but I could not find it in Eagle.

OUT and T are screw terminals and are connected.

Diode is 1N4001 and the air pump was using 0.8A while working.

What did I do wrong?

Can you please advise what I could change to make this work and to be more reliable? It took me no more than 10 minutes to destroy it.

I am planning to place an optocoupler between the Arduino pin and OUT. What else could be done to protect it?

simple Eagle schematic of MOSFET control


2 Answers 2


Your circuit looks notionally OK.
You are probably doing something other than you THINK you are.
Load turnoff inductive spike is fatal if not properly limited. D2 should work if properly located.
Be SURE D2 really is across the load.

For playing and especially for just on/off as opposed to PWM switching drive gate with say 10k to isolate uC from gate.

Gate can get Millar capacitance coupling from turn off spike on drain. D1 limits this to Vin + Vf_diode or about 14V say at 12V supply. This rise form 0V MAY be enough to couple a low energy spike into drive cct.

Nicish MOSFET notice Vgs_abs_max is +10V - as well as drive resistor above, clamp gate with a reverse zener, gate to source to prevent Millar capacitance coupling inductive turnoff kick into gate AND into Arduino.
IF MOSFET is destroyed by spike it can short drain to gate and controller will die. Was MOSFET OK?

Using supplied schematic editor will allow a MUCH clerer diagram to easily be drawn. People will greatly appreciate the difference. You are welcome to copy and adapt my one if desired.

R2 is for protection only against short transients and will need to be "designed" for eg PWM operation.
R1 needed only to ensure no turn on at start up with uC asleep.
Zener D1 clamps gate to below Vgs_abs_max and also to limit spike feedback to uC.

Components in dashed box at left add power supply spike and surge filtering.


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ 10k resistance into the gate is going to make for some slower edges. \$\endgroup\$ Commented Aug 20, 2016 at 0:13
  • \$\begingroup\$ @user2943160 Indeed. My answer may have been incomplete when you wrote that. R2 is to help isolate FET gate while playing. For on/off switching with no speed it's fine. As you suggest, it needs looking at for high speed operation. That's why I said "For playing and especially for just on/off as opposed to PWM switching drive gate with say 10k to isolate uC from gate." and "R2 is for protection only against short transients and will need to be "designed" for eg PWM operation." \$\endgroup\$
    – Russell McMahon
    Commented Aug 20, 2016 at 0:19
  • \$\begingroup\$ Indeed your answer was incomplete. Your edit has indeed improved things. I would suggest adding a 100uF+ electrolytic bypass capacitor from +12V to the ground next to the MOSFET as that may help with the inductive kick of the motor. Small ceramic capacitors on the motor may also help with EMI, particularly for PWM operation. \$\endgroup\$ Commented Aug 20, 2016 at 0:33
  • \$\begingroup\$ Thanks for great detailed answer. Pins are connected to screw terminals and on other end is either mosfet or led driver dimming. I don't know which one will be and I need pwm. How to pick R2 if pwm is needed? Also could optocoupler solve this problem or would I need to add all of this to optocoupler out? \$\endgroup\$
    – Bobi
    Commented Aug 20, 2016 at 0:39
  • \$\begingroup\$ Is there way to protect arduino vin from anything going wrong on mosfet side, since both mosfet and vin are connected to same jack? \$\endgroup\$
    – Bobi
    Commented Aug 20, 2016 at 0:41

You must have a current limiting resistor between the Arduino pin and gate. Because the gate is a capacitor, current will only initially flow but will far exceed the 40 mA max (20 mA recommended.) A high resistor will cause slow "turn-on" times. Use a 330 ohm or 470 ohm resistor. I did not look it up but I'm assuming that's one of those special MOSFETs made to be tured on with a gate voltage of 5 volts, which simplifies circuit design. You can replace the MOSFET with an optoisolator, as you suggested, but you still need a current limiting resistor on the Arduino pin driving the LED. The optoisolator will provide a higher voltage drop to the load than will a MOSFET however. A MOSFET will be nearly a zero voltage drop.

  • 3
    \$\begingroup\$ Opto can drive MOSFET but not REPLACE it in most cases as load is liable to be >> most opto's load capabilities. . \$\endgroup\$
    – Russell McMahon
    Commented Aug 20, 2016 at 1:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.