AutomateDirectUSAMotion LibraryIndustrial monitors & PCs

Explainer

Why a Closed Loop Stepper Hunts on Linear Encoder Feedback

Servo and stepper motion Published 8 min read By AutomateDirectUSA engineering team

Short answer

A linear encoder finer than the smallest step your drive can reach does not make a closed loop stepper hunt. Hunting starts only when the loop keeps issuing corrective pulses across a target it can never hit. Derive the smallest axis increment from command pulse scaling times the screw lead, compare it with the scale increment in the same units, and set the in-position window wider than half that increment.

On this page
  1. Hunting is what the loop does, not what the scale does
  2. The smallest increment the command chain can reach
  3. What a finer linear scale changes
  4. Worked example: a 1.8 degree motor at 16 microsteps on a 5 mm screw against a 1 micron scale
  5. Step until told to stop, or move and report
  6. Proving it: trend error and command output together
  7. The decision
  8. Questions asked

A linear encoder finer than the smallest motion your drive can reach does not make a closed loop stepper hunt. Hunting is a loop behavior: it appears only when the loop keeps issuing corrective pulses across a target that lies between two reachable positions, so the error never clears and the axis oscillates about it. The check is arithmetic, not guesswork: derive the smallest axis increment from the command scaling and the screw lead, compare it with the scale increment in the same units, and keep the in-position window wider than half the increment. One worked case below runs the numbers end to end, then a trending test proves which situation your axis is in: limit cycle hunting, or residual error sitting quietly inside the window.

Hunting is what the loop does, not what the scale does #

Hunting, also called a limit cycle, is a sustained back-and-forth motion about the commanded target after the move should have ended. Two quantizers create the conditions: the command chain, because the motor can only stop where a microstep exists, and the feedback, because the scale only reports whole counts. A correcting loop that is asked for less error than those quantizers allow can never be satisfied, so it keeps issuing pulses and the axis oscillates.

The fineness of the encoder is a visibility question, not a motion question. A finer scale lets the loop see smaller errors; it does not create smaller positions for the motor to reach. Hunting therefore requires a loop that keeps correcting, and that in turn depends on where the loop is closed: inside the drive, or in the controller against the external scale.

This is not stepper-specific. Quantization-driven limit cycles are analyzed wherever digitally controlled loops meet a quantizer, from switching power converters to modulators. The stepper case is simply easier to compute, because both increments are numbers you can read from the configuration.

The smallest increment the command chain can reach #

Follow the chain from command pulse to axis travel. The controller sends pulses; the drive divides each pulse into microsteps, and in a step-and-direction system that division is set in the drive configuration, not by the controller; the mechanics convert motor rotation into travel. The smallest axis increment is the travel per motor revolution divided by the number of increments per revolution.

The rule in words: increments per revolution equals full steps per revolution times microsteps per full step, and the axis increment equals travel per revolution divided by that product. For a motor coupled directly to a ball screw, travel per revolution is the screw lead. Through a gearbox, divide by the ratio as well; on a belt drive, use the driven pulley circumference instead of the lead. Convert everything to the axis unit before comparing, micrometers for a scale-verified axis. Pulse frequency changes how fast the axis moves, not how far each pulse carries it: speed and increment are separate settings.

This is the same arithmetic as the pulse scaling calculation for a step-and-direction servo axis, so if you have already scaled that axis for position reporting, you already hold the number you need.

What a finer linear scale changes #

The linear scale quantizes the feedback: the loop knows axis position only to whole scale counts, for example 1 micron on a common metric scale. The usable resolution of the loop is the coarser of the two increments, command and feedback, because a loop cannot correct what it cannot see and cannot reach what the drive cannot command. When the scale increment is the finer one, the loop sees error components the drive can never remove exactly.

That visibility cuts both ways. More counts on a scale do not prove the axis can hold a finer position: the same trap as range scaling on a magnetic encoder. And a scale does not tune the loop either: the gains still decide how hard and how often the loop corrects an error, which is the entire subject of tuning a closed loop stepper on linear scale feedback.

Worked example: a 1.8 degree motor at 16 microsteps on a 5 mm screw against a 1 micron scale #

The inputs, each with its source:

  • Motor: a 1.8 degree full-step angle, the standard two-phase stepper geometry, which gives 360 / 1.8 = 200 full steps per revolution; the step angle for your motor is on its datasheet.
  • Drive microstep division: 16 microsteps per full step, an example setting; read the real value from your drive configuration.
  • Mechanics: a 5 mm ball screw lead with the motor coupled directly to the screw, an example machine.
  • Feedback: a 1 micron scale resolution, an example count; take the real value from the scale datasheet.

The formula in words: axis increment equals screw lead divided by full steps per revolution times microsteps per full step, and the best achievable residual on a target between increments is half the axis increment. The arithmetic for these inputs:

  • Increments per revolution: 200 x 16 = 3,200.
  • Axis increment: 5 mm / 3,200 = 0.0015625 mm, which is 1.5625 micron per command increment.
  • Half increment: 1.5625 / 2 = 0.78125 micron.
  • Scale check: the 1 micron scale increment is finer than the 1.5625 micron axis increment, about 1.6 to 1, so between two adjacent reachable positions the scale sees one or two counts and a target can sit where the error never reads zero.

The result: this is a calculated example for these inputs, not a measured one, and it says the smallest motion the chain can make is 1.5625 micron, with a best-case residual of about 0.78 micron on an unreachable target.

