I'm trying to drive a motor with a 7V battery pack using the 5V pinout from a microcontroller. The pinout is connected to the gate pin of an IRF510 MOSFET.

This is my current circuit:
Pinout ON Pinout OFF

The simulation clearly works fine, but when I make the circuit the motor keeps turning when pinout is 0V, only more slowly. I recorded these voltages:

Voltage across motor when pinout is ON: 6.55V (this is fine)
Voltage across motor when pinout is OFF: 5.77V (should be 0V, I want it to stop)

The current through the motor is 0.2A regardless of voltage, but the drop in voltage when the pinout goes off obviously causes the motor to slow down a bit.

I've tried tying the gate to ground (ground pin of the microcontroller) with a 20k resistor, but this had no effect. If I understand it correctly, I only need to worry about a transient voltage when the microcontroller itself is physically switched off? I'm also not sure if I should use the ground of the microcontroller or the ground of the 7V battery pack (all the diagrams I've seen use a common ground).

  • \$\begingroup\$ You state that you've tried tying the gate to the microcontroller ground. Is the microcontroller ground connected to the FET source (so that you are influencing Vgs)? \$\endgroup\$
    – HikeOnPast
    Aug 2, 2012 at 0:07
  • 3
    \$\begingroup\$ Do you have the microcontroller ground and the battery negative terminal tied together? \$\endgroup\$
    – Oli Glaser
    Aug 2, 2012 at 1:27
  • \$\begingroup\$ No, the microcontroller and battery grounds are not connected. Should my circuit look like this? i.imgur.com/Q2qJE.png (don't want to make it until you guys confirm, incase I damage my microcontroller) \$\endgroup\$
    – Matt
    Aug 2, 2012 at 10:30
  • 1
    \$\begingroup\$ @Matt - Yes, grounds should definitely be connected, otherwise the FET's gate voltage has no relationship with the source's. Your schematic is fine. \$\endgroup\$
    – stevenvh
    Aug 2, 2012 at 12:51
  • \$\begingroup\$ @Matt If you're concerned about damaging the uC (which is not unwise), test the circuit without the uC first. \$\endgroup\$ Aug 2, 2012 at 16:54

2 Answers 2


Be SURE that you are implementing this circuit.
Diode is needed (1N400x will do to start for motors under a few amps)

enter image description here

The MOSFET you are using is marginal for use with 5V gate drive.
A "logic FET" with a lower gate turn on voltage will be better.

The action you describe indicates either that the MOSFET is dead or connected wrongly.

The above circuit diagram is modified from fig 8. here
This is a useful page that will teach you things that you want and need to know.

  • \$\begingroup\$ Instead of a logic level FET a mosfet driver chip could be used, for instance a TC4427. \$\endgroup\$ Aug 2, 2012 at 8:55
  • \$\begingroup\$ So should my circuit look like this? i.imgur.com/Q2qJE.png What component does the diode protect, the microcontroller, MOSFET or battery pack? \$\endgroup\$
    – Matt
    Aug 2, 2012 at 10:28
  • 1
    \$\begingroup\$ @Matt - Yes, but it's more common to draw the +7 V at the top, and the motor above the FET, like in Russell's schematic. The diode protects the MOSFET. If the motor is switched off it will create a possibly high voltage on the drain which may destroy the FET. The diode allows current to flow to the battery's +, and so avoids a voltage build-up. \$\endgroup\$
    – stevenvh
    Aug 2, 2012 at 12:49
  • \$\begingroup\$ @Matt I was going to comment about the readability of the schematic too. Read this post by Olin (it's a white paper, really). There are certain conventions. If they are followed, the schematic becomes more readable. For example, the questions like "is it a low- or a high-side switch?" can be answered by inspection. \$\endgroup\$ Aug 2, 2012 at 16:51

If you look closely at the principle drawing of the MOSFET in the IRF510 datasheet, you'll notice a diode between drain and source (in parallel to the MOSFET itself). It's called power MOSFET's body diode.

enter image description here

Body diode is what's conducting the current, when you drive the gate with 0V. Notice in the O.P. that the voltage difference between ON and OFF voltages is 0.78V, which is close to the forward voltage drop of the silicon diode.

You simulation assumes an ideal MOSFET without a body diode, probably.

The body diode should be reverse-biased, if you want to be able to switch off the current. So, source should be connected to the negative side.

  • \$\begingroup\$ This made perfect sense, until I realised that my actual circuit is reverse-biased - the MOSFETS in the diagrams I uploaded are the wrong way around. I'm sure you're on to something with this diode though because its behaviour seems to be slightly dependent on some other factor like room temperature. I rechecked my circuit and source is definitely connected to negative. \$\endgroup\$
    – Matt
    Aug 1, 2012 at 22:50
  • 2
    \$\begingroup\$ @Matt - if your grounds are not connected it may be capacitive effects you are seeing, since if the MOSFET is actually connected the right way the body diode won't cause any problems. If you can e.g. touch the FET gate with your finger and the motor changes speed then the problem is that the gate is floating (i.e. not pulled to 0V properly) You need a reverse biased diode across the motor too (see Russell's answer) to protect against inductive kickback. \$\endgroup\$
    – Oli Glaser
    Aug 2, 2012 at 5:47
  • \$\begingroup\$ The grounds are not connected, and touching gate does indeed cause the motor to change speed. Is this the correct circuit? i.imgur.com/Q2qJE.png \$\endgroup\$
    – Matt
    Aug 2, 2012 at 10:32

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.