Backlash Compensation Tuning in CNC Servo Systems

David Krause16 min read
Motion ControlSiemensTechnical Reference
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Overview of CNC Backlash Compensation

Backlash is the non-productive motion at a mechanical reversal that exists in every geared, leadscrew, or rack-and-pinion drive train. In a CNC machine the backlash value (commonly called the backlash compensation amount or lash comp) is the distance the control adds to a move command whenever the move direction reverses, so that the displayed position and the axis internal position counter agree with the true mechanical position. According to the engineering reference on backlash, the reasons machine builders specify a minimum backlash include allowance for lubrication film, manufacturing tolerance, deflection under load, and thermal expansion; on a precision machine tool these same allowances are reduced to the minimum while the control must still correct for whatever residual remains (Wikipedia: Backlash (engineering)).

From a controls standpoint backlash compensation is implemented as an additive or subtractive offset on the position command, applied the instant the commanded velocity changes sign. The IEEE record on Identification and compensation of gear backlash without output describes the classical formulation as a dead-zone inverse element added to the closed-loop controller so that the controlled plant sees an effectively backlash-free transfer function (IEEE 724172). On industrial PLCs the same idea is exposed as a function block; the Siemens S7-1500 Backlash compensation documentation describes a state-machine implementation that watches the direction change and applies the offset once per reversal (Siemens S7-1500 backlash compensation application doc).

Backlash compensation corrects the position counter and the DRO; it does not remove the mechanical lash from the drive train. Any cutting force that approaches or exceeds the preload of the nut will still produce a momentary reversal on the order of the mechanical lash before the servo restores position.

Sources of Backlash in a Typical Machine Tool Axis

A flatbed lathe or knee mill usually exhibits backlash from more than one contributor. The dominant contributors, in approximate order of magnitude for a hobby-grade lathe, are listed in the table below.

Contributor Typical Magnitude Compensated by control?
Axial ball-nut clearance 0.001–0.005 in (25–125 µm) Yes (parameter P-xx or equivalent)
Belt compliance between motor and screw 0.0005–0.002 in (12–50 µm) Yes, folded into the same value
Encoder granularity (rotary) ±1 count (e.g. ±0.00005 in on a 1 µm scale) No – resolution limit
Slide / Turcite clearance 0.0002–0.001 in (5–25 µm) No – mechanical only
Way-oil film squeeze 0.0001–0.0003 in (2.5–7.5 µm) transient No
Screw elongation / compression reversal 0.0002–0.001 in (5–25 µm) along length No – position dependent
Thermal drift of saddle / spindle 0.0001–0.0005 in / °C No – requires compensation table

Two practical observations follow from this table. First, the control can only correct the items that move predictably with the motor; bearing, slide, oil film, and thermal drift produce position error that the servo loop has to chase, which is one of the chief causes of small ±1 count oscillation after a move completes. Second, the magnitude of the correction varies along the length of the leadscrew because the screw itself stretches and compresses differently at different spans; the user-set backlash value is therefore always an approximation averaged over the working stroke.

Servo Loop, Dead Band, and the "Hunting" Question

Modern AC brushless servos run current loops at 8–16 kHz, position/velocity loops at 1–4 kHz, and on the lowest-cost integrated drives the inner current loop still updates at 12–500 kHz. With those loop rates a correctly tuned axis settles from a step command to within ±1 encoder count in roughly 0.5 s without oscillation. The control almost always adds a small position dead band (sometimes called the in-position window or settle band) around the commanded point so that the servo amplifier stops switching the power stage when the following error is small enough to be invisible to the cut.

If the position is disturbed by a force larger than the dead band – for example a 2-inch twist drill entering the part, an endmill taking a heavy slot, or a parting tool with a chip jam – the servo is forced to recover the lost counts and will appear to "hunt" until the cutter clears the disturbance. On a drive diagnostic screen this shows up as a following error trace that bounces back and forth across zero before decaying. The motion is real; it is not a measurement artefact of the DRO.

Symptom on machine Symptom on drive display Likely root cause
DRO rock-stable, indicator reads ±0.0002 in oscillation after a move Following error ±1 count, decays in <500 ms Normal – dead band interaction with encoder resolution
DRO stable, indicator reads ±0.0005 in for several seconds Following error > 5 counts, slow decay Mechanical lash disturbed by cutting force; backlash comp value too small
DRO stable, indicator shows drift of 0.0002 in over 10 s Following error drifts, then settles Way-oil film squeeze-out between cast sections
DRO chatters ±1 count forever Sustained oscillation at loop frequency Loop gain too high or friction compensation excessive
DRO shows no motion, axis visibly drifts Following error ramps then snaps back Stiction in slides or stick-slip in nut

