Comparison
Lathe Electronic Gearing: PLC Pulse Output vs Divider
Short answer
Gear a lathe leadscrew to the spindle with a drive-side numerator/denominator divider for multi-pass threading: it holds the ratio exact per count and works in both rotation directions. The PLC path — measure spindle encoder frequency, output a scaled pulse frequency — is adequate for feed-per-rev crossfeed and single-pass threads, where a 1 Hz output quantum costs about 0.16% pitch error at the example's 317.5 Hz.

On this page
- What the ratio must hold on a lathe
- Why the servo encoder never reaches the PLC
- The PLC frequency-tracking path
- The hardware divider path in the drive
- Side-by-side: where each path wins
- Example: commanding 32 TPI at 400 rpm on a 1 mm baseline
- Commissioning without a tenfold surprise
- The decision for each job
- Questions asked
Geared right, an electronic lathe leadscrew tracks the spindle exactly as the change-gear train did, and there are two ways to hold that ratio. A PLC can measure the spindle encoder frequency and output a scaled pulse frequency to the drive; that path is accurate enough for feed-per-rev crossfeed and single-pass threads, with a rounding error equal to output quantum divided by commanded frequency — about 0.16% in the worked example below. A hardware numerator/denominator divider that turns the spindle encoder into quadrature counts inside the drive holds the ratio exact per count, in both rotation directions, with the PLC scan out of the loop; that is the path for multi-pass threading in one groove. This comparison shows what each path holds, where it breaks, and the scaling trap that made the PLC path run ten times slow on its first try.
What the ratio must hold on a lathe #
Mechanical gearing enforced one rule: carriage advance per spindle revolution equals the thread pitch, on every revolution, at every speed. Electronic gearing keeps that rule with an encoder on the spindle and a motor on the leadscrew doing the change-gear train's job.
The machine behind the numbers here runs a 2 mm leadscrew through a 2:1 belt reduction, so one servo revolution moves the carriage 1 mm. At that baseline, a thread at the nominal pitch needs the servo turning exactly with the spindle, and every other pitch becomes a multiplication applied on top of it. That makes the pulley ratio part of the gearing itself: if the conversion replaces the change gears with a belt, match the timing pulleys to the same 2:1 ratio, or the baseline shifts and every pitch calculation inherits the error.
Why the servo encoder never reaches the PLC #
A 16-bit encoder in an integrated servo drive means 65,536 counts per revolution if the rating is counts after quadrature decoding — the manual of the exact drive settles lines versus counts. Spun at 1000 rpm, that loop carries 65,536 × 1000 ÷ 60 ≈ 1,092,267 Hz, and in the drive used for this build the encoder closes the internal current and velocity loops only, with no encoder output option. The rate never leaves the drive, and nothing in this gearing needs it to.
What the controller actually handles are two far slower streams: the spindle encoder into a hardware high-speed counter, and one pulse or frequency command out to the drive. Keep the input on a dedicated counter, not an ordinary scanned input — configuring a high-speed counter for an encoder input on a compact PLC is the kind of setup involved — and apply the discipline in counting encoder pulses on a PLC without losing position so the spindle count stays honest. Size both streams from datasheets: the counter's maximum input frequency against encoder PPR times top spindle speed, and the pulse output's maximum against the highest commanded frequency.
The PLC frequency-tracking path #
The high-speed counter measures spindle frequency every scan, a scaling or linearization function multiplies it by target pitch over baseline pitch, and a PWM or frequency output feeds the drive's pulse input, whose programmable steps-per-revolution value absorbs the mechanical constants. The pitch table and the threads-per-inch conversion live in the logic, which is this path's real strength: changing pitch is editing a number.
On the build behind this article, single-pass test threads at the baseline pitch and at the example's pitch both came out pitch-correct, which earns the path feed-per-rev crossfeed and single-pass threading. Its three limits are structural. Sampling: the ratio updates once per scan, so changing spindle speed mid-thread perturbs the pitch until the speed settles — finish a thread at one speed. Rounding: when the ideal command is not a whole multiple of the output quantum, the output rounds, and the error is quantum divided by commanded frequency; the example below sizes it. Angular reference: nothing ties servo angle to spindle angle, so pass two cannot find the groove it cut. The command-frequency arithmetic itself is ordinary pulse scaling — the same conversion worked through in how to calculate step and direction servo pulse scaling, aimed at a spindle-synchronous target instead of a fixed feed.
The hardware divider path in the drive #
Wire the spindle encoder directly to the drive's quadrature input and let the drive gear internally: input counts multiplied by a numerator-over-denominator fraction equal output counts. Vendors document the pairing as the electronic gear ratio — Siemens publishes the calculation for the SINAMICS V90, and Delta drives carry the numerator in parameter P1-44 with a paired denominator parameter — so this is standard drive firmware, not a special order. The controller's whole job shrinks to writing two integers from the pitch table.
Because the ratio is enforced per count, steady-state error is bounded by a single input count rather than by an output quantum. The same fraction holds in both rotation directions without software sign handling, and the controller scan sits outside the ratio path entirely. That is what multi-pass threading needs: every pass lands in the same helix because the axis is locked to spindle counts, not to a sampled frequency. Entry still needs a once-per-rev reference — capture the spindle index and correct onto it, the pattern set out in setting up servo electronic gearing with registration correction.
Side-by-side: where each path wins #
Both paths gear the same axis; they differ in where the ratio lives and what can corrupt it.
| Decision point | PLC frequency-tracking output | Drive-side N/D divider |
|---|---|---|
| Where the ratio lives | Scaling math, recomputed every PLC scan | Drive firmware fraction, applied per count |
| Steady-state error source | Output quantum ÷ commanded frequency | Bounded by one input count |
| Spindle direction reversal | Software carries the sign through the scaling | Same fraction holds both directions |
| Spindle speed change mid-pass | Sampling lag perturbs pitch until speed settles | None while counts keep flowing |
| Multi-pass thread re-entry | No angular lock; entry drifts | Locked to spindle counts; index pulse for entry |
| Controller workload | Counter input, scaling math and pulse output each scan | Writes two integers from the pitch table |
| Natural duty | Feed-per-rev crossfeed, single-pass threads | Multi-pass threading, spindle-synchronous cuts |
Example: commanding 32 TPI at 400 rpm on a 1 mm baseline #
Inputs #
Machine: the 2 mm leadscrew under its 2:1 belt reduction, one servo revolution per 1 mm of carriage travel, servo speed equal to spindle speed at the baseline pitch. Spindle: 400 rpm, carrying a 60 PPR encoder, so the counter input sees 400 rev/min ÷ 60 s/min × 60 pulses/rev = 400 Hz. Target thread: 32 TPI, which is 25.4 mm ÷ 32 = 0.79375 mm per spindle revolution. Output: a PWM frequency output resolving 1 Hz — an illustrative quantum; take the real figure from the controller's output specification. Drive: steps-per-revolution set to 60, so one spindle pulse maps to one command pulse at the baseline, and each command pulse advances the carriage one sixtieth of it, 0.0167 mm.
The rule #
At the baseline pitch, command frequency equals measured spindle frequency. For any other pitch, scale it: commanded frequency = spindle frequency × target pitch ÷ baseline pitch. Rounding lands the output within half a quantum of the ideal, so pitch error = half the quantum ÷ commanded frequency.
The arithmetic #
Commanded frequency = 400 Hz × 0.79375 ÷ 1 = 317.5 Hz. A 1 Hz quantum forces 317 or 318 Hz; the worst case is 0.5 Hz ÷ 317.5 Hz = 0.00157, about 0.16%. Over a 25 mm thread that drifts the flank 25 mm × 0.00157 = 0.039 mm — call it 0.04 mm.
Result and decision #
Result: 317.5 Hz commanded, worst-case rounding error about 0.16%, roughly 0.04 mm of flank drift over the cut. Decision: that budget is acceptable for feed-per-rev crossfeed and for cutting a thread in a single pass; it is not acceptable for pass two, because re-entry cares about angular position and this path carries none. To buy margin inside the PLC path, raise the drive's steps-per-revolution: a setting ten times larger commands 3175 Hz for the same carriage speed, and half a hertz becomes 0.016% — until the pulse output or the drive's pulse input reaches its rating, a ceiling that is real, as why a closed loop stepper will not move above 200 kHz shows. When the job re-enters the groove, stop scaling frequencies and divide counts instead.
Commissioning without a tenfold surprise #
The build behind this article hit the classic scaling trap, and the detail is worth keeping. The register holding the measured spindle frequency and the register driving the command output both showed 4000 at 400 rpm, with an inferred decimal making the display read 400.0 rpm. Computing steps-per-revolution as frequency × 60 ÷ rpm from the register gave 4000 × 60 ÷ 400 = 600, and the servo ran at a tenth of commanded speed. Recomputing from the true measured rate gave 60 steps per revolution, which tracked the spindle exactly — the register had been carrying a ×10 display scale all along.
The fix is procedural. Record the raw register and the displayed value side by side, and establish the scaling factor before any arithmetic touches the register. Confirm the true output rate with a frequency counter or scope before the first cut. Then verify the gearing with single-pass test threads at the baseline pitch and at the example's pitch, measuring over many threads so gauge error averages out.
One safety note: on the first powered pass, keep the carriage clear of the chuck and any shoulder and be ready to open the half-nut — a gearing factor that is wrong by a multiple drives the tool into the work faster than any hand feed.
The decision for each job #
Feed-per-rev crossfeed, surfacing, and any spindle-synchronized feed that is not a thread: the PLC path. Its rounding budget is invisible at feed rates, and its sampling lag only matters if the spindle speeds up mid-pass.
Single-pass threads: the PLC path, with the example's arithmetic as the acceptance test — quantum divided by commanded frequency, compared against the pitch class being cut. If the quotient is small, round and cut; buy extra margin with a larger steps-per-revolution setting, inside the pulse ratings.
Multi-pass threading, or any cut that must re-enter the same groove: the drive-side divider. It is the only one of the two that holds the helix per count and in both rotation directions, and it keeps the pitch table in the controller, because the controller writes the numerator and the denominator.
Both duties on one machine: split them — divider for threading, PLC for feeds — or run the divider alone and change pitch by rewriting the fraction. Whichever split you choose, capture the spindle index once per revolution: without it, neither path knows where the thread starts.
Questions asked
Can the leadscrew axis be a stepper instead of a servo?
Yes. A stepper driver and a servo drive in pulse or velocity mode take the same command stream, so the gearing comparison does not change with the motor type. Choose the axis on torque at the leadscrew, on whether the machine needs closed-loop stall recovery, and on the drive's pulse input rating. The ratio accuracy lives in the command path, not in the motor.
Which value feeds the steps-per-revolution formula: the register reading or true hertz?
True hertz. A controller register can carry a display scaling factor — in the commissioning story above it turned a 400 Hz output into a 4000 reading and wrecked the drive setting by the same factor. Establish the scaling first, confirm the output rate with a frequency counter, then apply steps-per-revolution = frequency × 60 ÷ rpm. The register is for display; the counter is for arithmetic.
How can the controller show spindle speed when the drive has no encoder output?
Fit a separate encoder where the display needs it; on the spindle it doubles as the gearing input, because the same high-speed counter reading can feed a speed display as well as the ratio math. Some drives scale their internal encoder down to simple output values for exactly this purpose, and those outputs are display-grade. If such a drive's velocity-mode command also relies on internal scaling, measure the frequency-to-speed relation instead of assuming it.
What spindle encoder resolution does electronic gearing need?
Enough that one pulse is small against the pitch. At the 1 mm baseline in the example, a 60 PPR encoder puts 0.0167 mm of carriage travel on each pulse, one sixtieth of the baseline. Higher PPR tightens threading entry repeatability but raises the frequency at the counter input, so check the counter's maximum input frequency against the encoder PPR at top spindle speed.

