Troubleshooting
Fixing Non-Circular Servo Cuts: Servo Lag Not Encoder Wiring
Short answer
No. Connect the motor encoder to the servo drive, not to Mach3: the drive closes the position loop, and Mach3's Encoder/MPG inputs can only read counts, not correct them. Distorted circles come from unequal X and Y servo lag during acceleration and reversal, so fix them with per-axis gain and damping in the drive, then by removing reversal lost motion in the mechanics.

On this page
- Do I need to connect the servo drive's encoder outputs to Mach3's encoder inputs?
- If both axes finish in the right place, am I losing steps or counts?
- What is following error and why does it distort a circle?
- How do I measure the lag on each axis?
- How much lag difference can a circular cut tolerate?
- Why does my circle have flats or steps at the four reversal points?
- What order do I fix this in, mechanics or tuning?
- Questions asked
No. Connecting the servo drive's CN1 encoder outputs (PA+, PA-, PB+, PB-) to Mach3's Encoder/MPGs inputs cannot close the position loop. In a step-and-direction system the loop is already closed inside the drive, against the motor encoder; Mach3 can only count pulses on those inputs, never correct a move with them. Non-circular cuts on a servo-driven ballscrew machine come from unequal servo lag between X and Y during acceleration and reversal, from lost motion at the drivetrain's reversal points, or both. The numbers that decide it are each axis's following error and current demand read from the drives, plus one circle test cut at two feeds.
Do I need to connect the servo drive's encoder outputs to Mach3's encoder inputs? #
No — leave CN1's PA+, PA-, PB+ and PB- unconnected to Mach3, because in a step-and-direction system the drive closes the position loop on the motor encoder, and Mach3's Encoder/MPGs inputs can only count pulses for display, never correct them.
The division of work is fixed by the architecture:
- Motor encoder to the drive: the real feedback path. The drive holds motor position locked to the incoming pulse train, and this is the only loop whose tuning changes your contour.
- CN1 encoder outputs into Mach3 (the Encoder/MPGs page under Config → Ports & Pins, Encoder 1,2,3): a read-only count. Even with a custom macro or plugin, the best it can do is notice a mismatch and stop the machine; it cannot servo-correct a move in progress.
- Monitoring layered on top of that: supervisory, worth building only after the existing loop measures well.
One electrical caution: PA+, PA-, PB+ and PB- are drive outputs whose voltage and signal standard you have not matched to the receiving input, and wiring an unverified output into a port can damage it. Verify both datasheets before connecting anything — or, per the answer above, leave it disconnected.
If both axes finish in the right place, am I losing steps or counts? #
No — a machine that returns exactly to its start point is not losing counts, because missing pulses in a step-and-direction system leave a persistent end-of-move offset, while a wrong shape with a correct endpoint points to transient tracking error during the move.
A circle is the exposure test for exactly this: interpolation forces both axes to change speed continuously, and each axis reverses direction twice per revolution. The drive can trail its command while accelerating, catch up afterward, and still land exactly on the endpoint — the part records the trail, not the landing. An accurate endpoint is therefore not evidence of an accurate path; measure the contour and the axis behavior during the move.
What is following error and why does it distort a circle? #
Following error is the gap between the position the drive commanded and the position its motor encoder reports at the same instant; on a circle, equal lag on both axes merely delays the shape, while unequal lag bends it into an ellipse.
At constant feed the error grows in proportion to feed and inversely with the drive's position-loop gain — the first-order relationship e = v / Kv. During a velocity ramp it grows with acceleration, and at each reversal it passes through zero and changes sign. Two consequences:
- Equal lag on X and Y traces the same circle, slightly late. A delayed circle is still a circle, so you never see it in the part.
- Unequal lag traces an ellipse with its axes roughly 45° to X and Y. Which way it leans flips with the circle's direction of travel and with which axis is slower.
The motor encoder reports motor angle, not table position, so none of this tells you what the tool actually did — that takes the mechanical checks below.
How do I measure the lag on each axis? #
Read each drive's following-error display while the axis runs at constant feed, then divide by that feed to get a lag time in milliseconds — the one number that compares fairly between X and Y.
Drives state following error in their own units, so convert to a time before comparing: τ = following error ÷ feed. Where a drive offers no diagnostic display or commissioning software, take the equivalent data at the table with an indicator. Then work this list, cheapest first:
- Travel per commanded distance: indicator on the table, command a known move per axis, compare. A scaling error makes ovals aligned with an axis, so fix steps-per-unit before anything dynamic.
- Lag time at cutting feed: run each axis at the feed you actually cut circles at, record following error, compute τ for X and Y.
- Current or torque demand at that same moment, against the drive's configured limit. High following error with current near limit is a torque problem — friction, acceleration, or load — and gain cannot create torque; the failure pattern is the one in why a servo faults when acceleration ramps increase.
- Reversal lost motion at the table: indicator on the moving table, approach one point from each direction, read the dead band. Low following error with visible table dead band points past the motor encoder into coupling, screw, and supports — the path covered in diagnosing servo axis position drift in the drivetrain.
- Motor and drive temperature after a run of circles: sustained heating supports a friction or torque-capacity cause rather than a tuning one.
How much lag difference can a circular cut tolerate? #
As a calculated rule, roundness error ≈ feed × Δt ÷ 2: at 2,400 mm/min (40 mm/s), every 1 ms of lag mismatch between X and Y adds about 0.02 mm of ellipse to every circle, whatever its radius.
The rule comes from the geometry of two axes lagging by different times, using a first-order lag model at small lag angles — a calculation, not a measured rating. Worked example for stated inputs:
- Programmed circular feed: v = 2,400 mm/min = 40 mm/s tangential.
- X drive displays 0.28 mm of following error at that feed: τx = 0.28 mm ÷ 40 mm/s = 0.007 s = 7 ms.
- Y drive displays 0.16 mm: τy = 0.16 mm ÷ 40 mm/s = 0.004 s = 4 ms.
- Mismatch: Δt = 7 ms − 4 ms = 3 ms.
- Predicted roundness error: v × Δt ÷ 2 = 40 mm/s × 0.003 s ÷ 2 = 0.06 mm — a 60 µm ellipse at 45° to the axes on every circle cut at that feed, with both axes still finishing on their endpoints.
Invert the rule to set your own limit. An allowed roundness error T at feed v needs Δt ≤ 2T ÷ v; holding 0.02 mm at 40 mm/s needs Δt ≤ 2 × 0.02 mm ÷ 40 mm/s = 0.001 s = 1 ms. For these inputs the decision is concrete: raise X's response until it reads about 0.16 mm at 40 mm/s — matched to Y — then recut the circle both ways and measure.
Why does my circle have flats or steps at the four reversal points? #
Steps or flats at the quadrant crossings — where one axis stops and reverses — are reversal lost motion in the drivetrain, not a count problem, and the motor encoder cannot see them because it sits before the coupling, screw, and nut.
The drive reports good tracking while the table stands still through the dead band, then catches up. Usual sources, cheapest to check first:
- Motor-to-screw coupling: loose set screws or a worn flex element; checking and retorquing costs minutes. If the element itself is damaged, replacing it with a flexible shaft coupling matched to the motor shaft and screw end is the straightforward fix.
- Ballscrew support bearings: axial play at the fixed end reads as reversal error at the table.
- Nut preload: play between screw and nut shows only on reversal.
Confirm with the indicator dead-band test, then cut the same circle at half the feed: servo-lag distortion shrinks with feed, mechanical steps stay the same size at the same four spots. For distortion concentrated on one axis, troubleshooting randomly distorted CNC circles on the X axis runs the same checks in one plane.
What order do I fix this in, mechanics or tuning? #
Mechanics and scaling first, tuning second: correct lost motion and confirm travel per commanded distance before touching gains, because gain cannot create torque or remove backlash, and tuning over a loose drivetrain buries the fault.
- Save a baseline: Mach3 configuration and all drive parameters, plus drive model, command mode, motor, and encoder wiring.
- Fix scaling on each axis from the travel check, in the controller's steps-per-unit or the drive's electronic gearing.
- Fix reversal lost motion from the mechanical checks above, per the component documentation.
- Recompute τx and τy at cutting feed. If current demand sits near the drive's limit, fix friction or lower acceleration before tuning.
- Tune the slower axis by the drive manufacturer's commissioning procedure: raise position gain until its lag time approaches the faster axis's, add damping when the motor audibly rings, and use velocity and acceleration feedforward if the drive offers it — feedforward removes lag without the stability cost of gain. Change one documented setting at a time; how far gain can go is set by the load-to-motor inertia ratio, the pattern shown in tuning a servo axis with a 6:1 ballscrew inertia ratio.
- Accept on measurement: recut the same circle in both directions at the same feed and radius. ISO 230-4, the circular-test part of the machine-tool test code, defines the acceptance test — trace full circles at a stated feed and radius in each plane and direction, then score the deviation from a fitted reference circle, the radius deviation, and the local spikes at the reversal points; ASME B5.54 carries the equivalent ballbar test for machining centers.
Decision per case, using the example numbers:
- Lag mismatch dominates, current headroom healthy: tune the slow axis and add feedforward; accept at Δt ≤ 2T ÷ v, which is 1 ms for 0.02 mm at 40 mm/s.
- Current near its limit or heating: fix friction, acceleration, or torque capacity; no gain setting holds the contour.
- Table dead band on reversal: mechanical fix first, then retune and recheck both lag times.
- Travel per commanded distance wrong: scaling, corrected before any dynamic change.
Questions asked
Does a higher-resolution encoder fix distorted circles?
Not this fault. Resolution sets how finely the drive can resolve position, and that loop is already closed at the drive; the distortion comes from unequal lag between axes or lost motion after the motor. A finer encoder also changes that axis's tuning, so if you change one, retune both axes and recheck the lag difference.
Should X and Y end up with identical gain values?
No. The gain that suits a heavy axis on a long screw can be unstable on a lighter one, and copied values leave the lags unequal. Match the outcome instead: adjust each axis until both show about the same following error at the same feed, and let the parameter values differ.
Is some following error normal on a servo axis?
Yes. A servo in position control always trails its command while moving; zero following error at full feed would mean the loop is overdriven. What matters for shape is that both axes trail by nearly the same time at cutting feed and that each returns to zero error once it stops.
What does feedforward do that gain cannot?
Gain reacts to error that already exists, so chasing lag with gain alone pushes the loop toward oscillation. Feedforward drives the motor as commanded velocity and acceleration arrive, cutting following error at feed and during ramps without that stability cost. Tune it after the gains are stable, then recheck the lag difference between axes.
How do I separate servo lag from backlash with no instruments?
Cut the same circle twice, the second time at half the feed. Distortion that shrinks with feed is servo lag, because lag scales with feed; marks that stay the same size at the same four quadrant positions are reversal lost motion, because backlash does not care how fast you cross it. Most bad circles show some of each.