Stepper Motors

Two methods of motorizing telescopes are open loop stepper motors and closed loop servo motors with tachometer or encoder feedback. With an open loop stepper motor system, the motors are commanded to move: there is no feedback that the movement took place. Stepper motors move in precise increments of (usually) 200 full steps per revolution. By conservatively rating the steppers, we can insure that the motors will never stall. The common dot-matrix printer positions the print head and paper in this manner. With servo motors we need some sort of feedback to tell us how the motor shaft is rotating. A tachometer or encoder will give us this information but at a price of more complex hardware and software. In practice, both methods work well. For our purposes open loop steppers will be easier to control over the wide range of scope characteristics and speeds needed by the altazimuth drive.

Perhaps the name 'stepper' is a misnomer; this type of motor was originally conceived to run on AC synchronous power. Instead of using smoothly varying AC, if DC is applied first to one winding, then to the next, the motor will move in step fashion, hence the name. When the DC is made to vary synchronously, in our case by a digital method called Pulse Width Modulation, the motor returns to its original smooth running state.

A typical stepper motor consists of a permanently magnetized rotor shaft shaped with radial teeth that rotate inside a stator that also contains teeth. Depending on how the stator's teeth are energized, the rotor will align itself in a particular orientation. The stator has four windings that energize various teeth. To drive a stepper, switch the current from one stator winding to the next.

A full step pattern, or excitation mode, goes like this:

full step # winding...

 1 2 3 4
1 ON OFF OFF OFF
2 OFF ON OFF OFF
3 OFF OFF ON OFF
4 OFF OFF OFF ON

At each full step, the rotor aligns itself with the winding that is turned ON.

The halfstep pattern, or excitation mode, goes like this:

halfstep # winding...

 1 2 3 4
1 ON OFF OFF OFF
2 ON ON OFF OFF
3 OFF ON OFF OFF
4 OFF ON ON OFF
5 OFF OFF ON OFF
6 OFF OFF ON ON
7 OFF OFF OFF ON
8 ON OFF OFF ON

When adjacent windings are ON, the rotor positions itself between the two windings. Steppers move smoothly and are more resistant to resonance effects when halfstepping. Shaft oscillation occurs when the rotor snaps to the next winding during full stepping. The shaft will first overshoot, then undershoot, continuing a decaying oscillation. If the load on the shaft happens to have a harmonic period that matches the rotor's oscillation, a resonance develops between the motor and the load. This can destroy the stepper's ability to rotate at certain rates.

A much bigger improvement in rotor smoothness occurs when microstepping. In the past, amateur altazimuth stepper motor drive designs have sometimes failed because of induced vibration caused by coarse step resolution. With a PC directly controlling the voltage waveform of all four stepper motor windings, we can easily divide each full step into many microsteps.

Microstepping gives us five principal advantages:


To microstep: winding A slowing ramps down in current following a cosine curve, while winding B slowly ramps up following a sine curve. Applying full current to winding A positions the rotor directly over winding A. Applying equal current to both windings A and B positions the rotor directly between winding A and B. Applying current to winding B that is 60% of winding A's current will position the rotor exactly 1/4 of the way between windings A and B. Because of the inverse square nature of the electromagnetic force, moving smoothly between windings A and B calls for a cosine/sine current pattern to be applied to the two windings.

Limitations on microstepping include absolute tooth error, typically 1/25 of a full step, and a deflection error caused by torque loading. The deflection error is at a minimum when the rotor is positioned on a winding and at a maximum when positioned between windings. If the torque loading is 10%, then the shaft's error when between windings will be 10% of a full step. Microstepping at 10 microsteps per full step is a reasonable compromise between smoothness and rotor position accuracy. More microsteps can translate into a smoother motion, but will not result in increased rotor position accuracy.

The PC uses the parallel port's eight output bits to simultaneously control the current waveform of the eight windings belonging to the two stepper motors. The current waveforms are generated using a technique called Pulse Width Modulation. Full current is turned ON for a certain time then turned OFF. The cumulative effect of rapidly repeating ONs and OFFs to the motor is the same as if smooth average current was used. By adjusting the percentage of ON vs. OFF the resulting current can be controlled precisely. Torque remains high whatever the motor's speed since full current is applied during the ON time.

For adequate current resolution, the sequence of ONs and OFFs will add to 100 or more. For illustration purposes, let's say that the total sequence per phase is 10. If winding A is controlled by bit #0 (control word output = 1), and winding B controlled by bit #1 (control word output = 2) of the control word, then the sequence of control words for a single full step with maximum average current (ignoring the other windings on bits #2 through #7) is:
sequence of control words output (10 pulses per phase):
---------------------------------------------------------
phase #1: 1 1 1 1 1 1 1 1 1 1
phase #2: 2 2 2 2 2 2 2 2 2 2

For full stepping at half current:
sequence of control words output (10 pulses per phase):
---------------------------------------------------------
phase #1: 1 1 1 1 1 0 0 0 0 0
phase #2: 2 2 2 2 2 0 0 0 0 0

For halfstepping at half current where the intermediate halfstep consists of both winding A and winding B on:
sequence of control words output (10 pulses per phase):
---------------------------------------------------------
phase #1: 1 1 1 1 1 0 0 0 0 0
phase #2: 3 3 3 3 3 0 0 0 0 0
phase #3: 2 2 2 2 2 0 0 0 0 0

