Optical Encoding Tutorial & Codewheel Generator

Tom Lackamp has written up a great tutorial on everything (seriously, just about everything) involved in motor optical encoding/decoding here.

Aside from writing this good primer/refresher, Tom has also written an excellent Windows program that lets you parametrically generate and export and/or print all sorts of codewheels! For example:

The program is incredibly simple and intuitive to use, yet as you can see it can generate some quite complex wheels. It’s easy to miss, but the program download/install links are about 90% of the way through the tutorial, right here.

You can print wheels on white paper to use with reflectance sensors, or on transparency film to use with photo-interruptors. I’m planning on the latter, and currently looking for a place I can buy small amounts of laser-printer safe film (office, craft, and photo stores sell small packs online-only plus shipping, or huge expensive packs in-store).

In case you can’t find transparency film that will work with your printer, I called up my local Kinkos, and they’ll print black and white transparencies for $0.75 a sheet. If you go this route you’ll probably want to use the codewheel generator’s bitmap export function and make up a page with lots of wheels on it. Also, you’ll DEFINITELY want to bring this page to Kinkos as a PDF file to avoid a document-conversion fee (seriously! It’s $5 for up to three files, and $1.50 each after that). In situations like this I use a free program called PrimoPDF, which installs itself in Windows as a virtual printer, so you can just ‘print’ to it from any other application, then select output file properties in the window that pops up. I hear you can also avoid the fee by submitting your files online as well.

Also, something to keep in the back of your mind, the codewheel generator counts all dark/light transitions as ticks, so if you use it to make a 100 tick wheel it will have 50 dark stripes and 50 light stripes. Some feedback systems, including the Pololu feedback motor controllers, only count one kind of pulse edge as a tick, so they would see this as a 50 tick wheel.

Happy encoding!


1 Like

I advise you to use this PDF Converter. It is freeware and produces fine PDFs.
I think it is more poverfull, than PrimoPDF