Explainer
Convert an open loop stepper to closed loop control
Short answer
Converting an open loop stepper to closed loop control means a rotary encoder on the motor shaft, a drive mode that uses it for commutation and position, a position-tracking-error threshold that turns lost motion into a fault, and a non-zero recovery setting that returns the axis to the commanded setpoint after the fault clears. The motor's back EMF still sets the top speed.

On this page
- Where should the encoder sit on a belt-driven axis?
- Does adding an encoder by itself make the stepper closed loop?
- Which drive mode should the conversion use?
- How does the drive turn lost motion into a fault?
- How does recovery to the commanded position work?
- Example: how many counts are one full step of error on the 1000 P/R encoder?
- Why does back EMF still limit top speed after the conversion?
- What does commissioning the conversion involve?
- Questions asked
A stepper axis that loses steps can be brought under closed loop control without changing the motor: add a rotary encoder on the motor shaft, run the drive in a mode that uses the encoder for commutation and position, and make lost motion a fault that stops the axis and then recovers to the commanded position. The case worked through here is a 13 Nm NEMA 34 stepper — 1.8° per full step, four-wire two-phase, fed from a 48 VDC supply, taking 5 V pulse-and-direction commands from a custom controller — moving a belt-type linear axis. The three decisions that decide whether the conversion works are where the encoder sits, which drive mode you select, and how the fault-and-recovery handshake reaches the controller.
Where should the encoder sit on a belt-driven axis? #
On the motor shaft, directly coupled. A rotary encoder on the motor shaft closes the loop around everything the drive actually controls; a linear scale on the carriage alone would place belt stretch, backlash and compliance inside the control loop, and that spring element makes the position loop oscillate.
Mount it in line with the motor's rear shaft: a small bracket off the motor end bell, and the two shafts joined with a flexible shaft coupling that takes the motor shaft on one side and the encoder shaft on the other, so residual misalignment does not side-load the encoder bearing. The case against driving an encoder through a belt is made in Timing Belt vs Direct Mount for a Rotary Encoder. A linear scale still has a place — later. Once the motor-shaft loop is tuned and stable, a scale can be added as secondary feedback in a dual-loop arrangement to trim the belt stretch and backlash the motor encoder cannot see. Starting the conversion with the scale alone is the configuration that puts the belt's springiness inside the loop, and it will fight the tuner instead of helping it.
Does adding an encoder by itself make the stepper closed loop? #
No — an encoder closes the loop only when the drive is configured to use it. In ordinary open-loop stepping the drive energizes the next coil pair on a fixed schedule, and the encoder merely records the shaft falling behind; nothing in that firmware path compares counts to commands.
The background — what feedback does and does not change on a stepper — is covered in Does an Encoder Make a Stepper Motor Closed Loop. What the conversion adds is a drive that both uses the encoder and reports divergence. A stall-detection output on a conventional two-phase open-loop drive sits halfway: it announces a lost step after the fact, but it neither corrects the position nor brings the axis back to the commanded point. That gap between announcing and recovering is the case for a drive designed for closed-loop stepper or servo duty.
Which drive mode should the conversion use? #
Use the servo mode. On the IONI drive that is Mode 3: the stepper is sinusoidally commutated as a 100-pole servo motor, draws only the current the position error demands, and a properly tuned loop does not lose steps — with stepping noise and resonance gone as well.
The same drive usually offers closed-loop stepper operation too: encoder-corrected stepping that keeps stepper-style behavior if the application wants a drop-in. Servo mode is the better target when the goal is tracking accuracy and quiet running. Before enabling either mode, enter the motor's electrical data and the encoder's counts per revolution in the drive's setup software — Granity on the IONI; wrong motor data makes sinusoidal commutation run rough and weak. Tuning that loop is ordinary discrete-time feedback, the proportional-and-integral reasoning the page on digital control theory in classic textbooks explains, carried out in the drive software rather than the controller. Command scaling changes too: recalculate the controller's steps-per-unit for the new command resolution the way How to Calculate Step and Direction Servo Pulse Scaling shows. A drive chosen this way also keeps the door open — if the axis later outgrows the stepper, the same drive runs an AC servo motor without a controls redesign.
How does the drive turn lost motion into a fault? #
Through a position-tracking-error limit. While the loop is enabled, the drive continuously compares the commanded position with the encoder's position, and once the error exceeds the configured threshold it asserts a tracking-error flag instead of quietly continuing — a hardware I/O signal your controller can read and act on.
Set that threshold in encoder counts; the example below converts one full step of the example motor into counts. A threshold near one full step trips on a genuine stall before the axis has drifted far, and it needs widening only if a tuned axis trips on normal acceleration or reversal. When it trips on every move instead, the fault-and-threshold diagnosis runs along the same path as Troubleshooting a Servo Axis That Faults Mid Move. An open-loop drive offers nothing equivalent: with no closed loop there is no commanded-versus-actual comparison, which is exactly why the original axis accumulated its drift silently.
How does recovery to the commanded position work? #
Set the drive's recovery parameter — CRV in Granity on the IONI — to a non-zero value. After the fault is cleared, the drive then drives the motor back to the setpoint that was commanded when the tracking error occurred, treating that return as its goal until the position is reached.
Wire the handshake so the controller cooperates. Three signals do the work, and all three are broken out on the IONI and IONICUBE 1X connector pinouts: tracking error from drive to controller, clear faults from controller to drive, and servo ready from drive to controller. The sequence is then fixed: the controller stops issuing pulses the instant tracking error asserts; the mechanical cause is made safe; the controller clears the fault; and commanding resumes only once servo ready confirms the drive holds position again. There is no documented recovery time to count on. Recovery lasts however long the return move takes at the configured current and speed limits, so gate on servo ready instead of a fixed timer and measure the actual interval on the machine before promising the process anything as tight as a second.
Example: how many counts are one full step of error on the 1000 P/R encoder? #
Twenty counts, if 1000 P/R means 1000 line cycles per revolution, since quadrature decoding gives 4000 counts per revolution. The example motor takes 1.8° per full step, 200 steps per revolution, and 360° ÷ 4000 counts = 0.09° per count, so one step is 1.8° ÷ 0.09° = 20 counts.
This is a calculated example for these inputs, not a measured result. The trap is what P/R means. Some datasheets state line cycles per revolution, others decoded counts; if this encoder's 1000 P/R already meant counts, then 360° ÷ 1000 counts = 0.36° per count and one full step is 1.8° ÷ 0.36° = 5 counts — four times tighter than the cycles reading. Check the encoder datasheet's own definition before entering anything in the drive. The decision: start the tracking-error threshold at one full step of error, 20 counts on the cycles reading or 5 counts on the counts reading, and widen it only if the tuned axis trips it during normal acceleration or direction change.
Why does back EMF still limit top speed after the conversion? #
Because the conversion changes how the motor is driven, not what the motor can do electrically. A spinning stepper generates back EMF that opposes the supply, torque falls with speed exactly as the open-loop curve showed, and no control mode raises that ceiling — the motor's speed-torque curve remains the limit.
This is also why the conversion, rather than a motor swap, appeals at high torque: the example application needs more than 11 Nm from a NEMA 34 frame, and same-frame AC servos rarely reach a large stepper's stall torque. Expect the top speed to stay where the winding and supply voltage put it; servo-style commutation changes the shape of the current, not the voltage margin at speed. The second electrical item is regeneration. Braking the axis or reversing it fast pumps energy back into the DC bus and pushes bus voltage above what the supply set; frequent stopping and reversal is exactly the duty that calls for a regenerative resistor to dissipate the excess and protect the drive's power stage. Lower resistance means higher resistor current and faster dissipation, and the resistance and power rating come from the drive's documented regenerative-resistor limits, never from the supply's rating alone.
What does commissioning the conversion involve? #
Eight steps: fix the mechanics, prove the command signals, enter motor and encoder data, select the mode, recalculate scaling, set the threshold and recovery, tune up from low speed, then rehearse the fault on purpose. Closed-loop control cannot rescue a mechanically sick axis, so the order matters.
- Fix the mechanics first: check the belt axis for binding, excess compliance and backlash, because closed-loop control and recovery cannot remove the mechanical cause of a tracking fault.
- Verify the command signals at the drive terminals: signal level, pulse width and setup and hold times must meet the drive's input specification, since marginal pulse timing masquerades as a tuning problem.
- Enter the motor's electrical parameters and the encoder's counts per revolution in Granity, then select closed-loop stepper or Mode 3 servo operation.
- Recalculate the controller's steps-per-unit for the new command resolution and prove it against one motor revolution and a measured axis travel before moving real load.
- Set the position-tracking-error threshold to one full step of error in counts — 20 counts in the example — and set CRV to a non-zero value.
- Wire and prove the handshake: tracking error to the controller, clear faults to the drive, servo ready back to the controller.
- Tune at reduced speed and acceleration, then step both up while watching following error, noise and motor temperature, in the same order as Tuning a Pulse-and-Direction Stepper in Closed Loop.
- Rehearse the fault on purpose within machine-safe limits: stall the axis, confirm tracking error asserts and the controller stops commanding, clear the fault, confirm the axis returns to the commanded setpoint and servo ready asserts, then repeat at the fastest planned reversal and confirm the DC bus never reaches overvoltage.
Safety note: run the deliberate stall test with guards in place and the axis unloaded — once CRV recovery is enabled, clearing a fault starts motion without any new command, so a cleared fault is not a stopped axis.
Questions asked
Can the recovery move be made faster?
Only indirectly. Recovery is a normal move under the drive's current and speed limits, so a higher current limit shortens it and a shorter distance back to the setpoint helps, but the drive documentation promises no recovery time. If the process cannot tolerate the return move at all, treat tracking error as an operator stop and re-home instead of using automatic recovery.
Does the conversion require an absolute encoder?
No. An incremental quadrature encoder is enough, because following-error detection and recovery only need relative counts from the moment the loop is enabled. What you give up is position knowledge across power-off: like the original open-loop axis, the machine must home or reference at startup before it knows where the carriage actually sits.
Can the existing pulse-and-direction controller stay?
Yes, and that is the point of the conversion. The drive still accepts step and direction pulses from the existing controller; the additions are the three handshake lines and a recalculated steps-per-unit figure for the drive's command resolution. Nothing in the conversion forces a new motion controller or a different command interface.
What happens if the obstruction is still present when the fault clears?
The drive attempts the return to the setpoint, meets the same resistance, and trips the tracking-error fault again — the threshold keeps protecting through every recovery attempt. Clear faults only after the mechanical cause is removed. Have the controller count repeated faults and treat a repeat trip as an operator stop rather than another automatic recovery.

