A rotary encoder measures how far and how fast a shaft has turned — the sense of position that lets a robot know where its joints and wheels are, and the feedback that closes almost every motion-control loop.
A rotary encoder is a sensor on a spinning shaft that counts how much it has turned. It's how a robot knows the exact angle of a joint or how far a wheel has rolled.
A robot can command a motor to turn, but how does it know the motor actually reached the right angle? The answer, on nearly every joint and wheel, is a rotary encoder.
What it does
A rotary encoder sits on a rotating shaft and turns its motion into an electrical signal that says how far it has turned. Differentiate that over time and you also get speed. This is the feedback that lets a controller compare "where the joint is" to "where I told it to go" — the heart of closed-loop control.
The encoder closes the control loop
Without the encoder, the controller is guessing. With it, the loop can correct error every cycle — the basis of precise motion.
How it works
Two common technologies:
Optical — a disk with fine slots spins past a light and detector; counting pulses gives rotation. High resolution, but sensitive to dust and shock.
Magnetic — a magnetized ring and a Hall-effect or magnetoresistive sensor read the field. Rugged, tolerant of dirt and vibration — favored on mobile robots and harsh environments.
Incremental vs absolute
The big distinction: an incremental encoder outputs pulses as it turns — it counts change but doesn't know its absolute angle at power-up, so it needs a homing routine. An absolute encoder reports the exact angle directly, even right after power-on. Incremental is cheaper and common on wheels; absolute is preferred on robot arm joints where knowing the true angle immediately is a safety matter.
Where you'll see it
Every servo motor has one for position feedback. Wheel encoders feed odometry — counting rotations to estimate how far a mobile robot drove. CNC machines, 3D printers, and camera gimbals all depend on encoder feedback for accuracy.
Why it matters
The rotary encoder is the fundamental position sense of robotics. Without it, motion control is open-loop guesswork; with it, robots move precisely and repeatably. It's one of the most ubiquitous sensors in any robot.