[Chugalug] [OT] Best way to rotate a motor precisely

Dan Lyke danlyke at flutterby.com
Sun Mar 3 00:29:08 UTC 2013


On Sat, 2 Mar 2013 18:54:22 -0500
Stephen Kraus <ub3ratl4sf00 at gmail.com> wrote:
> Stepper motor and some sort of optical sensor.

Unless you expect that the motor will encounter load beyond its torque,
you can do away with the sensor. Steppers gonna step, it's what they
do, man. At most you need a home switch.

For James' benefit, 'cause I assume Stephen knows this stuff...

Stepper motors are super easy to drive. It doesn't matter if you stall
them (they have a maximum current draw which you usually just arrange
to drive them at), they hold a position, and a common configuration for
them is 400 steps per circle, so often you don't even need to gear
them. And you don't have to reverse polarity on them to drive them
backwards, so driver circuitry is easy (not that an H-bridge is hard,
but...).

The down-side is that they draw current even when static (because they
hold), so they can be kind of power hungry. There are strategies around
this. They can also be noisy, because you're driving them a step at a
time, so they can buzz a lot.

So, yeah, I'd do this with a stepper. If you don't have anything trying
to move it when it's still, you can probably de-power it when not in
motion, just to save power.

The way a stepper works is that it has a series of coils, usually 4.
Energize them in sequence, 1, 2, 3, 4, to make the motor step one way,
energize them in the reverse sequence, 4, 3, 2, 1 to make it step the
other. Half-step it by energizing two coils, so you can double the
resolution by 1, 1&2, 2, 2&3, 3, 3&4, 4, 4&1 to step by half.

If you're super smart you can do finer resolution by doing proportional
coil steps; take apart a consumer product that uses steppers (like a
*cough* popular paper cutting device that's on the shelves at Michael's
and Wal*Mart that it would be wise if I didn't talk too much about the
internals of) and you might notice that there are 8 driver transistors,
but 4 of them are going through some monster resistors. This is to do
quarter stepping.

Many modern stepper drivers do much more fractional stepping than this,
primarily to reduce noise, using PWM on 4 drive transistors.

And there are also ICs that do this stuff for you, usually they
keep track internally so you have two pins, one for direction,
one that you pulse to step, although unless you're really jonesing
for I/O pins it's often cheaper to just do discrete components: A
resistor to limit drive current from your microcontroller to the
collector of the transistor, a Darlington transistor like the TIP120
(which has a 1000 to 1 gain, so you only have to give it 1 milliamp to
drive an amp of output), and a diode in series to prevent the inductive
kick from the motor coils from blowing out the transistor.

In at least one driver circuit I did, I was paranoid and used a PS2501-4
opto-isolator IC to protect the microcontroller. This was probably
paranoia, I wouldn't do that today.

Whatcha gonna drive this baby with? Parallel port on a PC? Arduino?
Stand alone AVR ATMega? An Arduino with a shield?

Dan



More information about the Chugalug mailing list