The decision it leads to: the fine scale does not hunt this axis by itself. With an in-position window wider than the 0.78 micron half-increment, 2 microns as a workable example, the loop enters the window and stops commanding, and the axis holds. If the loop is asked for less residual error than that, it can never be satisfied and it will keep reversing for as long as it keeps correcting. To place finer than half the increment, reduce the increment itself: going from 16 to 64 microsteps gives 5 mm / 12,800 = 0.39 micron per increment, while a finer scale changes nothing the motor can reach.

Step until told to stop, or move and report #

The question behind hunting is often which device closes the loop. Two architectures exist, and they behave differently with a fine external scale.

In the common closed-loop stepper built on step-and-direction, the controller issues the commanded pulse count and the drive corrects rotor position against its own motor-mounted feedback. The external scale then reports axis position to the controller but drives no correction, so the scale resolution cannot hunt the axis in this architecture however fine it is.

Hunting from encoder resolution requires the controller itself to close the position loop on the scale: the controller converts leftover scale error into additional command pulses and keeps correcting after the motion settles. That is the configuration where a fine scale plus a tolerance tighter than the half-increment produces the oscillation.

You can tell which architecture you have without opening a manual: watch the drive command input after the move completes. Pulses keep arriving, the controller is correcting on the scale. The command line goes quiet with the axis short of target, the loop is closed inside the drive, and the residual error is a scaling or window question rather than a hunting question.

Proving it: trend error and command output together #

A single reading cannot separate hunting from residual error; the two look identical at one instant. Trend both signals after the move and the difference is unmistakable.

  1. Command a target that lands between two reachable increments, as in the worked example above, and let the motion settle.
  2. Record the scale position and the drive command output, whether that is the pulse stream, the direction state or a torque command, for several seconds at rest.
  3. Nudge the axis or command a small offset away from target, release, and record again. Keep the disturbance within what the machine maker permits and keep guards closed while the axis is powered and able to move.
  4. Read the pair of traces: command output reversing direction repeatedly while the error oscillates about the target with a steady period is the limit cycle; a command output that goes quiet while the error holds one steady value is residual error inside the window, not hunting.

If you see the limit cycle, widen the in-position window above the half-increment and retest before touching anything else. If the output stays active even with a wide window, the correction strength itself is the suspect, and an internal loop still needs real PID gains.

The decision #

Commit to this order.

First, compute the axis increment from the drive microstep setting and the mechanical transmission, and halve it. Second, set the in-position window wider than that half-increment, wide enough that the loop always reaches it on an unreachable target and no wider than the process tolerates. Third, verify the scale counts and multiplier are entered correctly, because a wrong multiplier fakes a persistent error that no window can satisfy. Fourth, only if the process genuinely needs placement finer than the half-increment, reduce the increment itself: more microstepping, a finer screw lead, or a reduction ratio in the drive train. A finer linear scale is never the fix for hunting; it is the instrument that proves where the problem sits.

Run the trending test after every change. Reversing pulses mean keep looking; a quiet command line with steady error means the axis is done.

Questions asked

Does the motion controller set the microstep size?

Usually not. In a step-and-direction chain the drive converts each incoming pulse into a microstep, and the division lives in the drive configuration; the controller only sends and counts pulses. Drives that accept position commands over a fieldbus apply their own internal scaling instead, so the number you need sits in the drive manual in both cases. The controller sets the increment only when it closes the position loop itself on an external scale.

Does a finer linear encoder improve positioning accuracy?

No. Finer feedback only sharpens how well the loop sees error; the achievable motion is still set by backlash, compliance, friction and the smallest increment the drive can command. Once the scale reads finer than that increment, extra counts make the error trace more detailed without moving the axis any finer. Accuracy comes from the mechanics and calibration, not from the feedback count.

What does hunting look like in a trace?

Position error oscillating about the target with a regular period instead of decaying, command pulses alternating direction after the move has finished, and often an audible buzz or a visible tremor at rest. If the command output goes quiet while the error holds one steady value, the axis is not hunting: that is residual error sitting inside the in-position window.

Can a closed loop stepper hunt with a coarse encoder?

Yes. The quantization that feeds a limit cycle can sit on either side of the loop: with fine microstepping and a coarse scale, the reported position can jump between counts across a target that lies between them, and a loop without a deadband corrects every jump. Any combination where the demanded tolerance is tighter than the increments involved can hunt.

Which change stops hunting fastest?

Widen the in-position window first: it costs nothing, it is reversible, and any window wider than half the smallest axis increment lets the loop finish. Reduce the increment with more microstepping or a finer screw only when the process truly needs placement finer than the half-increment.

Keep reading

  • How-to

    Tuning a Closed-Loop Stepper With Linear Scale Feedback

    Commission the axis open loop first, verify both linear scale channels and the counts-per-unit constant with gains at zero, then close the loop at an integral gain near 0.01 with about 100 Hz filtering. Backlash, stiction and compliance end up inside the loop, so it limit-cycles at rest — fix the mechanics and the gains together.

    Servo and stepper motion

  • Explainer

    Why a PTO Axis Cannot Close the Loop With an External Encoder

    A pulse-train (PTO) motion axis cannot use an external encoder as closed-loop feedback: its internal counter counts commanded pulses only and cannot be read by your program. Close the motor-side loop with a closed-loop stepper drive, and read a separate encoder through a user-accessible high-speed counter purely to compare against the axis position.

    Servo and stepper motion

  • Troubleshooting

    Servo External Scale Error Alarm: Fix the Feedback Path

    An external scale error alarm fires when the drive's scale-error input sits OFF while scale-error monitoring is enabled and the axis runs full-closed or hybrid control on an external encoder. Check the cable and connectors, then the scale mounting, then the scale-type and monitoring parameters, in that order. Do not silence the alarm by disabling monitoring; fix the feedback path and restore the setting before the axis runs again.

    Servo and stepper motion