Introduction to encoder principles
Optical vs Magnetic Encoders: Where They Differ

An optical encoder modulates light with the lines on an encoder disc; a magnetic encoder lets a sensor read the magnetic field as the poles change. The two types differ in resolution, accuracy, contamination resistance, immunity to magnetic fields, size and cost. This article starts from the operating principle and compares their features and typical applications.
When you select an encoder, a common question is: optical or magnetic? Both can turn rotation into an electrical signal, and the output interface can even be the same, but they “watch” rotation in completely different ways, so their strengths and weaknesses differ as well.

Principle: one watches light, the other senses a magnetic field
The core of an optical encoder is the encoder disc. A light source illuminates the disc; the lines block the light and the gaps transmit it. As the disc turns, the photodiode sees alternating light and dark, and the output current changes with it. The pattern on the disc is made by photolithography and can be very fine: 2500 lines at a radius of 20 mm give a pitch of about 50 μm and a line width of about 25 μm.
Magnetic encoders commonly take two forms; the right-hand side of Figure 1 shows the second:
- End-of-shaft type: a diametrically magnetized magnet is fitted on the shaft end. A magnetic-sensor chip facing it measures the direction of the field and, once per revolution, produces a period of sine and cosine from which the angle is calculated.
- Magnetic-ring type: a multipole ring with alternating N and S poles is fitted on the shaft. A Hall or magnetoresistive sensor sits beside it; each time one pole pair passes, the output changes by one period.
Resolution and accuracy: the difference is the number of native periods
Both types can interpolate the sine and cosine, dividing each period into many parts. The difference is how many native periods there are per revolution before interpolation. An optical disc can have several thousand periods per revolution; a magnetic ring is limited by the pole width, so it has far fewer; the end-of-shaft type has only one period per revolution.
The number of periods determines how large a signal error becomes once it is converted into mechanical angle. A purely illustrative example: a 1% DC offset on the signal produces an electrical-angle error of about 0.01 rad. On a 2048-line disc that is only about 1.0″; if there is only one period per revolution, 0.01 rad is about 0.57° of mechanical angle. So schemes with few periods per revolution place much higher demands on calibration and compensation of the signal.
Contamination and shock resistance
Oil, dust and moisture have almost no effect on a magnetic field, so magnetic encoders have a natural advantage here, and the magnetic ring itself is also not afraid of shock.
An optical encoder works with light; contamination on the disc or the scanning window will block the beam and reduce the signal amplitude, so the unit must be well sealed. A glass encoder disc is accurate but sensitive to shock; where shock and vibration resistance are needed, a metal encoder disc can be used.
Immunity to magnetic fields
Conversely, what magnetic encoders fear is an external magnetic field. Permanent magnets in a motor, a brake coil, or a nearby high-current cable can all disturb the sensor reading; shielding or greater distance is needed. Optical encoders are insensitive to magnetic fields.
Size, cost and suitable applications
| Comparison | Optical | Magnetic |
|---|---|---|
| Signal source | Disc modulates light | Change of magnetic poles |
| Native periods per revolution | Many, up to several thousand | Few |
| High resolution and high accuracy | Readily achieved | Relies on interpolation and calibration |
| Oil and dust | Sealing required | Little effect |
| External magnetic field | Insensitive | Shielding required |
| Construction | Light source, disc and readhead must be aligned | Fewer parts, easier to miniaturize |
A rough guide is this: precision servos, CNC rotary tables and measuring instruments, where resolution and accuracy matter, usually take the optical type; where there is oil and dust, heavy shock, little space, cost pressure and only moderate accuracy, the magnetic type is very competitive. Neither replaces the other; they have different jobs.
In brief
An optical encoder watches light; a magnetic encoder senses a magnetic field. An optical disc has many native periods per revolution, so high resolution and high accuracy are readily achieved, but contamination must be kept out. A magnetic encoder tolerates oil and has a simple structure, but it must be protected from external magnetic fields, and its accuracy depends more on interpolation and calibration. When selecting, rank the requirements for accuracy, environment, space and cost, and the answer is usually clear.
Translated from the ENC7 Chinese technical library (article 0006). Read the Chinese original. Need a disc built to your drawing? Request a quote or see our custom encoder discs.
© Langfang Jingzheng Optoelectronic Technology Co., Ltd. All rights reserved. This article was created with AI assistance.