As the question says: I'm building a circuit to run a DC motor whenever motion is detected by a motion sensor. Now as this image suggests:

enter image description here

I need a diode + resistor + transistor to get this thing to turn with an Arduino, but I can do the same with a battery and connecting each of the terminals to the + and - of the battery. I understand this might be for speed control? Or turning the motor different ways?

But if I just need it to spin at 100%, would all this be needed?

I tried hooking up the motor directly with a resistor to the 5 V + GND of the board while it was on, but no joy. I am (obviously) doing something wrong but I want to use this problem as a way to learn circuits better.

  • For the resistor: electronics.stackexchange.com/questions/122312/… ; the diode is a flyback diode, also for protection
    – Mat
    Commented Dec 17, 2020 at 6:39
  • 1
    Please draw a "real" schematic of this circuit, and do some research on the matter. Keywords are "voltage", "current", "inductive load", and/or "drive DC motor from microcontroller". Look up the documentations of motor and AVR, and compare needed current and provided current. Commented Dec 17, 2020 at 6:50
  • 2
    because the io pin is not a power supply. it can provide only limited current. it is for TTL logic state
    – Juraj
    Commented Dec 17, 2020 at 8:15
  • 1
    One word: impedance.
    – Majenko
    Commented Dec 17, 2020 at 12:28
  • Too get the maximum out your motor should use a MOSFET, you will eliminate t.7 or 1.4 volt collector emitter voltage drop. If the MOSFET is logic level and avanchlated you do not need the diode. Although probably not necessary I would put a 50 ohm resistor in the gate circuit. As previously mentioned use a seperate power supply for the motor, the Arduino is not a power supply.
    – Gil
    Commented Dec 24, 2020 at 1:52

1 Answer 1


If you want the motor to rotate continuously, without using PWM, and without switching the motor on and off from the Arduino, you can connect the motor straight to 5 V and ground. If you then add a large resistor like you tried, not enough current will pass through the motor to rotate it; in the image the resistor is there to limit the current into the transistor, not to limit the current into the motor.

You can't connect a motor directly to an IO pin because an IO pin can only deliver about 20 mA, which isn't enough for a motor. So, if you want to control a motor from an IO pin, you need a transistor as a switch and you operate that transistor from the IO pin. The transistor does the heavy lifting and switches the larger current the motor needs. The resistor is there to limit the current into the transistor.

Note that it is generally better to wire a motor directly to a 5 V power source and not to the 5 V pin on the Arduino, as the current you can get from that pin is limited; it will do for small motors, though, if they don't pull more than, let's be safe, about 300 mA. In other words, it is preferred not to use the Arduino 5 V pin as a power source, but to use a 5 V power source directly.

Also note that you always need the diode across the motor, however you wire it. It keeps inductive spikes away from the rest of your circuit.

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.