Go Down

Topic: Connecting a Motor to Arduino (Read 4019 times) previous topic - next topic


Heya! I'm completely new to Arduino. Basically I'm after a motor and I found this one on ebay

I was wondering if I needed to buy a shield for it? I'm currently using this electronic brick chassis with my arduino

Can I just plug it in and control it through programming?

Thanks :)


Yes, you need some kind of motor driver to control the motor. The Arduino's pins by themselves don't have enough current.

Looking at the wiring diagram for the motor you need a unipolar motor driver. See this tutorial:


The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons


Yes, read thru the stuff pointed to by Rugged first.  These are stepper motors and are controlled by the sequence of signal applied to the 4 wires.

And I have some Stepper Info here:  http://arduino-info.wikispaces.com/StepperMotors

These little motors are widely used to control air flow with vanes in Air Conditioning systems.

I have some of the driver boards that go with these, like this: http://arduino-direct.com/sunshop/index.php?l=product_detail&p=126

Let us know how your project goes...

DISCLAIMER: I mentioned stuff from my own Shop...


thank you both for your replies!!! i really appreciate it :)

i'm not sure which shield to buy, I've never used a bread board before and this project is due quite soon. Are there any shields that I can easily stack on top of the arduino? What's the easiest way to connect the motor shield to arduino?

and by 'stack on' i mean sits on top of like the shield below


You can get Motor shields from several suppliers, like this:  http://arduino-direct.com/sunshop/index.php?l=product_detail&p=82

If you want to connect to a separate motor driver board and/or other components, you may like a "Sensor Shield" that makes it easy to connect or cable to different components, like this: http://arduino-direct.com/sunshop/index.php?l=product_detail&p=2


Thanks for your reply terry!
I'm already using the sensor shield below

Can I stack the motor shield that you linked me (the one below) on top of my sensor shield??

I also see that this shield is wired to the motor... Can it be wired to the motor that I bought? http://cgi.ebay.com.au/DC-5V-Stepper-Motor-Geared-Arduino-PIC-MCU-DIY-/120692589568?pt=LH_DefaultDomain_0&hash=item1c19d6c400
if so, do you think you can tell me how once i recieve it in the mail? thanks alot, i really appreciate it!!!! :)


Jul 09, 2011, 06:51 am Last Edit: Jul 09, 2011, 06:10 pm by focalist Reason: 1
Hey Terry.. I've got a handful of those little buggers, they are GREAT little steppers.  VERY quiet and strong for the price.  Using a ULN2003 to drive it, I just run a second 7805  for some extra +5v as my wall wart kicks out 2A (supposedly) so I don't put too much load on the Arduino's.  Sorry to say I didn't buy them from you- maybe next time.

In any case, maybe you can answer this...

They are supposed to be 64 step with 1/64 reduction, which means it should be 4096 steps per revolution.. but the reality is that it actually is half that, 2048 steps, using the standard Arduino libs and the ULN2003 4-wire setup, in fact I'm using one of those boards.  I've noticed in the forum this has been mentioned before but nobody seems to have an answer..in looking at the timing chart on your site, it looks like it's using half-stepping to get that number, while the arduino libs are set up to use two phases at once (full stepping).  2048 steps for one revolution is more than enough resolution, so it's cool.. just wondering.  I'm just thinking that shifting out the bit patterns (it's 1-8 in binary on the leads to give it the stepping noted on the docs) would be not too hard and might be worth slapping a lib together for the motor to do just that.  We'd lose torque, but the thing is geared mightily so 70% of the torque via halfstepping is probably still enough for most things.  Academic I suppose, as like I said- over 2,000 steps per revolution is an awesomely tight motor, 4,000 is of dubious value- that's a ridiculously small step angle at .08 degrees.  If you run, say, a wheel with a six inch circumference 2048 steps, that's .003" per step.  At 4096, it would therefore be .0015- and I'd be questioning whether the gears can mesh that tight for that kind of tolerance.. Anything less than one degree per step is pretty good, these do six times that "normally".

Great little motors!

Eceela, make sure to read through the information in the Playground on the stepper library http://arduino.cc/en/Reference/Stepper; that motor is a Unipolar stepper motor.  I am using a ULN2003 chip, which is just seven darlington transistors per DIP, and darn cheap- a couple for a buck.  I use one per motor, I am using those exact motors.  I'd use a secondary power source to drive the motor power though, it draws a few hundred mA and the regulator on the Arduino gets rather warm.  I run a second 7805 voltage regulator (another 50 cent item) to provide the motors with their own 5v supply.  Running it from the 9v wall wart directly is not nice, the little beastie gets pretty warm.  I guess you could do some PWM, but a 50 cent regulator is just easier.  Do yourself a favor and get some 7805's, a few LM317T's (adjustable regulators), and a handful of the ULN2003 chips, they are just so darned useful.. and you can't find darlington transistors singly for the price you'll pay for the array of them.  I also am going to see if there's an easy way to "convert" the UL2003 module (the board Terry sells) to two-wire control without using external transistors. Should be do-able with a couple of 1k resistors and a little creative soldering.. but I digress.

Probably the best deal out there when it comes to steppers- ULN2003 + those motors is a precision positioning system for under $5.. that's impossible to beat!

Now someone (maybe soon) needs to take four of them (XYZ and rotation table) along with a high speed brushless DC motor and a dremel bit and make a supertiny CNC milling machine of VERY high precision..


Hey Terry.. you may want to check on those motor/ULN chip combos.

Though I didn't buy them from you, I have the same module and motors.. and have discovered that using the standard Arduino stepper library, directly plugging the motor into the module will not work.. the windings are out of phase.  Reference the motor pinout, you'll see that the winding pairs are blue/yellow and orange/pink (in that order, with the red being common).  The ULN2003 module is set up incorrectly in that case, and the motor will only rotate in one direction and at reduced speed because the windings are 90 degrees (?) out of phase.  The board is set up as: blue,pink,yellow,orange,red.. but to work, it needs to be blue, yellow,orange, pink, red to be operating in phase if using the arduino libs.

A custom lib or modified hookup is required....

Go Up