Using and controlling 5V motor directly to arduino

Is it possible to connect a 5V motor to arduino by connecting the 5V pin to 5V pin of the arduino and the GND to any pin say like 5 or 6 to control it? For example:- like setting the power of pin 5 low to stop it and the power of pin 5 high to run it??

This would be really helpful if possible..

Only if it is a really really tiny motor. You still run up against the 40mA (20mA preferred) current limit of the digital pins even if you are sinking the current rather than supplying it.

BTW if you could do it it would work the other way round…low on pin 5 would RUN the motor.


Sadly, it doesn't even RUN the motor :frowning:
I connected the one of the motor wire to the 5V pin and the other one to pin 5.
Here's the code:

int motorPinone = 5;

void setup() {
 pinMode(motorPinone, LOW);

void loop() {
   digitalWrite(motorPinone, OUTPUT);

There is no use. I even tried interchanging the wires. Maybe my code is wrong?

Fortunately your code is wrong so there's a chance you've got away without damaging the Arduino, maybe just that pin but possibly the whole thing.

What is pinMode(pin, LOW) supposed to do? Why do you think OUTPUT is a suitable value for a digitalWrite?

It is not safe to even try this this unless you are certain your motor really takes less than 40mA. I don't think I've ever seen one that will run on so little current so if you have one it will be very unusual. Exactly what motor is it?


Use an avalanche rated N channel MOSFET, connect the source to ground, gate to the arduino, drain to motor(-) and motor (+) to a 5 volt power supply, do not use the arduino 5 volts. Be sure to connect the grounds of the power supplies together. If you chose not to use a driver best order a few dozen Arduinos, you will need them.
Good Luck & Have Fun!

No motor can be directly driven by Arduino pins.

At the very least you need a miniscule motor and schottky-diodes to prevent inductive kick-back, and to parallel several pins for extra current handling - this isn't going to work for you, get a motor driver (H-bridge shield) or a MOSFET and free-wheel diode.

Learn about stall current ratings of motors - this is the thing that matters for choosing a motor driver and power supply.