First image is edit of image 2. Use this circuit to build unidirectional motor control using PWM.

Ignore 3v pin, MOSFET can be any mosfet having small threshold gate-source voltage eg, 30N06, Fairchild TO52-AA. These MOSFETS are very small, it will be not easy to connect it to bread board. Everything after the first image are questions.


simulate this circuit – Schematic created using CircuitLab

I have taken help from previous posts to redraw the circuit, but the 6v motor is not driving at all. However, instead of connecting PD12 pin, if I connect 5v pin from STM board , motor rotates good without PWM. MOSFET Gate is connected to PWM signal, Drain is connected to motor and Source to Ground. Frequency used in STM board for the pin is 10kHZ.

Details of mosfet used is here.

Also, there is an onboard LED connected to pd12 pin in stm32f407 board, it blinks as written in the code, this shows that PWM signal is working fine.

What changes should be done so that motor can be controlled unidirectionally using only the software code written for board? what is wrong here. Is the signal of 10-20mA from microcontroller not enough for MOSFET to amplify it?


Circuit to drive motor using PWM from STM board

  • \$\begingroup\$ You've not shown how the mosfet is connected. How is the drain and source connected? Most likely you've switched the drain and source pins. Also what's the rationale behind the 220R resistor? Most pull down resistors are 10K. \$\endgroup\$ Mar 26, 2017 at 4:45
  • \$\begingroup\$ I have edited the question adding details about mosfet, I do not know much about resistor value connected here. I had this resistor, so I connected it to provide pull down effect as stated in other posts. What will be the change if I add 1k resistor? \$\endgroup\$
    – abinjacob
    Mar 26, 2017 at 5:14
  • \$\begingroup\$ That shouldn't cause much difference. Have you tried with a different mosfet? Also try switching it on from the STM device and measure the voltage on PD12. If it's not between 4.5 and 5V then something is loading that pin causing it drop voltage. \$\endgroup\$ Mar 26, 2017 at 8:58
  • 1
    \$\begingroup\$ Put a 1 K series resistor between your STM32F407 logic output and the FET gate. This limits the current to/from the gate capacitance during PWM output switching to 5 mA max, otherwise the PWM output is driving into a short-circuit on its rising edge. Change the pull-down to 10 K as suggested, drains leakage current from output before MCU has configured pin to output on power-up. \$\endgroup\$
    – TonyM
    Mar 26, 2017 at 9:11
  • \$\begingroup\$ Thank you electrophile and TonyM. Now, I don't have required resistors, i will change the resistors and tell about it. \$\endgroup\$
    – abinjacob
    Mar 26, 2017 at 12:37

1 Answer 1


From IRFZ44 datasheet it appears +3v3 won't be enough to drive current for a DC motor. From the typical output plot:


Vgs of +4v5 would drive 8A, considering Vds=9V. Extrapolating the curves you could guess that, with +3v3, Id would be close to 1A or lower. It appears that +3v3 is too low for Vgs threshold. Does connecting gate directly to +3v3 properly drive the motor? Can you measure the motor current in this condition?

You could try using a simple NPN as a buffer for gate voltage, like here:


simulate this circuit – Schematic created using CircuitLab

Just be aware that in this case the current will flow though the motor when PWM voltage is below ~500mV.

Or you could try these MOSFETs: Mouser - N-MOSFET


Your Answer

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

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