GreatLight CNC Machining Factory logo
CNC Machining
Rapid Prototyping
Materials
Industries
News
About GL

Get Instant Quote

CNC motion control basics

What Is the Function of Encoder in CNC Machine Motion Control?

The function of encoder in CNC machine work is to turn axis and spindle motion into electrical signals the controller can count. This page explains the measurement chain, incremental versus absolute feedback, and where resolution stops helping. Written for engineers and buyers who need to judge whether a machine can hold a drawing tolerance.

Closed-loop vs semi-closedIncremental vs absolute±0.005 mm tolerance127 CNC machines
function of encoder in cnc machine
Key takeaways

What matters before you read the detail

Feedback closes the loopThe encoder reports actual position; the controller corrects the difference from commanded position.
Resolution is not accuracyA fine count per revolution does not remove backlash, thermal growth, or screw error.
Mounting decides the resultMotor-mounted and scale-mounted feedback measure different things and drift differently.
Absolute saves setup timeNo homing move after power-up, which helps on tall parts and multi-setup work.
The measurement chain

How the function of encoder in CNC machine feedback actually works

An encoder is a sensor that reports motion as a countable signal. On a CNC machine it is bolted to a servo motor shaft, a ballscrew end, or a linear glass scale. A disc with fine lines passes an optical or magnetic read head. Each line produces a pulse, and the controller counts pulses to know how far the axis has traveled.

That count alone is not enough. The controller also needs direction, so most encoders output two channels in quadrature, usually called A and B. When A leads B, the axis moves one way; when B leads A, it moves the other. A third channel, Z or index, gives one pulse per revolution so the control can tie the count to a known reference.

The loop works like this. The controller sends a velocity command to the drive. The drive turns the motor. The encoder measures what actually happened. The drive subtracts measured position from commanded position and adjusts current to the motor. This correction runs thousands of times per second, which is why the axis feels stiff rather than loose.

For spindle feedback the logic is the same but the interest shifts. The controller needs to know spindle speed for feed-per-tooth calculations and orientation for tool changes. Some spindles also use the encoder for rigid tapping, where spindle rotation and Z-axis feed must stay in a fixed ratio. If that ratio slips, threads tear.

Two families

Incremental and absolute encoders behave differently on the floor

An incremental encoder reports change, not position. It counts up and down from wherever it started. After power-up the control does not know where the axis is, so it runs a homing sequence until it hits a reference switch or index pulse. Every machine operator has watched this slow move, and every crash during homing comes from this step.

An absolute encoder reports a unique position for every shaft angle. It knows where it is the moment power returns. No homing move, no lost count after a power dip. On a 4,000 mm gantry with a tall fixture, that saves setup time and removes one failure mode. The trade is cost and a slightly more involved battery or multi-turn backup.

There is a third arrangement worth knowing. Some machines use a linear scale mounted on the machine structure rather than the motor. The scale measures the table itself, so it sees ballscrew pitch error, thermal growth of the screw, and backlash. Motor-mounted feedback cannot see any of that because it measures the screw, not the part.

Which one a shop picks depends on the part. For general milling and turning to ±0.005 mm, motor-mounted feedback with a good screw and temperature control is usually enough. For long axes, high-accuracy boring, or parts where thermal drift matters more than cost, linear scales earn their keep.

  • 1
    IncrementalLowest cost per count, needs homing after power-up, vulnerable to lost pulses.
  • 2
    AbsolutePosition known at power-up, no homing move, better for multi-setup work.
  • 3
    Linear scaleMeasures the table, catches screw and thermal error, higher install cost.
Signals and counts

What the count means: resolution, quadrature, and interpolation

Resolution is the smallest motion the encoder can report. A 2,500 line encoder with quadrature counting gives 10,000 counts per revolution. Mount that on a 10 mm pitch screw and one count equals 0.001 mm of table travel. That sounds generous until you remember the control also interpolates between counts, which smooths motion but does not create real accuracy.

Interpolation is where a lot of confusion lives. A read head on a glass scale may output a sine and cosine signal, and the drive divides each period into many sub-counts. The number on the datasheet can be 0.1 μm or finer. The machine still only holds what the structure, screw, and temperature allow. A fine number on paper does not bend metal more accurately.

Signal quality matters more than count. Shielded cable, a clean ground, and separation from spindle and drive power lines keep the pulses readable. A noisy signal causes the drive to chase phantom position error, which shows up as a rough surface or a faint growl at low feed. Chasing that with a new encoder rarely helps if the cable routing is the real problem.

For rotary axes, the same logic applies to the table. A Ø400 mm rotary table with a direct encoder can index to a few arc-seconds. If the worm gear has backlash, the encoder on the table will see it, and the control may oscillate unless the backlash is compensated or the preload is set correctly.

Where it shows up in the cut

How encoder feedback affects surface finish and 5-axis motion

Feed rate is not constant in real cutting. When a tool enters a corner, the load rises and the axis slows. The encoder reports the slowdown, and the control adjusts to keep the commanded path. Without that feedback, corners would round or overshoot depending on the load. This is why a closed loop holds a corner better than an open-loop stepper system.

