Wednesday, February 16, 2011

Project 15 - Simple Motor Control

You need to read over this project carefully - the author does a good job of warning you about the risks to your DC motor if you don't take care to provide the right amount of power to the motor. That said, I ordered a tiny motor that the Arduino is capable of providing power to (without an external power jack plug specified in the hardware listing) as long as the 10K potentiometer is thrown into the mix.

If you're not certain what you're doing, then wire up the project exactly as described in the book - he shows two AA batteries providing the power but if you have a variable voltage wall adapter, that could likely be used if you set the voltage to a level that matches your DC motor specs.

So... as you can see from my photos (and video), I've skipped the power jack and I have my DC motor getting power directly from the V+ line on my breadboard that, in turn, is getting power from the Arduino when plugged into the USB port. Maybe over time this would be a bad thing for the little motor, but for short bursts like in the video, and with the 10K cranked up a bit, it's not a problem. (And at $1.95 each, if the motor dies I won't lose too much sleep.)

I did use the specified 1N4001 diode in my circuit as well as the TIP120... I also removed the MakerShield to give myself a bit more room on the larger breadboard to spread out and wire it all up. I could easily have wired all this up on the mini-breadboard on the MakerShield now that I look at it, but I liked having the room to spread out.

In the video, when I apply power, there's a slight hum coming from the motor... only when I crank the 10K down a substantial amount does the motor start to spin. I put a piece of tape on the motor shaft so you can see the spinning action... it happens fast in the video before the tape is spun off... so watch carefully. Also not sure if you can hear the hum of the motor, but it's there, too.


  1. It's not the motor that is the worry. Over time the damage will be to the Arduino and possibly your computer.

    Even a small motor is acting as an inductor every time the commutator switches polarity, and it's shooting juice back into the control circuit.

    You want the motor connected directly to the power supply via the transistor, not running through the Arduino's regulator.

    The diode is in the circuit to protect the transistor, shunting any reverse current back up the line to the battery/powersupply, which can handle it, rather than forcing it through the transistor.

    If you don't have separate power supplies for your Arduino and your motors, at least drive the motors directly from the battery and let the Arduino's regulator with it's nice big capacitors clean up the juice before it gets to the uC.

    The way you have it wired, the flyback is going back into the same bus that powers the uC...Atmel built a pretty tough chip, but if you had sensors on the bus, they would potentially be sending lots of weird signals back to their pins and giving you lots of weird behaviors...glitches in the vernacular.

  2. Hi nice post here..

    I'm currently trying to make the same project.. everything is wired up correctly and double-checked them... But whenever I connect my external supply, the motor starts to spin already and I cannot control it using the pot... is my TIP120 bust or something? my code is good so I don't know what's really going on... any ideas? thanks..

    -arduino noob