Two Schools of Backlash Compensation: Immediate vs. Emulated

The original Prototrak LX3 control (and most 1980s-era CNC controls running on 386/486-class processors) applied the backlash correction as a fast additional move the moment the commanded velocity crossed zero. With the handwheel MPG turned in either direction the servo would jump the lash distance in a few milliseconds, so the carriage moved in lockstep with the handwheel from the first detent.

The successor Prototrak SLX control changes that behaviour: the servo now emulates a manual machine. The motor follows the handwheel at handwheel speed, the DRO does not change until an amount equal to the lash comp value has been wound out, and then the DRO begins to count. If the lash comp value matches the true mechanical lash, the DRO is mathematically correct at all times, but the operator must rotate the MPG an extra fraction of a turn before any axis motion is registered. Fine manual adjustments become noticeably more difficult.

The two strategies are summarised below.

Aspect Immediate application (LX3 style) Emulated manual (SLX style)
MPG feel on reversal Axis jumps the lash distance at near-rapid speed Axis tracks handwheel 1:1, no jump
DRO accuracy at all times Accurate only after the jump completes Accurate at every intermediate position
Operator fine-adjust effort Low – one detent moves the axis High – must wind through the lash each direction
Circular interpolation near 0/90/180/270° Clean – correction is applied before cut Flat spots possible if correction is delayed
Audible signature "Clunk" on reversal if lash is large Smooth, indistinguishable from a manual lathe
CPU load at reversal Single fast trajectory segment Continuous small move at handwheel rate

For purely manual operation either method can be defended; the emulated style is mathematically cleaner because the DRO never lies, while the immediate style is operationally faster. For programmatic operation – G-code moves, circular interpolation, threading passes – the control must apply the correction before the cut engages, otherwise the segment of the curve that crosses the reversal point will be cut flat by the amount of the uncorrected lash. That requirement forces the immediate-application behaviour regardless of what the MPG does in manual mode.

Mechanical Preload vs. Electronic Compensation

Electronic backlash compensation is the cheap and universal answer but it cannot eliminate the mechanical lash. For a true zero-backlash axis the preload must exceed the maximum disturbing force the cutting tool can apply; only then is the nut never separated from the screw. Three common mechanical solutions, in order of increasing cost and decreasing compliance, are listed in the table below.

Method Approximate cost Backlash remaining Compliance / stiffness
Wave-washer between two nuts on a common sleeve $2 in parts 0 if preload > cutting force High – wave washer is a soft spring
Dual adjustable nuts (one LH, one RH) locked against each other $50 in parts + machining 0 if preload > cutting force Medium – depends on torque
Ground-ball preloaded single nut (DIN 65 051 / ISO 15 787) $300–$2 000 <1 µm by spec Very high
Linear roller guide with preloaded truck (THK HSR, HIWIN HGH) $500–$3 000 per truck 0 by design Very high
Linear motor (no mechanical transmission) $5 000–$20 000 per axis 0 by design Highest – but new tuning issues

A wave-washer preloaded nut must be dimensioned so that the spring force of the washer at the assembled height exceeds the maximum axial cutting force. A typical calculation is shown below.

F_preload ≥ F_cut_max + F_chip_load + F_accel

For a 20 mm diameter leadscrew supporting a 500 kg saddle, a Belleville stack delivering roughly 500 kgf of preload gives zero lash up to a 500 kgf disturbing load and a measurable compliance below that load. The trade-off is that the wave washer itself is a spring in series with the screw, which lowers the mechanical resonance frequency of the axis. A loop tuned for a stiff single-nut screw will be unstable against a wave-washer-preloaded screw unless the velocity-loop gain is reduced proportionally to the loss of stiffness.

Glass Scales and the Open-Loop Compensation Question

A linear glass scale mounted to the saddle removes most of the value of software backlash compensation because the position feedback now comes from the part, not from the motor encoder. The control knows the true table position; when the table is shoved by a cutting force the position-loop error becomes non-zero and the servo immediately drives the motor until the error returns to zero. Any mechanical lash in the screw-to-motor chain is then taken up by the motor under closed-loop control, exactly the same way it is taken up by hand on a manual machine.

This is why precision grinding machines, jig borers, and most late-model high-end CNC mills ship with glass or magnetic linear scales on at least the X and Y axes. Approximately 1–2% of mid-volume CNC lathes and mills ship with linear scales today; on the remaining 98% the control must rely on a rotary motor encoder and a software backlash value.

