An optical encoder consists of a disk fitted on a rotating shaft. The disk has opaque and transparent sectors, and a light source focuses on the disk. When the disc rotates, the light passes through these sectors, creating a pattern that is read by a sensor on the opposite side of the light source. The sensor then decodes the resulting pattern, translating the mechanical movement into digital signals.
Rotary optical encoders come in two main types: absolute encoders and incremental encoders. They are constructed largely in the same way; the main difference between them centers on the disk and the way its movement is interpreted.
Incremental encoders, also called relative encoders, feature a disk that has transparent and opaque sections that are equally distributed. Incremental encoders measure the movement by counting the number of alternations of transparent and opaque sectors that pass in front of the sensor. They are not as accurate as absolute encoders, as a simple misreading error or interference can cause a miscount and render a wrong result.
Absolute encoders use a disk that has a unique pattern. The rotation of the disk translates into a code, named the gray code, that is similar to binary code. These encoders are the most accurate, and because they calculate the result based on a combination of physical disk reading and code interpretation, the result will be accurate even in the event of some small interferences.
Initially optical encoders used a glass disk, which can be quite sensitive especially at high rotations, but plastic or steel disks are now available, making optical encoders more reliable.
Since they incorporate electronic components, they can be subject to magnetic or radio interferences. Another disadvantage is that, in some cases, external environmental conditions such as direct light sources can also interfere with the results.