Inaccurate Closed Loop Stepper Movement

Reported In

Reported In shows products that are verified to work for the solution described in this article. This solution might also apply to other similar products or applications.

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:

The system is commanded to go to a position of 9.

The controller sends out 9 pulses.

The motor moves 9 steps.

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:

The system is commanded to go to a position of 9.

The controller sends out 9 pulses.

The motor moves 9 steps.

The controller checks its position and sees that it is still at a position 0 because it has not received an encoder pulse yet.

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.

This causes the motor to move to a position of 18 steps from its original position.

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).

Because the controller thinks the motor is still at a position of 10, it sends 1 reverse step as its second pull in move.

This causes the motor to move to a position of 17 steps from its original position.

The controller checks its position and thinks that it is still at a position of 10 because it has only received one encoder pulse.

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.

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:

Reduce the number of microsteps.

Use a higher resolution encoder.

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.

Turn off pull-in moves by setting the number of pull-in tries to 0 in MAX.