DIY Optical Encoder

Written by matthew dehaven
  • Share
  • Tweet
  • Share
  • Email

An optical encoder is a sensor used to measure the rotation of a shaft via a computer or microcontroller. It is commonly used in robots to measure the movement of wheels and arm joints, as well as to track the position of moving parts in all types of computer controlled machines. You can make a basic optical encoder out of inexpensive parts.

Skill level:

Things you need

  • Thin cardboard
  • Infrared reflective sensor
  • Nut and bolt

Show MoreHide


  1. 1

    Print out a circular pattern of evenly spaced black and white areas. You can find image files for the necessary pattern at the "Optical Encoder Project" website.

  2. 2

    Cut out the pattern from the sheet of paper. Glue the pattern to a piece of thin cardboard to make the encoder disc. Punch a hole in the centre for the shaft.

  3. 3

    Place the encoder disc on the shaft it will be measuring. Secure it with nuts or shaft collars. Make sure that the disc will not be rubbing against anything as it rotates.

  4. 4

    Position the sensor so that it points at the edge of the encoder disc. The sensor should be able to clearly sense the black and white areas. By counting the transitions between black and white areas, the controller will be able to measure how far the shaft has rotated. Drill a hole in the structure holding the shaft (to match the sensor's mounting hole), and bolt the sensor in place. The necessary spacing between the sensor and disc will vary from one sensor to another. Consult the documentation for your sensor for specific mounting guidelines. If necessary, bend a piece of sheet metal to make a mounting bracket, and drill holes to attach it to the machine structure and sensor.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.