On simultaneous 5-axis work, two rotary axes and three linear axes move at once. Each axis has its own loop, and all five must stay in sync. If one rotary encoder lags, the tool tip drifts off the intended path by an amount that grows with tool length. Short tools hide the error; long tools expose it.

Surface finish follows the same thread. A stable loop with clean feedback gives a consistent Ra 0.8–1.6 μm on a well-supported cut. A loop that hunts, or a scale with a dirty read head, leaves periodic marks that match the screw pitch or the encoder revolution. Those marks are a feedback signature, not a tool problem.

Thermal drift is the slow version of the same story. As the ballscrew warms, it grows a few micrometres over a long run. Motor-mounted feedback does not see this, so the part moves without the control knowing. A linear scale sees it and compensates. On a long boring operation, that difference is often the whole tolerance.

Limits and failure modes

When the encoder is not the limiting factor

It is tempting to blame the encoder for every accuracy problem. Often it is the wrong suspect. Backlash in the screw, a loose thrust bearing, a flexing fixture, or a warm spindle will all move the part without the encoder reporting anything unusual. The loop is working; the machine structure is not.

Contamination is a real failure mode. Oil mist and fine chips on a glass scale cause dropouts. The control may alarm, or worse, it may not alarm and simply run with a wrong count. On a machine cutting aluminium with flood coolant, scale covers and positive air purge are not optional accessories.

Electrical noise is the other common one. A drive cable routed next to an encoder cable induces error. The symptom is often intermittent and load-dependent, which makes it hard to reproduce. If surface finish degrades only during heavy cuts, check cable separation before ordering a replacement read head.

Mechanical coupling also matters. A flexible coupling that is too soft allows wind-up between motor and screw. The encoder on the motor sees the motor turn, but the screw lags. The control thinks it has arrived. A stiffer coupling, or feedback moved to the screw end, fixes it.

Selection guide

Feedback options compared for common CNC work

Pick based on the error source you need to see, not on the count number.

Feedback typeWhat it measuresBest forLimits
Incremental, motor-mountedMotor shaft rotationGeneral milling and turningNeeds homing; blind to screw error
Absolute, motor-mountedMotor shaft angle, uniqueMulti-setup, tall partsHigher cost; backup needed
Incremental, linear scaleTable position directlyLong axes, tight boresSensitive to chips and oil
Absolute, linear scaleTable position, uniqueHigh-accuracy boringHighest cost; careful mounting
Rotary table encoderTable angle directly5-axis indexing and contouringBacklash must be preloaded

The trade you are actually making

If the error source is screw growth or backlash, choose linear scale feedback. If the error source is setup time and lost position after power-up, choose absolute feedback. Do not buy resolution you cannot mechanically hold.

FAQs

Questions engineers ask next

Does a higher count encoder improve part accuracy?

Only up to the point where the rest of the machine can follow. A finer count gives smoother motion and less quantization noise, which helps surface finish at low feed.

Past that, accuracy is set by screw pitch error, thermal growth, backlash, and structural stiffness. A 0.1 μm count on a machine with 10 μm of screw error still cuts to 10 μm.

Why does my machine need to home after every power-up?

That is the signature of incremental feedback. The control has no idea where the axis is, so it drives to a reference switch or index pulse to establish a zero.

Absolute feedback removes the move. If homing is eating setup time on tall or heavy parts, that is the upgrade path to discuss.

Can encoder feedback cause chatter or a rough finish?

Yes, but usually through tuning rather than the encoder itself. A loop gain set too high makes the axis oscillate, which leaves periodic marks.

Check the drive tuning and the mechanical coupling first. If the marks match one encoder revolution or the screw pitch, look at the feedback path and cable shielding.

Do all CNC machines use encoders?

Most production CNC machines do, because closed-loop control is how they hold tolerance under varying load.

Simple open-loop stepper machines exist for light duty and low cost, but they cannot detect a lost step, so they are a poor fit for tight tolerances or hard materials.

How does feedback affect 5-axis tool tip position?

Each of the five axes has its own loop, and the control combines them to place the tool tip. A small angular error on a rotary axis becomes a linear error at the tip that grows with tool length.

This is why long tools on 5-axis work are less forgiving, and why rotary backlash and encoder alignment matter more than on a 3-axis cut.

What maintenance keeps feedback reliable?

Keep scale covers and air purge working, keep read heads clean, and check coupling tightness on a schedule. Inspect cable routing when a drive is replaced.

If a machine starts leaving marks that match one revolution, log the symptom and the axis before changing parts. The pattern usually points to the source.

Send a drawing, get a manufacturability read

We review tolerance stack-up, material, and feedback-relevant features before quoting, so the process matches what your drawing actually needs.

12-hour quote100% inspection±0.005 mm toleranceNo minimum order quantity

Follow GreatLight

More CNC process notes

We publish setup notes, tooling trials and inspection data from the factory floor.

FacebookTikTokYouTubeLinkedInInstagramThreadsPinterest

Trusted by engineers and manufacturers worldwide

Tesla Ford Motor Company BYD Auto Denso Magna International Boeing Airbus Medtronic KUKA FANUC