Can I connect a DC motor directly to an Arduino?
5 Answers
No. The pins of the Arduino only can only provide a few tens of milliamps, not enough for a typical DC motor.
Pololu's line of Simple Motor Controllers lets you control motors by sending serial commands from the Arduino (you can use the NewSoftSerial library). The advantage of this method is that you can control multiple motors using a single pin on the Arduino. The user's guide for these controllers comes with example Arduino code.
You could also get a simpler product such as a motor driver, but then you would have to generate your own PWM signals and it would take more of your Arduino's I/O lines.
You're also going to need a battery or other power source; driving motors from USB power usually doesn't work because USB ports can only provide 500 mA.
The easiest way to interface motors to the Arduino is to use an appropriate shield, like this one.
You will need some extra components:
You'll need an extra chip.
For $2.35 + shipping, I was able to control two motors using the SN754410 using this instructable to wire it up. It's really easy.
Not really, but maybe not because it's not powerful enough. A DC motor, in general, is built such as when the commutator changes the polarity of the two halves of the coil, a short but very heavy current/voltage impulse is inducated (self-induction) that will basically burn the CMOS chips in the AVR.
If this is really a very small motor, you can avoid this current by adding an antiparallel diode between the AVR output and the ground (a so called runback diode) to short-circuit those inducated pulses, protecting the output of the chip.