A linear scale does not eliminate the mechanical lash. It does move the burden of compensating for the lash from a feed-forward parameter into the closed-loop servo. The two approaches can be combined: a preloaded screw plus a linear scale gives the stiffest possible mechanical response with the most accurate position feedback.

Tuning Procedure for Backlash Compensation

Use the procedure below to set the backlash compensation parameter on a three-axis mill or lathe. The procedure assumes the axis is mechanically sound (no binding, no worn nut) and the servo loop is already tuned for stable response to a step command.

  1. Warm the machine. Run a warm-up program that traverses each axis end-to-end for 15–20 minutes so that the way oil is distributed and the screw temperature has stabilised. Cold readings underestimate backlash by 10–30%.
  2. Mount a test indicator. Attach a 0.00005 in (1.25 µm) or 0.0001 in (2.5 µm) graduated dial indicator to the spindle or a fixed bracket, with the plunger riding on a precision surface attached to the moving axis. A granite square on the table referenced to the spindle is the classical setup.
  3. Measure the raw lash. Turn backlash compensation OFF in the control. From a position 1 in (25 mm) away from the indicator target, command +0.010 in (0.25 mm) and then −0.010 in (0.25 mm) using a known-clean G01 move at 1–2 in/min (25–50 mm/min). The indicator will return a different number than the commanded distance; the difference is the raw mechanical lash for that axis at that location.
  4. Repeat at five locations. Measure at five points along the full travel (10%, 30%, 50%, 70%, 90% of stroke). On leadscrew-driven axes the lash is usually largest in the middle of the stroke and smallest at the ends, because the screw flexes more when supported at both extremes than when clamped near one end. Average the readings to obtain the working backlash value.
  5. Enter the average. Set the backlash compensation parameter to the average value from step 4. For Fanuc the parameter is parameter 1851 (X), 1852 (Y), 1853 (Z) on most 0i / 30i controls; for Siemens SINUMERIK 840D sl the compensation is MD 38050 $MA_LASH_COMP and MD 38060 $MA_LASH_COMP_VELO. For a Prototrak control it is the BACKLASH value in the Setup → Axis screen.
  6. Verify by repeat command. Repeat the +0.010 / −0.010 command. The indicator should now read within ±1 encoder count of the commanded move in both directions.
  7. Verify by circular interpolation. Run a test program that cuts a 1.000 in (25.4 mm) diameter circle in air (no cutter contact, or with a very light finishing pass). Measure the diameter in two perpendicular directions with the indicator. The difference between the two readings is the residual bidirectional error; an ideal axis shows zero, an acceptable axis shows less than 0.0003 in (7.5 µm) for a milling machine and less than 0.0005 in (12.5 µm) for a lathe.
  8. Check at reversal points in curves. For a lathe, program a G02/G03 arc that crosses the 0/90/180/270° quadrants and inspect the surface with a magnifying loupe. A flat spot at the quadrant crossing indicates either that the backlash value is too small or that the immediate-application behaviour described above has been disabled.

Circular Interpolation Error Budget

A CNC circular move consists of many small linear segments produced by the interpolator. At each segment boundary the direction changes by a small angle, not by 180°, so the absolute backlash is not exercised – but the differential backlash between the two axes is. The maximum radial error at any quadrant of a circle of radius R commanded with a backlash value b (assumed identical on both axes) is approximated by:

e_radial ≈ b · (1 - cos(Δθ/2))

where Δθ is the angle between two adjacent linear segments. For a typical 1 kHz interpolator running a 10 ipm (250 mm/min) feed on a 1 in (25.4 mm) radius circle, Δθ is roughly 0.057° and the radial error from backlash alone is in the micro-inch range. For a slow feed on a large radius the error grows. Field data on machines in the $2 M class regularly show 0.0004 in (10 µm) of residual backlash and 0.0005 in (12.5 µm) of out-of-round on a circular interpolation when the compensation is mis-tuned by 25–50%.

Hydraulic and Way-Oil Transient Effects

Heavy machines often use hydraulic counterbalance on the Z axis to reduce the load on the leadscrew. The hydraulic system is itself a spring-mass-damper and can oscillate at 0.5–5 Hz, producing a slow positional drift that mimics backlash but is not correctable by a fixed lash parameter. Likewise, the way-oil film between two cast iron sections can take 5–30 seconds to redistribute after a directional change; the indicator will show a 0.0001–0.0003 in (2.5–7.5 µm) drift over that window. The original Deckel Dialog control worked around this by commanding the lube pump to run only when a rapid was issued, so that the oil film was pressurised exactly when the slide needed to move.

