Back to Projects

8-bit Absolute Optical Encoder

Designed and prototyped a custom 8-bit absolute optical encoder using a Gray code pattern, infrared sensors, and SVG-based pattern generation software.

8-bit Absolute Optical Encoder

8-bit Absolute Optical Encoder

Encoders are fundamental for positional feedback in robotics. While incremental encoders are common, they lose position on power loss. This project aims to build a custom Absolute Optical Encoder that outputs a unique digital code for every angle.

The Gray Code Disk

Unlike binary, Gray code changes only one bit at a time between adjacent sectors. this prevents reading errors (glitches) during transitions.

  • Resolution: 8-bit (256 positions per revolution), resulting in ~1.4° precision.
  • Generator Software: I wrote a Python script to generate the Gray code SVG pattern, which was then printed on a transparency film and mounted on an acrylic disc.

Hardware Implementation

  • Emitters: 8x IR LEDs (940nm).
  • Detectors: 8x Phototransistors aligned with the code tracks.
  • Signal Conditioning: Uses 74HC14 Schmitt Triggers to clean up the analog signals into crisp digital 0s and 1s.

Application

The encoder was interfaced with an Arduino via a parallel bus (and later shift registers) to read the instantaneous angle. It served as a low-cost, high-reliability educational tool for understanding digital position sensing fundamentals.