High and Low = 5V and ground?

i'm trying to power a DC motor with the arduino, but it only works if i put it directly to 5v and GND, why does this program doesn't woks?

int motor = 7;
void setup(){
void loop(){

Because the Arduino can only put-out 40mA. You risk damaging the Arduino if you attach a motor directly to an output pin.

The Arduino can power an LED, but it can't power a motor. You need a MOSFET, transistor, or relay to "boost" the power.

If you were to measure the output-high voltage with the motor attached, you'd find it's low... Probably less than 1V. Please DO NOT try that because you will stress the Arduino.

ok, thanks

Use a relay.

A fet is likely to get killed by the back emf on the motor when you switch off

Plenty of eBay sellers have Arduino compatible relay modules for a few dollars

You can use MOSFET with proper Diode

proper Diode



proper Diode


1n4001 or similar.


rogerClark: Use a relay.

A fet is likely to get killed by the back emf on the motor when you switch off

You will have the same issue driving the relay - either way, you need a driver circuit between the Arduino and the load which will amplify the current and provide flyback protection.

Never use a relay for anything! Look at the examples in the playground for motor control using transistors. You can only pwower the very smallest of micro motors from the Arduino. The motor almost always needs its own power.


Just get one like this


99c, and includes the diodes etc etc. I can't even buy a relay locally for 99c