I'm thinking of using the gray code optical encoder disc design described at TeX Stack Exchange to sense the base rotation of a robot arm. Being able to vary the disc to suit the physical aspects of the particular situation is attractive.

Encoder disc

I've subsequently been thinking about putting together a matching 8 track reading head. Probably using something like these miniature reflective IR optical sensors.

IR sensors

Can anyone point me towards good resources for figuring out a read head design? Any tips for avoiding interference between tracks?

At the moment I'm just thinking about mounting them as close together as I can on prototyping board and printing the tracks on the disc to be the same width as a single sensor.

  • 2
    $\begingroup$ you could stagger the sensors if they interfere with each other ... transmissive sensors may be more accurate than reflective sensors $\endgroup$
    – jsotola
    Oct 23, 2021 at 20:37
  • 1
    $\begingroup$ Riffing on the transmissive idea, maybe work with an array rather than discrete parts. For starters, try a web search for "linear photosensor array". If the price and performance are right, it's not a problem to have are more pixels than you need. $\endgroup$
    – r-bryan
    Oct 26, 2021 at 1:41
  • $\begingroup$ @r-bryan great suggestion regarding array use. I found a low price reflective array at about the number of channels I’m looking for (link below). Did you have something similar in mind for a transmissive solution. pololu.com/product/4109 $\endgroup$
    – RowanP
    Oct 26, 2021 at 6:03
  • 1
    $\begingroup$ I was thinking something like the sensor used at arduining.com/2014/03/26/… (except those are no longer available). Sort of like a 1-D camera, that's what I meant about more pixels than you have tracks. For that matter, it might not be cuckoo to think about like a RPi cam and a bit of image processing, depending on the rest of the requirements... $\endgroup$
    – r-bryan
    Oct 26, 2021 at 18:32

1 Answer 1


I ended up going with the linear photo sensor array idea suggested by @r-bryan, and selected a Pololu QTR-HD-09RC Reflectance Sensor Array: 9-Channel, 4mm Pitch, RC Output. I’ll update this answer with Tex code for printing a matching Gray code wheel when available.

I’ve initially chosen a digital output array. I’ve yet to read through the supplied Arduino library to check for a non-blocking solution. I may switch to the analog version if this becomes an issue after testing.

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.