Microchip Technology DM164130-7 Data Sheet

Page of 60
F1 LV Evaluation Platform Motor Control Add-Ons
DS41629A-page 46
 2012 Microchip Technology Inc.
5.5
OPTIMIZING STEPPER MOTOR PARAMETERS
5.5.1
Stepper Motor Closed-Loop Drive Overview
Stepper motor closed-loop operation is technically not closed loop. When Closed-Loop 
mode is selected, then both the motor voltage and speed outputs simultaneously follow 
the single-speed control input as independent open-loop functions of the minimum and 
maximum speed and drive parameters. This section describes how to use the GUI to 
optimize the linked speed and drive functions. First, it’s helpful to understand why 
simultaneous control of speed and voltage is necessary.
It is the nature of stepper motors to be overdriven. In other words, the voltage and cur-
rent applied to the motor exceeds what is actually needed to rotate the motor. Ideally, 
the excess drive should be kept to a minimum. When the motor is stationary, the 
applied voltage needs to be only large enough to keep the motor in position. When 
there is no external torque applied to the motor, the stationary drive voltage can be as 
low as zero. In order to rotate the motor, a drive voltage must be applied to the motor 
coils through drive switches in sequence to progressively rotate the motor to each step 
position. The PWM duty cycle to the drive switch determines the effective applied volt-
age. The rate at which the switches are changed is the commutation rate. As the motor 
speed is increased, it takes more drive voltage and current to maintain speed. If the 
voltage applied to the motor to maintain the fastest speed were to remain unchanged, 
then as the motor slowed, the drive current would increase. To minimize excess cur-
rent, the voltage applied is a function of the commutation rate. For our purposes, the 
relationship between the applied voltage and commutation rate is linear. The general 
formula for a linear relationship is:
EQUATION 5-1:
We actually have two linear relationships: 
• The relationship between the speed control input and the commutation rate
• The relationship between the speed control input and the PWM duty cycle
The speed control input is an 8-bit number and so has the range from 0 to 255. For any 
given speed setting, we need to compute both the commutation time and the duty 
cycle. 
For the duty cycle calculation the equation substitutions are as follows:
EQUATION 5-2:
For the commutation time, the equation substitutions are as follows:
EQUATION 5-3:
Y
mX b
+
=
m = DUTY_SCALE
b = MIN_DUTY
X = speed request (0 to 255)
Y = duty cycle value
m = SPEED_SCALING_CONST 
b = 0
X = 1/speed request (0 to 255)
Y = Timer 1 counts in each commutation period