DC motor

i’ve come across a simple DC motor (pulled from an old electric toothbrush) - i know nothing about this motor except that when it functioned as a toothbrush motor, it used 3v… i thought that i could use pwm to control the speed of the motor… i have verified that it spins up by touching the motor terminals to the 3 and 5 volt power pins on the arduino board…

am i missing something? (knowledge included :P)…

thanks, all…

See how much current it draws, make sure it won't try to over-draw directly from the board. If you're mostly keeping it at low speeds, it won't be as big of a deal. A tiny capacitor across its leads will extend its life and reduce electromagnetic noise. Not a big deal, but if you have a spare, I feel they should go across all DC motors.

thanks, aqua… however, the first problem to solve is why the motor won’t spin at all when using any ouput pins on the board… however, it works perfectly fine when using the 5v/3v and ground power pins that aren’t controlled by the uC… i first need to get it running using a basic output pin HIGH command…


2 things: Make sure it's properly grounded and in a good output pin. Seems simple, but when they're close together sometimes things go in the wrong socket.

After that, its probably a lack f enough current. I can get a pager motor spinning pretty good off an output, but not much more. If you have a power transistor, motor driver, or even a regular op-amp lying around, see if you can get one of those to boost your output.

As aqua_scummm suggested you should start by meassuring the current the motor draws when supplied with 5 volts.

If it draws more than 40mA (which is very likely even for a small DC motor) you can't power it directly from an Arduino pin. If this is the case you should use a transistor (TIP120 for instance) and a diode.

google arduino + DC motor and you will find lots of examples.

You will destroy an output or the chips if you draw too much current from an output pin. They only source a small bit.

Check the playground for a schematic that shows using a transistor that will run the motor from an output. It’s simple, cheap and takes two part.s Also note that the power supply for the arduino has limits and you might need to use an external supply for the transistor/motor and let the arduino’s output control the transistor.

thanks all, i actually did google arduino and dc motor, but was confused when i kept seeing references to H-Bridge... i'm guessing the L293 is a good place to start, like here?


i'm hoping that i'll be able to control the speed as well?..

thanks, isaac

You really don't need an H bridge unless you want to be able to control both direction and speed.

If yo just want to start the motor an control the speed you can use this simple circuit : http://www.tigoe.net/pcomp/code/category/code/picbasic-pro/62

Just ignore the fact that it is picbasic code, use the transistor circuit to run your motor and drive it with a PWM pin from the Arduino board.

awesome!.. thanks, mikmo!... i think that's exactly what i was looking for during my first motor project (if you can call just getting it to run a "project" :))

Ohh, surely thats a project. It can evolve in to something more advanced.

Actually controlling a DC motor ripped from an inkjet printer i found in someones garbage was my first Arduino project.

Scavenging printers for motors is highly recomended. Usually you will find one stepper motor and one DC motor, sometimes two Dc motors sometime two steppers. There are also other good stuff mechanic things and frequently also some "slot sensors". Some printers even have a nicely enclosed power supply in them.

hi all...

finally, i've found time to return to this!...

i have assembled a simple circuit and am still unable to get my 5v motor to spin by itself... however, i did finally purchase a meter that measures current and discovered that the motor is pulling about 250 mA... i can get the motor to spin, but i have to give it a bit of a push to start up... what needs to be done to get it to start up by itself?... the circuit i'm using is using a 2N3906 transistor with 5V source for the motor... from the transistor i am pulling only 170mA... i've discovered that a 9v can supply 300mA...

is my problem related to a component, not knowing enough about motors, or just not enough power?...

thanks all, and hope you have a great new year..


edit: this motor easily starts up and runs by itself using a AA battery which seems to be only to provide 1.5V @ ~90mA...

Are you using a digital out pin to start / stop the motor or a PWM pin to do speed control as well ?

Did you connect the arduino ground to the ground of the motors power source ?

Im' not sure if your transistor is good for this project, usually darlington transistors like TIP120 are used for controlling current to motors.

hi mikmo, thanks for the response.. both motor and the controller are using the same ground... i picked up a couple of TIP120 transistors today and hope to give them a try tomorrow... it was pretty neat to learn about darlington type transistors... i'm using a single pin to simply control the transistor for start/stop and pwm for speed control... should i be using separate pins for that?... it seems that if it will work fine after i give a little spin then using a single pin isn't a problem?...

thanks, isaac

one pwm pin is all you need. It's a bit strange that the motor won't start by itself but will run if you help it over the initial starting problem. I have never come across that problem with the few simple DC motors i have been controlling from my Arduino board.

well, the motor came from a toothbrush of all things... could i have my current readings wrong?... the reason that i ask is because touching the motor's leads directly to a single AA cell starts it up just fine... my current reading is smaller using the cell than the breadboard circuit... though, now i realize that i may misunderstand mAh... can the cell source more current for a shorter period of time to satisfy the motor's needs?...

sigh... i just want to build something to terrorize the cat... :D

i plugged in the TIP120 last night only to realize that my laptop was two floors up, so that'll have to wait a couple of days...

thanks again, isaac

The 2n3906 is PNP and only handles 200ma, you'd need to wire it differently than the example that used an NPN transistor. Even so the 2N3906 can't handle the current. The darlington is an NPN and is much better.

http://www.jaycar.com.au/images_uploaded/relaydrv.pdf Circuit is virtually the same as one to drive a relay. Unfortunately while this is good information they are __ about spewing who they are on everything in a manner that makes it hard to read. If you use linux try pdftotext. ;)