I wanted to connect my DC motor to raspberry PI and control it with PWM pin. Problem is that gpio pins are 3.3V in PI and I have pololu 10:1 DC motor which I would like to run on 5V(to make it faster).

How can I convert those 3.3V to 5V for motor? Can I just simply connect PWM and GND pins to motor to steer it?

  • 2
    \$\begingroup\$ You have another problem: PWM pin makes few mA current while your motor requires much higher current. You need to make a kind of simple amplifier. The simplest one is just one MOSFET. However, it inverts the control signal. Is it OK for you? \$\endgroup\$
    – Master
    May 23 '16 at 10:43
  • \$\begingroup\$ By invert you mean that 80% full pwm will be 20% right? If that's the case then it's not a problem. \$\endgroup\$
    – Thun
    May 23 '16 at 10:45
  • \$\begingroup\$ @master: Using an N-channel MOSFET as a low side switch will allow current through the motor when the PWM signal is high which, I believe, was the original intent. \$\endgroup\$
    – EM Fields
    May 23 '16 at 10:56
  • \$\begingroup\$ I agree, was thinking about the voltage... \$\endgroup\$
    – Master
    May 23 '16 at 11:05

All you need is a N channel FET to act like a low side switch:

You have to make sure the FET has sufficiently low on resistance with 3.3 V gate drive. The example I show is 80 mΩ maximum with 2.5 V gate drive.

You didn't say what the maximum motor current is, but you have to make sure the FET can handle it. Also check the FETs dissipation at the maximum current.

Note the diode. It is not optional. It protects the FET against the inductive kickback from the motor when switched off, which happens every PWM cycle. It also allows current to continue flowing during the off phase of the PWM, which is important for efficiency.

  • \$\begingroup\$ Can I use motor driver for this like TB6612FNG? Instead of building my own \$\endgroup\$
    – Thun
    May 25 '16 at 9:53
  1. Connect one of the motor's terminals to +5V, and the other end to the drain of a logic-level N-channel MOSFET rated to carry about twice the motor's stall current.
  2. Connect the raspberry PI's ground and the MOSFET's source to the 5 volt supply ground.
  3. Connect the raspberry PI PWM signal to the MOSFET gate through a 100 ohm resistor.
  4. Run your program.

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.