On modern controls with a backlash parameter, the practical answer is to wait 10–30 seconds after any aggressive move before taking a precision measurement. Adjusting the backlash value to chase the drift makes the parameter useless for the static reversal case.

Troubleshooting Matrix

Observed problem Likely cause Action
Flat spots at quadrant crossings on a circle Backlash comp disabled in interpolation, or value too small Enable comp on the affected axis; raise value by 25% and re-test
Position error of 0.0003 in at reversal, indicator confirms Comp value too low, or wear has increased lash since last calibration Re-measure lash per step 3 above; update parameter
Comp value must be set very large (e.g. >0.005 in) to get indicator agreement Mechanical wear in nut or coupling Inspect nut, preload bearings, replace if necessary
Position oscillates by ±1 count forever Loop gain too high, or friction comp too aggressive Reduce Kv by 10–20%; disable friction comp temporarily
Axis visibly moves when tool enters cut, then recovers Disturbance force exceeds preload Reduce depth of cut, increase preload, or add linear scale
DRO matches commanded move but part shows flat on reversal Compensation is post-move, not pre-move Use a control that applies comp before interpolation; see control vendor doc
Compensation "clunks" audibly on MPG reversal Immediate-application behaviour with large lash value Acceptable; reduce lash value mechanically, not in software
Different lash value at different points along stroke Screw flex / temperature gradient Use average value; document for traceability

Specifications and Parameter Mapping

Control Backlash parameter Velocity limit parameter Notes
Fanuc 0i / 30i / 31i P1851 (X), P1852 (Y), P1853 (Z), P1854 (4th) P1855 (max comp feedrate) Comp applied as ramped move; feedrate limited by parameter
Siemens SINUMERIK 840D sl MD38050 $MA_LASH_COMP (mm) MD38060 $MA_LASH_COMP_VELO (mm/min) Comp applied before interpolation; see S7-1500 backlash doc for PLC implementation
Siemens S7-1500 / S7-1200 (PLCopen) FB "LAYC" (Lay compensation) tags Velocity tag Function block per Siemens application doc
Prototrak LX3 Setup → Axis → Backlash Fixed at rapid rate Immediate application on reversal
Prototrak SLX Setup → Axis → Backlash Tracks MPG rate Emulated-manual application
Mitsubishi M80 / M800 #2210 (X), #2211 (Y), #2212 (Z) #2213 (compensation feedrate) Compensates in pre-interpolation

FAQ

What is the difference between backlash compensation applied immediately and the emulated-manual style on Prototrak LX3 versus SLX?

The LX3 applies the lash value as a fast trajectory segment the instant the commanded velocity reverses, so the carriage jumps the lash distance in milliseconds. The SLX emulates a manual machine: the motor follows the handwheel 1:1 and the DRO stays frozen until the handwheel has wound out an amount equal to the lash comp value, after which the DRO begins to count. The LX3 style is faster for fine manual adjustments; the SLX style keeps the DRO mathematically correct at every intermediate position.

Can backlash compensation eliminate mechanical lash?

No. Backlash compensation is a software offset on the position command that corrects the DRO and the internal position counter. The mechanical lash in the nut, screw, belt, and couplings remains. When a cutting force exceeds the preload of the nut, the axis will physically move by the lash amount before the servo restores position. Mechanical preload, a linear scale, or a linear motor is required to remove the lash physically.

How do I measure backlash correctly before entering the compensation value?

Warm the machine for 15–20 minutes, mount a 0.00005 in (1.25 µm) dial indicator on a fixed reference against a precision surface on the moving axis, command +0.010 in and then −0.010 in at 1–2 ipm (25–50 mm/min) with compensation OFF, and read the indicator. Repeat at five points along the stroke and use the average as the compensation value. The procedure is detailed in the tuning section above.

Why does my circle interpolation show a flat spot at the quadrant crossings?

The control is applying the backlash correction after the segment that crosses the reversal direction rather than before it, so the cut engages before the correction is in place. Enable backlash compensation in the interpolation block, raise the value by 25%, and re-test. On Fanuc, Mitsubishi, and Siemens controls the compensation is normally applied pre-interpolation; if a flat spot still appears the parameter may have been disabled in the setup screen.

Why does the indicator show a slow drift of 0.0002 in over ten seconds after a move?

This is way-oil redistribution between cast iron sections, hydraulic counterbalance oscillation, or thermal expansion of the leadscrew. It is not backlash and cannot be corrected by the backlash parameter. The practical answer is to wait 10–30 seconds after any aggressive move before taking a precision measurement, and to make sure the lube pump has primed before the measurement.

Back to blog