A magnetic rotary encoder measures the angle of a rotating shaft without needing physical contact between the shaft and the sensor. In robotics, this is useful for joint position feedback in arms, wheels, grippers, and actuators. A diametric magnet on the shaft creates a rotating magnetic field pattern, and a Hall sensor chip below it detects the field direction.
The result is an absolute angle reading that can be available immediately at power-up.
Understanding Robotics: Magnetic Rotary Encoder
The measurement depends strongly on geometry. The magnet needs to sit near the center of rotation, with its magnetic axis aligned as the sensor expects. As the shaft turns, the sensor sees the field move through two sideways directions.
The chip compares these directions to locate the field around a circle. Real devices must correct for small errors before this result is trustworthy. A magnet may be slightly off center.
The air gap may change during rotation. The sensor itself can have a tiny built in offset.
During calibration, the controller can measure these effects and apply corrections. Without correction, a reading may wobble even when the shaft rotates at a steady speed.
An absolute reading describes position within one complete turn. This is enough for a robot joint that never needs to distinguish between several full revolutions. It is not enough by itself for a wheel axle or a motor that can spin continuously.
In those cases, software counts each time the reported angle passes through the zero point. The count combines with the one turn angle to give total motion. This count can be lost if power fails unless it is saved in memory or measured again using a reference switch.
Students should separate angle, number of turns, speed, and direction. They are related measurements, but they are not the same thing.
A robot controller uses encoder feedback as part of a repeated correction loop. It receives a target joint angle, reads the actual angle, then changes motor power based on the difference. If the arm is pushed away from its target, the encoder reveals the error.
The controller can then drive the motor back toward the commanded position. Encoder placement matters here. A sensor on the motor shaft measures motor rotation, which may differ from joint rotation because gears can flex, wear, or have backlash.
A sensor on the final joint shaft measures the motion that matters to the robot. Reading position over time gives speed, but this estimate becomes noisy when the angle changes by only a few measurement steps.
Resolution sets the smallest reported change in angle, not the true accuracy. A twelve bit encoder divides one full turn into four thousand ninety six positions, yet poor alignment can still create a larger position error. Accuracy is affected by magnet strength, spacing, temperature, nearby steel parts, and external magnetic fields from motors or wires.
A large electric current can create a field that shifts the measurement. Engineers test the encoder while motors run and while the robot carries a load.
They watch for missed wrap counts, jitter near a fixed position, and sudden angle jumps. Good wiring, stable power, careful mounting, and calibration are often as important as the sensor chip itself.
Key Facts
- A diametric magnet has its north and south poles on opposite sides of its diameter, not on its flat faces.
- Hall sensors measure magnetic field components, often Bx and By, near the sensor chip.
- The shaft angle can be found from the field components using theta = atan2(By, Bx).
- Absolute encoders report position directly, while incremental encoders report changes in position.
- Angular resolution for an N-bit encoder is resolution = 360 degrees / 2^N.
- Magnetic encoders are often robust against dust, oil, and light contamination because they do not rely on an optical path.
Vocabulary
- Magnetic rotary encoder
- A sensor system that measures the angular position of a rotating shaft using a magnet and magnetic field sensors.
- Diametric magnet
- A cylindrical magnet whose north and south poles are located on opposite sides of the curved surface.
- Hall effect
- The production of a voltage across a conductor or semiconductor when electric current flows through it in a magnetic field.
- Absolute angle
- The actual angular position of a shaft within one full rotation, usually reported from 0 degrees to 360 degrees.
- Resolution
- The smallest change in angle that an encoder can distinguish and report.
Common Mistakes to Avoid
- Placing the magnet too far from the sensor, which weakens the magnetic field and can make the angle reading noisy or unreliable.
- Using an axially magnetized magnet instead of a diametric magnet, which gives the wrong field pattern for many angle sensing chips.
- Confusing absolute position with speed, because an encoder reports angle directly while speed must be calculated from how angle changes over time.
- Ignoring mechanical alignment, because an off-center magnet can introduce angle error even when the electronics are working correctly.
Practice Questions
- 1 A 12-bit magnetic rotary encoder divides one full turn into 4096 counts. What angle in degrees corresponds to 1 count?
- 2 A robot joint uses an encoder with 14-bit resolution. How many distinct angle positions can it report, and what is the angular spacing in degrees?
- 3 A robotic arm works in a dusty workshop with oil mist near its joints. Explain why a magnetic rotary encoder may be a better choice than an optical encoder for this environment.