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

Get Instant Quote

Motion Control Basics

Function and importance of encoder in CNC machine tools

An encoder turns axis motion into an electrical signal the control can count. This page explains how that signal closes the loop, where resolution limits show up in the part, and when the encoder is not the problem. Written for engineers and buyers who specify machined parts.

Position feedbackClosed-loop controlResolution vs accuracyFault diagnosis
Encoder in CNC machine tools: key function of position feedback
Mechanism

What an encoder does inside a CNC machine tool

An encoder is a sensor that converts mechanical position or movement into an electrical signal. On a CNC machine tool it sits on the motor shaft or on the axis itself and reports where the axis is right now. The control compares that number with the commanded position and adjusts the drive output until the error falls inside the allowed window. That comparison runs thousands of times per second.

Two things come out of the signal: position and direction. Both matter. Direction tells the system whether the axis is moving toward or away from the target, which sets the sign of the correction. Without direction, a control cannot tell a 0.01 mm overshoot from a 0.01 mm undershoot.

The loop closes in the drive, not in the operator's head. A servo drive reads the encoder, subtracts the feedback value from the command, and pushes current into the motor in proportion to that error. Gains decide how hard it pushes. Too much gain and the axis hums or rings. Too little and it lags behind the toolpath on every corner.

Glass scales and motor-mounted encoders answer different questions. A motor encoder sees rotor angle, so it includes backlash, screw pitch error and thermal growth of the ball screw in the number it reports. A linear scale measures the table itself and removes most of that stack. That is why a machine with linear scales holds size better during a long warm-up run.

Signal types

Incremental, absolute and how the count is built

An incremental encoder emits pulses as the shaft turns. Electronics count the pulses and multiply by the distance per pulse to get position. On power-up the count starts at zero, so the machine must move to a reference switch or index mark before it knows where it is. That is the homing routine you see at the start of every shift.

An absolute encoder reports a unique code for every shaft position, so the control knows the axis location the moment power comes on. No homing move is needed. Multi-turn versions also track how many full revolutions have passed, which matters on a rotary table or a tool changer that spins many times.

Quadrature output is the common industrial format for incremental units. Two channels, A and B, sit 90 electrical degrees apart, and the order in which they switch tells the direction. A third channel, Z or index, gives one pulse per revolution for a reference point.

Resolution is not the same as accuracy. A 20-bit encoder divides one revolution into about 1,048,576 counts, yet the axis may still be off by 5 μm because of screw error. Counting finer only helps if the mechanical stack can hold that fineness under load.

Types

Rotary and linear encoders in CNC machine tools

Rotary encoders mount on the motor or the screw end. They are compact, sealed, and cheap to replace. Most 3-axis mills and lathes run this way. Their weak point is that everything between the encoder and the workpiece sits inside the measurement: coupling wind-up, thrust bearing play, screw stretch under load.

Linear encoders mount on the slide and read a scale fixed to the machine base. The table position is measured directly, so thermal drift of the screw drops out of the loop. Machines that hold ±0.005 mm over a long run usually need them. The trade-off is cost, mounting space, and a scale that must be protected from chips and coolant.

Ring encoders on a rotary table do the same job in rotation. On a Ø400 mm rotary table, an angle error of 5 arc-seconds is roughly 0.005 mm at the edge of the table. If the part features sit near the rim, that error is real and shows up in the inspection report.

Magnetic encoders are another option. They resist dust and moisture better than optical units but usually offer lower resolution. For a 3-axis machine cutting to ±0.05 mm, a magnetic unit is often enough. For grinding or jig boring, it is not.

Error budget

Where encoder error fits in the total error budget

Axis error comes from several sources stacked together: encoder resolution, screw pitch error, thermal growth, servo following error, and structural deflection under cutting force. The encoder is only one line in that list, and often not the largest.

A ball screw with a 10 mm pitch and a 2,500-line encoder in 4× quadrature gives 10,000 counts per revolution, or about 0.001 mm per count. That sounds better than the machine can hold. Real accuracy is set by pitch compensation tables, bearing preload and how warm the machine is.

