In a frictionless system using sine-cosine microstepping at speeds below the cutoff speed for the motor, the available torque is effectively constant and we can use the full torque to accelerate or decelerate the motor,

Advertising

so the above control algorithm will work with

If there is significant static friction, we can take this into account as follows:

where

f -- frictional torque

If the motor is run using the maximum available acceleration and decleration, any unexpected increase in the load will cause the motor rotor to fall behind its predicted position, and the result will be a failure of the control system. As a result, open-loop stepping motor control systems are never run at the accelerations give above! In the case of full or half-stepping, where there is no sine-cosine torque compensation, the available torque varies over a range of a factor of 20.5, so we typically adjust the accelerations given above by this amount:

If we operate consistently near the edge of the performance envelope, and if we never request a velocity Vtarget near the resonant speed of the motor, we can safely accelerate through resonances without relying on damping. If, on the other hand, we select acceleration values that are significantly below the maximum that is possible, electrical or mechanical damping may be needed to avoid problems with resonance.

Advertising

Note that it is not difficult to extend the above control model to account, at least approximately, for viscous friction and for the dropoff of torque as a function of speed. To do this, we merely modify the above formulas for Aaccel and Adecel so that h and f are functions of V. Thus, instead of treating these as constants of the control algorithm, we must recompute the available acceleration at each step.

If our goal is to turn the motor smoothly from one set postion to another, we must first accelerate it, then perhaps coast at fixed speed for a while, then decelerate. The decision governing when to begin decelerating rests on a knowledge of the stopping distance from any particular velocity. Assuming that the available acceleration is constant over the relevant range of speeds, we can compute this from:

First we solve for the stopping time,

and then we solve for the stopping angle

Given this, we can outline a procedure for moving the motor from its current estimated position to a step just beyond some target position:

moveto( )

-- a function of one argument θ

-- no value is returned

while

and while repeat the following to accelerate

step( 1 )

wait seconds and then

θ = θ + S

while repeat the following to coast

step( 1 )

wait seconds and then
θ = θ + S

while repeat the following to decelerate

step( 1 )

wait seconds and then

θ = θ + S

Advertising

V = 0

done, θ and θtarget are within a step of each other!