The arduino drives the gate of the mosfet (irf540n) just fine (I've tested it with an led + 100 ohm resistor) and now I want to drive a small dc brushless motor. I've connected everything properly but it works not quite the way I want it to.

The drain and source are supposedly not connected if there is no gate voltage applied and thus the motor should not spin but it does spin (I've connecting it correctly, just the standard way that is found all over the internet).

When the gate voltage is made high by the arduino the motor spins a little faster.

My question is thus: why does the motor spin when there is no gate voltage applied?


Difference with the above schematic is: - No diode - Mosfet is irf540n - Motor is driven by 9V

Other than that the configuration is the same (connected ground of arduino to the - side of the 9v battery, the - side of the battery is connected to the source and the + side of the battery is connected to one terminal of the dc motor while the other terminal of the dc motor is connected to the drain)

EDIT: I got it working when I tried it again (using another irf540n MOSFET). Diode in parallel with the dc motor is indeed a good thing. Placing a resistor as you guys said is also needed indeed so that the capacitance of the MOSFET is able to discharge I think. Btw drain & source mixing up isn't that big of a deal is it? Thanks everyone.

  • 2
    \$\begingroup\$ Diagrams and/or pictures, we need them. \$\endgroup\$ – Asmyldof Jul 7 '15 at 16:06
  • 1
    \$\begingroup\$ Schematic where? \$\endgroup\$ – Ignacio Vazquez-Abrams Jul 7 '15 at 16:06
  • 1
    \$\begingroup\$ Sounds to me like you've got the drain & source mixed up, but without a diagram I'm just guessing... \$\endgroup\$ – brhans Jul 7 '15 at 16:11
  • \$\begingroup\$ The middle pin should go to the motor. It's best to add the diode even for a small motor. \$\endgroup\$ – Spehro Pefhany Jul 7 '15 at 16:33

By "no gate voltage applied", I assume you're not driving it - it's unconnected, or connected to high impedance such as an input pin.

A MOSFET's gate has extremely high impedance - from hundreds of megaohms to gigaohms - and thus it takes very little current to change the voltage on it. Ambient EM fields can easily affect it, and with nothing connected the voltage can fluctuate and take on just about any value. In your case it's likely above the Vgs threshold voltage, turning the MOSFET on.

This is why you should always have a pullup or pulldown resistor on your MOSFET's gate if there's any chance it might be otherwise undriven.


You need a pull down resistor on the pin that drives the gate. Look at the 10K resistor in the pictures below:

enter image description here

enter image description here

enter image description here

I quote from KyranF:

The resistor holds the gate low when the arduino does not send a high signal. This is here incase the arduino comes loose, or the wiring is bad it will default to off. You don’t want this pin to ever be floating as it will trigger on and off.

Floating MOSFETs are bad, and because the "on" control of the FET is essentially just a capacitor with very low capacitance, it is quite easy for it to float up and turn itself on.

This situation will only really happen in your arduino program if you make the output pin an Input by mistake, or during power off/on/restart states. The ATMEGA328P on the Uno makes all it's pins go into high impedance state during power cycle, which is a prime opportunity for the gate of that FET to float high.

The resistor ensures there is always a known state, and only an active output HIGH from the Arduino will cause it to actually turn on.

For your third question - MOSFET gates only "use" current for a brief time during the ON period, to charge the gate capacitor. The Arduino's 40mA output maximum per pin is not going to be an issue. It WOULD be an issue if the FET was a BJT Transistor instead, as those will constantly draw current into the base in order to operate. MOSFETs work differently, and do not consume current to have them be "on" constantly.

Putting a 10K ohm resistor is also too high in general, it will slow down the ON/OFF time of the FET considerably, and cause major switching losses if you are doing any reasonable frequency PWM. Use something like 100 Ohms if you want to put a resistor there. Putting a resistor there may not be needed for a MOSFET, but it IS recommended to reduce the possibility of inductive feedback into the microcontroller and other forms of dirty business related to switching an inductive load like a motor.

Add the diode as a flyback protection or you are going to have to add a new MOSFET + diode very soon!!!!


My friend, you are 100% facing a MOSFET failure. I don't think it is a wiring problem. you can easily check your MOSFET by the DMM. Just put it on the Diode mode and see if it beebs when placing its pins on the drain & source. So they are shortened due to the back current coming from the motor when turned off and yet turning... and this is exactly the function of the Diode you underestimated...


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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