To microstep, we want to place the rotor at intermediate positions between windings A and B. To set the rotor 25% of the way towards winding B, the rotor must 'feel' winding B 1/3 as much, positioning itself 3 times closer to winding A than winding B. Since electro-magnetic fields propogate as the inverse square, the current supplied to winding B must be sqr(1/3) or about 60% of current to winding A:
sequence of control words output (10 pulses per phase):
---------------------------------------------------------
winding A at 100% current: 1 1 1 1 1 1 1 1 1 1
+ winding B at 60% current: 2 2 2 2 2 2 0 0 0 0
= winding A + winding B: 3 3 3 3 3 3 1 1 1 1

Therefore, to microstep with four microsteps per full step with maximum current:
sequence of control words output (10 pulses per phase):
---------------------------------------------------------
phase #1: 1 1 1 1 1 1 1 1 1 1 (A current = 100%, B current = 0%)
phase #2: 3 3 3 3 3 3 1 1 1 1 (A current = 100%, B current = 60%)
phase #3: 3 3 3 3 3 3 3 3 3 3 (A current = 100%, B current = 100%)
phase #4: 3 3 3 3 3 3 2 2 2 2 (A current = 60%, B current = 100%)
phase #5: 2 2 2 2 2 2 2 2 2 2 (A current = 0%, B current = 100%)

For 10 microsteps:
---------------------------------------------------------
phase #1: 1 1 1 1 1 1 1 1 1 1 (rotor positioned on winding A, A current = 100%, B current = 0%)
phase #2: 3 3 3 1 1 1 1 1 1 1 (rotor positioned 9:1 times closer to A, A current = 100%, B current = sqr(1/9) = 33%)
phase #3: 3 3 3 3 3 1 1 1 1 1 (rotor positioned 8:2 or 4 times closer to A, B current = sqr(1/4) = 50%)
phase #4: 3 3 3 3 3 3 3 1 1 1 (rotor positioned 7:3 or 2.3 times closer to A, A current = 100%, B current = sqr(3/7) = 65%)
phase #5: 3 3 3 3 3 3 3 3 1 1 (rotor positioned 6:4 or 1.5 times closer to A, A current = 100%, B current = sqr(2/3) = 82%)
phase #6: 3 3 3 3 3 3 3 3 3 3 (rotor positioned 5:5 or equal distance from A and from B, A current = 100%, B current = 100%)
phase #7: 3 3 3 3 3 3 3 3 2 2 (opposite of phase #5)
phase #8: 3 3 3 3 3 3 3 2 2 2 (opposite of phase #4)
phase #9: 3 3 3 3 3 2 2 2 2 2 (opposite of phase #3)
phase #10: 3 3 3 2 2 2 2 2 2 2 (opposite of phase #2)

These ten values are defined in the software, written in C, as an array: PWM[0] through PWM[9]. In C, the first element of the array has an index or offset of 0.

Slight tweaking of the PWM values are necessary to reflect the finite on/off times of the power transistors, hex inverters, any opto-isolators used, the parallel port, differences in speed between PCs, and differences between motors and the torque loading.

Besides excessive vibration when full stepping, stepper motors have another limitation to overcome: they don't like to spin very fast. As the computer switches current to the windings ON and OFF, counter electromotive force (e.m.f.) is generated. When the source of the current is switched OFF, the collapsing magnetic field quickly moving through the winding generates a voltage spike that can destroy the power transistors.

A flyback diode prevents the voltage spikes by giving a path for the dying current to circulate back into the winding. However, this greatly slows the time for the current to collapse. The result is ever lowering torque as the motor tries to spin faster. A zener diode used with the flyback diodes allows just the voltage above the zener diode's rating to be returned to the power source. This prevents the extreme voltage spiking while avoiding the full braking action of the flyback diodes.

In combination with using higher voltage than the motor's continuous voltage rating, and smoothly ramping up the motor's spin, we can achieve speeds many times faster than otherwise. Rates up to 5,000 halfsteps per second can be achieved with modest torque. I use two 12 volt batteries in series to generate a total of 24 volts to operate 6 volt steppers. This gives enough voltage to run the steppers at a high speed. A single 12 volt battery also operates the steppers adequately. Current consumption for both motors combined is 0.1 amps while microstepping and 0.3 amps while slewing.

Tom krajci's flywheel addition that gives ultra high slew speeds: flywheel.html

We want to set the stepper motor step size as a compromise between microstepping tracking resolution and a fast slew rate. Most stepper motors have 200 fullsteps per revolution. The reduction needed between motor and telescope is 360 degrees divided by the distance one stepper revolution covers. If 1/4 to 1/2 arc second per microstep, and 10 microsteps per fullstep, and 200 fullsteps per revolution, then one stepper revolution covers 500 to 1000 arc seconds. Dividing this into 360 degrees or 1,296,000 arc seconds calls for a reduction of 1300:1 to 2600:1 between motor and telescope. Our altitude bearing diameter divided by the drive shaft diameter gives a reduction of 5:1 to 100:1 for common sizes. This means that a gear reducer of 13:1 to 500:1 is needed between the stepper motor and the drive shaft.

If we adopt a microstep size of 1/4 arc second to 1/2 arc second where a fullstep is divided into 10 microsteps then the top slew speed is from 1 3/4 to 3 1/2 degrees per second. This is plenty fast to move such a large scope and give time to duck!