# Stepper Motors:

Most of the motors we are familiar with spin when provided with electricity.  The small DC motors found in toys have two wires coming out of them-- and batteries have two sides (+ and -), so it's pretty easy to figure out how to hook them up.  Connect the battery to the motor one way, and it spins clockwise.  Reverse the connection and you get counter clockwise.  We can certainly use our parallel port bit wires to control the electricity feeding a DC motor, but because the motor spins freely, it is difficult to precisely control exactly how far it spins.  If we want the motor to turn exactly a certain amount, we either need to measure how far the motor has turned, and feed this information back to the computer so it can make corrections in the controlling signal (this is how servo motors work), or we need a different kind of motor.  And here is where stepper motors come in!  Steppers don't spin, they step-- meaning their shaft rotates a certain amount with each command received from the controlling electronics (stepper motor driver).  Steppers can do two things-- take a step clockwise, or take a step counter clockwise.  Because steppers break rotation into discrete steps, we can think of them as digitizing motion, with each step being a motion pixel.  This is ideal for connecting to the computer.

The down-side to steppers is that they are more complicated to hook up than simple DC motors.  Steppers have 4,5,6 or 8 wires coming out of them!  Electricity must be fed to just the right wires, in just the right amount and at just the right time for the motor to take a step.  Fortunately this is a common need, and there are inexpensive electronic devices (integrated circuits or IC's) that are made just for this task.  The job of the stepper motor driver is to convert two bits of information (we will use two of our bit wires again) into the proper pulses of electrical flow that will make the stepper motor work.

And what do these two bits do?
The first is DIRECTION-- this bit determines which direction (CW or CCW) steps will go.
The second is STEP-- when the driver receives this bit, the motor takes a step in the direction set by the DIRECTION bit.

Stepper motors are in lots of commonly used computer equipment-- they move the paper (up and down) and the print head (across) in your printer.  They move the read/write head across the surface of your hard and floppy disk drives.  Because of this, they are relatively easy to find as junk!  Which is good, because when they are brand new they can be very expensive.

Steppers come in a wide range of sizes-- generally the bigger they are, the more turning force (torque) they have.  The ones we will be experimenting with are pretty small, and similar to those you might find if you took apart an old floppy drive.  They are new, but were cheap because they were surplus.  Our stepper motors have 200 steps/revolution (1.8 degrees per step) which is a very common value-- but other motors may have fewer (or sometimes more) steps/rev.

If you want to know more about steppers and how to run them, there is a wealth of information on the Web.  I have listed some of my favorite sites in the reference section.

Stepper motor drivers also come in a wide variety of types and sizes.  It is not that hard to build your own drive electronics from commonly available parts, but for small motors (like ours) it is far easier (and just as cheap) to use a ready-made IC.  We will be using the UCN5804 chip.  It combines my favorite two features:  cheap and easy!

OK, enough talk-- let's do it...

next-- Journey of a 1000 miles begins with a single step
home