Setting the microstepping parameters for smooth motors

To set the microstepping: start with the suggested PWM[] values ranging from 100 on down. Start with MsDelayX = 1, and MsPause = 0 if on a slower machine, and MsDelayX = 6 if on a faster machine. Adjust MsDelayX such that PWMRepsTick displayed (turn on tracking for a few seconds) is 20 to 40. People have reported mixed success with slow machines and PWMRepsTick values as low as 7. Values as high as 50 to 100 will also work. Find the MsDelayX value that results in smoothest motor rotation, adjusting MsPause to higher values possibly to 500 or more, to reduce voltage and current draw, and to smooth the motor rotation.

Here's how the microstepping is laid out:

To reverse motor direction, swap motor leads #1 and #3, or alternatively, #2 and #4.  Finally, you can swap motor directions in the config.dat file.

Adjusting the microsteps:

The program now handles microstepping up to 40 microsteps per fullstep.  The following was written with 10 microsteps per fullstep in mind.

For 10 microsteps per fullstep, the windings are combined as follows:
;rotor centered on winding
PWM[0] 100
PWM[1] 100
PWM[2] 100
PWM[3] 100
PWM[4] 100
;rotor between windings
PWM[5] 100
PWM[6] 85
PWM[7] 70
PWM[8] 55
PWM[9] 35

For 20 microsteps per fullstep, the windings are combined as follows:
;rotor centered on winding
PWM[0] 100
PWM[1] 100
PWM[2] 100
PWM[3] 100
PWM[4] 100
PWM[5] 100
PWM[6] 100
PWM[7] 100
PWM[8] 100
PWM[9] 100
;rotor between windings
PWM[10] 100
PWM[11] 94
PWM[12] 86
PWM[13] 77
PWM[14] 69
PWM[15] 62
PWM[16] 54
PWM[17] 46
PWM[18] 37
PWM[19] 27

(this written with 10 microsteps per fullstep in mind)
Set TestString to Track in the config.dat file, and choose 1 microstep per second. Put a piece of masking tape on the motor shaft and watch it carefully for even spacing of the microsteps. If the step is too far apart, bring the voltages closer together. For instance, if the spacing between microstep #0 and #1 is too far, then lower PWM[9], if the motor hardly seems to move between #0 and #1, increase PWM[9]. Again, if the spacing between #3 and #4 is too large, then increase #3, or decrease #4, or a combination of the two.  You can change the PWM[] values on the fly.  When you get them the way you wish, copy the values to the config.dat file.

Here is a contributed method: "There is a way that I used to find the proper PWM numbers for the drive that can interest you:
I started first with approximate numbers in the software.
I mounted a 7.96" plastic rod on the shaft to get   a 50" circumference or 0.025" per microstep.
I put the software in TestString = Track mode with 0.1 step per second.
I measure each microstep position with a micrometer head for 4 full steps.
I calculate the mean displacement for each microstep 0 to 1, 1 to 2 etc..
This give me a nice smooth curve. I pickup the PWM numbers for 0.025", 0.050", 0.075" and so on. I put back these numbers in the config.dat file and restart the measurement and write down. The result was almost perfect. I had to change the numbers of only plus or minus 1."

Yet another suggestion from Juan Herrero: "I was going nuts trying to measure and adjust the variances between the microsteps in my Altaz controlled motors. I had 4 drinking straws taped end on end. Attached to the stepper motor shaft. The end of the 3' straw comptraction, would only move a couple of millimeters per microstep. It was very difficult to take the measurements. And then...Mel decided to improve his software from 10 to 20 microsteps! How could I measure all those tiny steps ? Well yesterday I saw the light! Laser light that is. I went to RadioShack and got their cheapest laser pen pointer. Taped it to the motor
shaft. And projected the beam on the  wall. I can now measure microstep movements 20mm big! TA DA!"

Date:________ Computer _________ Dir:_________ Scope.exe
Compiled:__________ Telescope _____PCB ______

InvertOutput    0       0 for PCB
FR Step Size            2.25 for ½ step,  4.5 for full step
HSTimerFlag             1 for IRQ8 (DOS),  0 for Windows
Max Delay               2000 (DOS)
Min Delay               1000 (DOS)
HsDelayX                N/A DOS,  Multiplier for Windows slews

PWMRepsTick             Shoot for 20-60
MsDelayX                SlowPC=1, fast PC=6
MsPause                 Current Control during MS

Motor Current
PWM[0]                              a   100     Step0 = PWM[0]
PWM[1]                              b   100     Step1=PWM[1]+PWM[9]
PWM[2]                              c   100     Step2=PWM[2]+PWM[8]
PWM[3]                              d   100     Step3=PWM[3]+PWM[7]
PWM[4]                              e   100     Step4=PWM[4]+PWM[6]
PWM[5]                              f   100     Step5=PWM[5]+PWM[5]
PWM[6]                              g           Step6=PWM[6]+PWM[4]
PWM[7]                              h           Step7=PWM[7]+PWM[3]
PWM[8]                              i           Step8=PWM[8]+PWM[2]
PWM[9]                              j           Step9=PWM[9]+PWM[1]

SETUP:   Pointer and scale on Motor, 10amp Range on Meter.
Calculate current to meet wattage limit on Motor: V=IR, VRated * IRated = WattsRated,
        Iops = WattsRated / Vops   __________________________
1. Start: Default PWM's,  MsDelayX=1 for slow and up to 6 for fast,
MsPause=0, PWMRepsTick=display in Track

2. Adjust MsDelayX till PWMRepsTick = 20 <-> 60 (may increase current) and motion is smooth.
        (Motion is smoother at lower PWM's, but current is higher and so is sound)

3. Adjust MsPause to get current within Motor Wattage Limits: (When current is too low, motion gets jerky)  
        Increase MsPause, Decrease PWM[x]'s or Decrease MsDelayX  to Decrease current

        Decrease MsPause, Increase PWM[x]'s, or Increase MsDelayX to Increase current

4. Adjust PWM[x] Matrix for even steps (Larger PWM[x]'s decrease PWMRepsTick

 If spacing is too big: bring voltages closer together;
      if spacing too small, increase the difference in voltages:

 If the move between 0 and 1 is too big,
        reduce [9] to decrease how much winding B pulls off of centered on A
 If motor barely moves between 0 and 1,
        Increase [9] so winding B pulls it more off of centered on A
 If spacing between [3] and [4] is too big,
        increase [3] or decrease [4]  (or both)
PWM (winding A)    Step #              PWM (winding B)
100  a   0--0--------------------0  a  100
100  b   1---1-------------------9  j  ___
100  c   2-----2-----------------8  I  ___
100  d   3-------3---------------7  h  ___
100  e   4---------4-------------6  g  ___
100  f   5-----------5-----------5  f  100
___  g   6-------------6---------4  e  100
___  h   7---------------7-------3  d  100
___  i   8-----------------8-----2  c  100
___  j   9-------------------9---1  b  100

5. Iterate 2-4 till current within wattage limit,
        PWMRepsTick = 30-60, and motion is smooth/even

6. Adjust MinDelay and MaxDelay (and HsDelayX if Windows)
        to allow smooth and fast slews with no buzzes (Min Delay = Buzz)

7. Copy these values into Config.dat
 Bob Norgard has written a webpage on adjusting the microstep values.  It is at

Tom Krajci has an Excel spreadsheet to adjust the microstepping.  Logon and look at the scope-drive archives.