Arduino 5v motor

so i ripped out a motor from my electronic flying plane, and was wondering can the arduino control this itself without a motor shield.

I connected up the ground and 5v from arduino to mister motor, and it runs great, full power, now the question is how do i get it to turn on and off, should i be using the pwm or the analog, first time playing with any electronics so i'm learning. figure best way to learn is control 1 motor first.

Also is there any code out there to allow me to control motors on the arduino from my PC keyboard, or am i going to have to write this myself :slight_smile:

Since your able to run the motor from your 5v, that means the motor only pulls a few hundred mA. However, you won't be able to control it this way, as you would need to hook it up to a digital pin, which only outputs, at most, 40mA. So, to answer your question, you need either the motor shield, or your own hbridge circuit to run the motor.

The hbridge circuit is nothing tough. Here is my favored tutorial on how to use an hbridge, although I'm sure some (MIKE!) would propose other sites.

http://itp.nyu.edu/physcomp/Labs/DCMotorControl

I would not keep it directly hooked directly up to the chip, adding any load to the motor will probably cause it to draw more amperage than the pin can source causing damage

using a transistor like a switch you can turn the motor on or off with a digital pin, or control its speed with the pwm

(image from here, and the resistor on the base can be 1k)

Also put a diode from collector (anode) to +5V (cathode) to protect against back EMF.