Stepper Motors Work in Open Loop Mode But Behave Incorrectly in Closed Loop Mode

Updated Apr 2, 2018

Reported In

Hardware

  • PCI-7332
  • PXI-7332
  • PCI-7334
  • PXI-7334
  • PCI-7342
  • PXI-7342
  • PCI-7344
  • PXI-7344
  • PCI-7352
  • PXI-7352
  • PCI-7354
  • PXI-7354
  • PCI-7356
  • PXI-7356
  • PCI-7358
  • PXI-7358
  • PCI-7390

Driver

  • NI-Motion

Issue Details

I can command my motion controller to move a stepper motor to a target position in Open Loop mode, but when I configure it to run in Closed Loop mode, the motor doesn't appear to complete the move, doesn't move at all, or continues moving briefly after the move is complete.

Solution

  • Verify that the correct values for stepper and encoder resolution are entered in Measurement & Automation Explorer (MAX):
  1. You can find the Stepper Resolution under Axis Configuration»Stepper Settings and the Encoder Resolution under Encoder Settings. If you are not sure what the steps per revolution value should be, you can configure the stepper motor to run in Open Loop mode. Then you can do a series of moves in 1D Interactive until the stepper motor has turned one revolution. The number displayed of steps it took to rotate the motor 360 degrees will be your steps per revolution. This information can be found in the manual for the motor as well.
  2. To figure out what the encoder counts per revolution value should be, you can configure the axis for Closed Loop Stepper mode. In 1D Interactive with the current axis selected, press Kill, which should de-energize the axis. Then turn the motor shaft one revolution to get the encoder counts per revolution. This information can be found in the manual for the encoder as well. 
  3. Enter both of these values into their proper places and be sure to Save and Reinitialize the motion card.
  • Verify that the phases of the encoder are correct:
    1. Verify that the encoder counts up and down in the correct directions. To find this out, configure the Stepper for Open Loop Mode operation and note what direction the stepper motor is turning when the position is increasing (either clockwise (CW) or counter clockwise (CCW)).
    2. Reconfigure the Stepper for Closed Loop Mode.  Now Kill the axis in 1D Interactive and turn the motor CW or CCW, make sure the encoder is counting in the same direction (up or down) as the motor was moving previously. If the encoder is backwards, swap phases A and B of the encoder.
  • Verify that the encoder is working properly:
    1. Use an oscilloscope to make sure that both phases of the encoder are generating a pulse train and that the two pulse trains are 90 degrees out of phase with each other.

Additional Information

Closed loop steppers work differently from closed loop servos. Instead of adjusting the output on each PID iteration like a servo system, closed loop steppers will do a pull-in move at the end of a move to adjust for any difference between the target position and the encoder feedback. By default, it will attempt the pull-in move three times. This number can be adjusted to any number between 0 and 32,767 in Measurement & Automation Explorer (MAX) under Axis Configuration»Stepper Settings tab. This number can also be adjusted using the To Unsigned Long Integer Function in LabVIEW or the flex_setu32 function in C/VB with the Pull-in Tries attribute.

WAS THIS ARTICLE HELPFUL?

Not Helpful