Thermal growth is the quiet one. A 1,000 mm steel screw grows about 0.012 mm per °C. Ten degrees of warm-up moves the axis 0.12 mm. A motor encoder never sees this. A linear scale does, and the control corrects for it automatically.

Following error is the gap between commanded and actual position while the axis is moving. It grows with feed rate and drops with higher gain and stiffer mechanics. On a finishing pass at 200 mm/min the gap is small. On a roughing pass at 5,000 mm/min it can reach tenths of a millimeter, and the control has to slow into corners to keep it in check.

Limits

Fitting a higher-count encoder rarely fixes a size problem on its own. If the machine cannot hold ±0.02 mm and the fault is ball screw backlash or a worn thrust bearing, a finer scale just reports the same error more precisely. Measure first, then buy.

Backlash shows up as a step in the part when the axis reverses. Cut a square pocket and measure the wall positions on the two sides. A difference of 0.03 mm on the Y walls points to backlash, not to the encoder.

Vibration and surface finish problems usually come from servo tuning, tool runout or workholding. Chattered walls at 1,200 Hz are structural. An encoder fault produces different symptoms: position alarms, following-error trips, or a single axis that drifts when the machine is idle.

Temperature matters more than most shops expect. A machine that holds size in January can drift in July. If the parts are small and the tolerance is tight, cut the first article, let the machine run 30 minutes, then cut a second one and compare. The delta tells you how much of the error is thermal.

Selection

Encoder type compared

Pick by what the loop must measure, not by count alone

TypeWhat it measuresBest forWatch out for
Incremental rotaryMotor or screw angleMost 3-axis mills and lathesNeeds homing after power-up
Absolute rotaryShaft angle, multi-turnTool changers, rotary tablesHigher unit cost
Linear scaleTable position directlyTight size over long runsChips, coolant, mounting space
MagneticPosition, non-opticalDusty or wet environmentsLower resolution
Ring encoderRotary table angle4-axis and 5-axis tablesEdge error grows with radius

The short verdict

If the part tolerance is looser than ±0.02 mm and the machine is a standard 3-axis mill, a motor-mounted encoder is enough. If you need ±0.005 mm held over a long run, or the axis moves more than a few hundred millimeters, pay for linear scales and thermal compensation instead of a higher count.

FAQs

Encoder questions engineers ask

Does a higher encoder count always give a more accurate part?

No. Count is resolution, not accuracy. A 20-bit encoder reports position in fine steps, but the axis can still sit 5 μm off because of screw pitch error, thermal growth or bearing play.

Fix the mechanical stack first. Then look at the feedback device.

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

An incremental encoder only reports change, not absolute position. On power-up the count is meaningless, so the control drives each axis to a reference switch or index pulse to set zero.

An absolute encoder removes that step. The control reads the true position the moment power comes on.

Can a failing encoder damage the part?

Yes, but the symptoms are specific. A dirty or intermittent read head can drop counts, and the axis finishes at the wrong place while the control believes it is correct.

Alarms, following-error trips and a single axis that drifts while idle are the usual signs. Stop and check the read head before running production.

Do linear scales work on a machine with coolant flooding?

They can, but the scale needs proper sealing and a mounting position that drains. Compressed-air purging on the scale housing is common.

On a machine cutting with high-pressure coolant, check the scale cover and the drain path before blaming the feedback.

How do I tell encoder error from backlash?

Cut a test feature that reverses direction, such as a square pocket. Measure the two parallel walls.

A step on reversal points to backlash. A repeating offset that grows with machine temperature points to thermal drift, which linear scales correct.

Is an encoder the same thing as a resolver?

No. Both report shaft position, but a resolver is an analog device with two windings and no electronics inside the housing.

Resolvers tolerate heat and vibration well. Encoders give higher resolution and a digital signal the drive can read directly.

Need parts that hold tolerance?

Send your drawings and we will review the tolerances, the machine setup and the feedback requirements before quoting. Quotation and free DFM analysis within 12 hours.

12-hour quote100% inspectionNo minimum order quantity

Follow

More from GreatLight

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