Comparison
Rear-shaft magnetic encoder vs belt-driven encoder on a stepper
Short answer
Mount a rear-shaft magnetic encoder on the stepper whenever the rear shaft is free: it reads the motor directly, and a 12-bit part gives 4096 counts per revolution, four times a 512 ppr encoder through a 2:1 belt. Choose the belt-driven optical encoder only when the rear shaft is unavailable or a second stepper sits close behind the sensor and the measured ripple exceeds your error budget.
On this page
A rear-shaft magnetic encoder is the right default for reading a NEMA14 stepper: it measures the motor shaft itself, a 12-bit part gives 4096 counts per revolution, and nothing mechanical sits between the rotor and the sensor. A belt-driven optical encoder is the fallback, for a blind or occupied rear shaft, or for a second stepper sitting close behind the sensor, where its stray field pollutes the magnetic reading. Below are the counts per motor revolution for both options, the accuracy limits the count number hides, and the test that settles the back-to-back question on your own motors. Whether the added sensor makes the loop closed is a separate question, covered in does an encoder make a stepper motor closed loop.
What each option measures #
| Factor | Rear-shaft magnetic encoder | Belt-driven optical encoder |
|---|---|---|
| Signal path | Magnet on the shaft end, sensor IC facing it across a small air gap | Belt and two pulleys couple the motor to a separate encoder shaft |
| Resolution at the motor shaft | 12-bit part: 4096 counts/rev, directly on the motor | Depends on line count and pulley ratio; 512 ppr through a 2:1 reduction gives 1024 counts per motor rev |
| Mechanical error between motor and sensor | None; the errors are inside the sensor itself | Belt stretch, tooth backlash and pulley eccentricity, plus tension to maintain |
| Stray magnetic fields | Sensitive to the motor's own field and to neighbouring motors | Immune; optics read a disc |
| Hardware to mount | Magnet, sensor board, bracket at the rear cover | Encoder, bracket, two pulleys, belt, tension adjustment |
| Service after commissioning | None once the air gap is set | Belt tension and belt wear |
Counts per motor revolution, with the arithmetic #
This is a calculated example for stated inputs, not a measurement. Inputs: a 1.8-degree motor (200 full steps per revolution; confirm on the motor label), 16x microstepping, a 12-bit magnetic encoder, and a 512 ppr optical encoder behind a 2:1 belt reduction with the encoder turning at half motor speed.
Magnetic path: 2^12 = 4096 counts per revolution, so one count is 360/4096 = 0.088 degrees.
Microstep size: 200 x 16 = 3200 microsteps per revolution, so one microstep is 360/3200 = 0.1125 degrees. The encoder count is finer than one microstep, about 1.28 counts per microstep, which is the comparison that matters for detecting a stall of a few microsteps.
Belt path: quadrature decoding yields 4 counts per line, so 512 x 4 = 2048 counts per encoder revolution. Through the 2:1 reduction the encoder turns at half motor speed, so 2048/2 = 1024 counts per motor revolution, and one count is 360/1024 = 0.352 degrees. The magnetic part resolves 4096/1024 = 4 times finer on the motor shaft, which is exactly the ratio that motivates the swap.
Put the large pulley on the motor instead and the encoder overspeeds 2:1, giving 2048 x 2 = 4096 counts per motor revolution on paper, at the cost of running the belt and encoder at double motor speed with the same stretch and backlash terms in the path. Calculate with your actual pulley tooth counts; which pulley sits on the motor decides whether the ratio multiplies or divides. Matching that count to how fast the system can respond to a step is its own calculation, covered in choosing encoder resolution to match a stepper step response.
Where the belt drive loses accuracy #
Even at equal counts, the belt path carries errors the magnetic mount does not. Belt stretch and tooth backlash make the encoder angle lag the motor angle under reversing load, pulley eccentricity adds a once-per-pulley-revolution wobble, and if the encoder belt itself jumps a tooth the sensor reports motion the motor never made. That is the fault you bought the encoder to catch, recreated one level down. The route also needs its two timing pulleys matched to the belt and a bracket that holds tension. The general trade between belting a sensor and mounting it direct is worked through in timing belt vs direct mount for a rotary encoder.
Accuracy is not the count number #
A magnetic encoder's real angle error comes from its integral nonlinearity, the centring of the magnet and the air gap, and it is stated as an accuracy figure on the datasheet of the exact part. Read that figure, not the bit count. An eccentric magnet produces a once-per-revolution error that looks like a position-dependent offset, so concentricity is an accuracy item, not cosmetics.
The air gap is likewise a per-part value: one published dual absolute encoder kit datasheet, for example, lists a nominal magnet-to-chip gap of 0.40 to 0.60 mm with 0.2 mm as the minimum. Treat that as an illustration of the class, fractions of a millimetre, and set your gap to the range in your own sensor's datasheet. An optical encoder's accuracy is likewise a datasheet figure for the disc; with the belt drive, the stretch, backlash and eccentricity terms sit outside that figure and add to it.
Two steppers end to end: the interference question #
A magnetic encoder measures the direction of the magnetic field at its die. The motor's own phase currents and rotor modulate that field slightly, appearing as a periodic ripple at the motor's electrical period, one cycle every 4 full steps, which is 7.2 degrees of shaft on a 1.8-degree hybrid. A second stepper mounted behind the first is a large rotating magnet next to the sensor, and its field superposes the same way. Stray field from a magnetic dipole falls with the cube of distance: doubling the sensor-to-neighbour separation cuts that motor's contribution to about one eighth.
The fixes, in the order to try them:
- Separation, which the cube law rewards; even a few extra centimetres of stand-off helps.
- A steel shield plate between the two motors.
- The strongest magnet the sensor accepts, because a stronger signal field swamps the stray field. Keep the field strength inside the sensor's specified window: many magnetic encoder ICs report field magnitude or gain status through a diagnostic register or a status output, so read it and stay within the datasheet's range.
- A belt-driven optical encoder, which is immune to stray fields, as the final answer when the logs demand it.
Mounting and proving the rear-shaft encoder #
- Confirm the motor has a rear shaft extension long enough for the magnet. A motor with a blind rear cover cannot take one, and that alone forces the belt route or a different motor.
- Fix the magnet concentric on the shaft end; the eccentricity error above is set at this step.
- Set the air gap to the datasheet range and bolt the sensor board rigidly to the motor flange or a bracket on it, never to a flexing cover.
- Read the sensor's field-strength status and confirm it stays in range at every shaft angle through a full turn.
- Energize the motor at working current, step one full revolution slowly, and log encoder angle against commanded angle. Repeat at working speed.
- Run the neighbouring motor at full current with the first held at rest, then with both running. A change in the ripple between those logs is interference.
- Set a following-error limit in counts, commanded minus measured, that stops the machine when exceeded.
- Verify the whole chain: command a long back-and-forth move that ends at the home reference, re-home, and compare the step count and encoder reading at the interrupter. A repeatable zero within one encoder count confirms no cumulative loss. Then stall the shaft deliberately at reduced current with the load mechanically captive, and confirm the following-error limit trips.
The decision #
- Rear shaft free and no neighbouring motor close behind it: mount the rear-shaft magnetic encoder. You get 4096 counts per revolution directly on the motor, nothing to tension and nothing to wear.
- Rear shaft blind or too short: use the belt-driven optical encoder, size the pulley ratio for the counts you need, and put belt tension on the maintenance schedule.
- Two steppers end to end: mount the magnetic sensors, maximize the separation and fit a shield plate, then run the step-6 log with both motors at full current. Ripple within your error budget: keep the magnetic parts. Ripple above it: switch those axes to belt-driven optical encoders.
Questions asked
Does a NEMA14 stepper have a built-in encoder?
No. A standard stepper is sensorless and runs open loop, so the controller's step count is a commanded position, not a measured one. Closed-loop stepper variants exist, but they carry an explicitly added encoder under their own part numbers, so check the motor's datasheet before bolting on a second sensor that may duplicate one already inside.
Is homing to an interrupter enough without any encoder?
It gives a repeatable zero at every power-up but cannot see a stall between homing moves. If the load is guaranteed below the pull-out torque at your speed and acceleration, homing alone is sufficient. If a jam or collision is possible, only a measured position catches the lost steps, and that means an encoder.
Why does a 512 ppr encoder give 2048 counts per revolution?
Quadrature encoders output two channels, A and B, a quarter cycle apart. Each line produces a rising and a falling edge on each channel, and decoding all four edges yields 4 counts per line, so 512 lines give 512 x 4 = 2048 counts per encoder revolution, before any pulley ratio is applied.
Where should the encoder cable run?
Keep it away from the motor phase leads, whose switching edges couple noise into the encoder signals and show up as sporadic count errors. Where the two must cross, cross at right angles rather than running parallel, and keep unshielded sensor wiring as short as the mounting allows.