Inaccurate Closed Loop Stepper Movement

Updated Sep 19, 2022

Reported In

Hardware

  • PCI-7330
  • PCI-7332
  • PCI-7334
  • PCI-7342
  • PCI-7344
  • PCI-7352
  • PCI-7354
  • PCI-7358
  • PXI-7330
  • PXI-7332
  • PXI-7334
  • PXI-7340
  • PXI-7342
  • PXI-7344
  • PXI-7350
  • PXI-7352
  • PXI-7354
  • PXI-7358

Driver

  • NI-Motion

Issue Details

Why does my closed loop stepper system not move to the location that I have specified?

Solution

This behavior can often be seen when the stepper motor has a higher resolution than the encoder (more steps per revolution on the motor than counts per revolution on the encoder). The reason this occurs can best be illustrated with an example:

Example Setup:
  • Stepper Motor
  • NI Motion Controller
  • A stepper motor with 200 steps per revolution
  • An encoder with 20 counts per revolution
  • Measurement & Automation Explorer (MAX) is set to do 3 pull-in moves
Open Loop Scenario:
  1. The system is commanded to go to a position of 9.
  2. The controller sends out 9 pulses.
  3. The motor moves 9 steps.
  4. Since there is no feedback providing position data to the controller, it assumes that since it sent out 9 steps for the motor to move that the motor is in the correct position.
Closed Loop Scenario:
  1. The system is commanded to go to a position of 9.
  2. The controller sends out 9 pulses.
  3. The motor moves 9 steps.
  4. The controller checks its position and sees that it is still at a position 0 because it has not received an encoder pulse yet.
  5. Because the controller thinks the motor has not moved (Still at position 0 because it has not received an encoder pulse), it commands the stepper to step 9 more times as its first pull in move.
  6. This causes the motor to move to a position of 18 steps from its original position.
  7. The controller checks its position and thinks that it is only at of position 10 because it has only received one encoder pulse (1 encoder pulse = 10 stepper steps).
  8. Because the controller thinks the motor is still at a position of 10, it sends 1 reverse step as its second pull in move.
  9. This causes the motor to move to a position of 17 steps from its original position.
  10. The controller checks its position and thinks that it is still at a position of 10 because it has only received one encoder pulse.
  11. Because the controller thinks it is still at a position of 10, it commands the stepper to move 1 more step in the reverse direction in an attempt to get to a position of 9 as its third and final pull in move.
  12. Finally, the motor moves to its final position of 16 steps from its original position and stays there because it has completed all of the pull in attempts.
Below is an illustration of the Closed Loop Scenario:
 
Figure 1. Illustration of the Closed Loop Scenario

Because the controller does not compensate for what it perceives as position error in open loop mode, the motor always goes to the same commanded position. In closed loop mode, the motor is bouncing around inside a single encoder pulse trying to find a certain position.

There are several recommendations that can be made towards correcting this behavior: 

Hardware Changes:
Setup your system so that there are more encoder counts per revolution than steps per revolution. This could be done in one of three ways:
  1. Reduce the number of microsteps.
  2. Use a higher resolution encoder.
  3. Use a lower resolution stepper motor.
Software Changes:
All of these settings are at Device and Interfaces>>NI-Motion Devices>>Default 73xx Configuration>>Axis x>>Axis Configuration>>Stepper Settings.
  1. Turn off pull-in moves by setting the number of pull-in tries to 0 in MAX.
  2. Use an open loop configuration. 
  3. Make the pull-in window smaller in MAX.