I want to power a small motor with a 9V battery and control it with PWM using an Arduino Leonardo. I know I can power the motor separately, but this introduces the problem of needing a battery to power the motor (9V battery) and another power source to power the Arduino (another 9V battery?)

Would it be safe to simply power the Arduino with a 9V battery and use the Vin pin on the board (which is unregulated and outputs directly the power source powering the Arduino) to drive the motor? That way, I power everything from the 9V battery, and use a transistor to drive the motor.

Thanks a lot!


  • That should work. But you may have a problem with the small capacity of 5V battery, compared to AA or even AAA 1.5V batteries. I don't think that will be enough to drive a motor.
    – jfpoilpret
    May 20, 2014 at 10:50
  • I will probably use a couple of AA instead. I'll calculate which type of batteries would be optimal for my project.
    – Steve
    May 20, 2014 at 17:25

3 Answers 3


If you use a transistor circuit as shown below, back EMF would not cause any trouble. enter image description here


Yes it is OK to do that. But the thing you should consider in mind is "What is the current requirement of the motor?"

You say

I want to motor a small motor with a 9V battery and control it with PWM

This means you have a servo motor, which might require a lot of current depending on the torque. So if you have a battery with low 'mAh', your battery will dry out very quickly. This might or might not be a problem for you depending on your requirements.

  • Woops I meant "drve a motor". It's actually not a servo but just a simple motor harvested from an old cd changer. I am aware that a 9V battery might not provide a very good battery life, but that is not my priority for now. As long as it works and is reliable all is good for now.
    – Steve
    May 20, 2014 at 6:18
  • in that case, it would work just fine.
    – Damon
    May 20, 2014 at 6:20
  • You also need to ensure that the Arduino you use has a voltage regulator. Not all of them do.
    – Phil
    May 20, 2014 at 7:50

The arduino has its on voltage regulator, so feeing 9v to the arduino is not a problem. But the arduino will not drive the motor directly. You need to use a transistor big enough to hundle the amperage of your motor (e.g.tip120). The diagram above is a good indication of how to connect it. Yet the diagram is missing a diode (1n4001 or 1n4004) from the GnD to Vcc, as to avoid back voltage from the motor, which may damage your arduino.

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.