Encoder Front Page
SRS Home | Front Page | Monthly Issue | Index
Search WWW Search seattlerobotics.org


Rob Turner


Rob Turner continues his discussions about motors. Check out A Few Words About Motors for the previous article.


Stepper motors are great to use in robotics. By energizing the coils in the motor in a particular sequence, a motor takes 48 or more small, precise steps to make one full revolution. If you are using two of these motors to drive your robot’s wheels, you can get good control over how far it travels by making the motors travel x many steps forwards or backwards. That’s assuming you can find stepper motor drivers, of course. I’ve always had problems finding good servo drivers. Once I was even reduced to using discreet components (say it isn’t so!) to drive my steppers.

Then I got my hands on the L293D motor driver chip (See motors part 1) and life got a lot easier. The L293D contains two H-bridges for driving small DC motors. Now the home-viewing audience might say: "Rob, it’s easy to drive DC motors. What I need to do is drive a stepper motor." No problem. After all, what is a DC motor but a coil and the L293D drives two of them backwards or forwards. That’s what stepper are - two (or more) coils being driven in a sequence, backwards and forwards. So one L293D can, in theory, drive one bi-polar 2 phase stepper, if you supply the sequence.

I found some close-out two-phase bi-polar steppers (part#117954) in the Jameco Catalog. For six bucks plus shipping I get a 7.5 degree stepper with 48 steps per revolution. The stepper motor runs at about 5 volts and pulls 800 milli-amps of current. That’s a lot of current so I can expect my chips to heat up. The way I fix the heat problem is by gluing a heat sink to the top of the chip. Any piece of metal three or four times the size of the chip will do. If things get real hot, I use a small fan to move air over the top of the heat sink.


schem1.gif (5116 bytes)

I realize that Seattle has developed it’s own mutant breed of controller circuits, I think it’s based on the 68HC12, but I have successfully resisted all attempts to be lured to the dark side of the force and will continue to use the BS-2 (Basic Stamp II). Here is a real quick description of the L293D inputs:

1, 9 Enable pins. Hook them together and you can either keep them high and run the motor all the time, or you can control them with your own controller.

2,7,10, 15 Control the two coils. Here is how you pulse them for a single cycle:




3,6,11,14 Here is where you plug in the two coils. You want to ohm them out and make sure you get one coil hooked up to 3,6 and another one hooked up to 11,14.

4,5,12,13 Gets hooked to ground.

8 Motor voltage, usually about 6 volts.

16 +5 volts. It’s a good idea to keep this power supply separate from your motor power.

And here is the schematic to hook the BS-2 and the L293D together. Hey, I’ve even included the code!

schem2.gif (3719 bytes)

The software to program the Basic Stamp II can be found in stepprog.bs2

Notice that this single chip can handle a two coil stepper otherwise known as a two-phase stepper motor. If you want to do more than that, you need more chips. The cool thing is that if you have multiple steppers and you want to drive them one at a time (say on a PC board driller), it’s easy to have multiple L293Ds driven on the same line.

schem3.gif (3502 bytes)


Let’s say you get this thing all hooked up to your microcontroller and it doesn’t work. Here are a couple of symptoms and what they point to as the cause. Since I’ve had the misfortune of experiencing each one of these problems personally, I thought I might be able to save you a little time and pain.

Symptom: The stepper motor shaft turns easily with fingers.

Cause/solution: No power to the circuitry, no power to the motor, or enable pin is low.

Symptom: Everything on, but motor is locked in one position.

Cause/solution: The L293D got the first position and that’s all. Check software, check connections, and check that the hard-wired ports match the software. You might want to pull out the logic probe.

Symptom: Everything on, stepper is shifting in position, but the motor won’t turn.

Cause/solution: The correct line isn’t getting pulsed. Either the software is trying to pulse the wrong line, or the lines are connected incorrectly. First thing to do is slow the pulses way down. Next, try different combinations of the lines or software. You are looking for a pulse series that increments the motor continually in one direction.

Symptom: Motor pulses, but it’s erratic and sometimes changes direction. Using your fingers you can turn the shaft either direction even though you still feel a pulse.

Cause/solution: One of the coils isn’t energizing. Check your wiring and your software. You might want to put the circuit to the probe or unplug the motor and check the voltages.

Symptom: Motor pulses, but the direction is wrong.

Cause/solution: Reverse the pulse order in the software or turn the cable around.

Symptom: Circuit over-heats quickly without anything working. You hear a pop, see smoke, and one or more chips crack and/or turn to carbon.

Cause/solution: Congratulations! you have reversed one or more voltages and fried one or more components in your circuit!


I’m getting a Snappy 3.0 Deluxe and a camcorder so I can post some pictures of my robots on the web.

Of course now that I’m getting a camcorder, I want to make some tapes of my robots walking. I need to know an easy, fairly inexpensive way of editing and mass-producing the video. Can you help me out? Please write me at ROBT612@aol.com   Thanks!