Encoder Wheel Generator

by NickAmes, published

Encoder Wheel Generator by NickAmes Jan 4, 2010



Encoder Wheel Generator by NickAmes is licensed under the GNU - GPL license.

Liked By

View All

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.

Print Thing Tag

Thing Statistics

20963Views 7123Downloads Found in Electronics


This is a PostScript program to generate optical encoder wheels. Unlike other encoder generator programs, it is highly flexible and has many features, such as:

  • Correct inside and outside diameters, regardless of line width.
  • Quadrature capabilities, with adjustable phase difference.
  • Automatic scaling of text size.
  • Optional index track, with adjustable size or automatic fitting to segment size.
  • Automatic page filling with cutting allowances.
  • Most features can be turned on or off.


To use, open up the file in a text editor and edit the settings. Then, open the file in a PostScript viewer (Acrobat?, Okular) or interpreter (GhostScript, ps2pdf) and print it out.
If you find any bugs, please email me. My address is in the file.
For best results, use the latest version.


v1.4 (latest) Added page size options.

v1.3 Corrected bug caused by me being idiot about how quadrature actually works. I was calculating the phase difference based on one segment, but two segments actually make up a full wave, so the quadrature came out as half of the PhaseDifference. Many thanks to Rafael Pinto for finding this.

v1.2 Corrected bug causing a 1 degree gap in the segment track at extremely high segment counts (>700).

v1.1 Corrected bug causing letter descenders (such as on g,j,p,q, and y) to be drawn on and below the underLine. Letter descenders are now placed above it.

v1.01: Corrected typos in code comments.

More from Electronics

view more

All Apps

Upgrade this Thing with Thingiverse Apps

No results.

Will, for sure, be integrated in some future project.

If someone wants to try an alternative tool for making optical encoder discs, check out my post: http://www.dgkelectronics.com/inkscape-extension-for-creating-optical-rotary-encoder-discs/http://www.dgkelectronics.com/...

Its an Inkscape extension for making rotary encoder discs, bit simpler to use than this PostScript thingie if I may say.

your link dont work bro

Dear Nick.

I'm thinking og using CD or DVD plate as encoder.

That is .. we "burn" something to the plate.

I found lightscribe .. and also qlscribe.

I tried to make configuration to your ps script :

  1. Outer diameter 80 mm

  2. page size : 80 mm x 80 mm

  3. Margins : 0 mm

For #1 and #2 I set it as the sime in try to make it single object in a single page and position it at the center f the page.

But when I open it with software .. such as GIMP, it show the circle positioned at bootom-left of the page. and the page size is not like what i defined.

Kindly please te
ll me How to generate a CodeWheel at the dimmenssion of CD label graphic, so I can "Insert" it to qlscribe


After doing some research, I've come to the conclusion that the page size of a postscript program is mostly determined by the software rendering the page.

Why not use the crop tool in GIMP to trim the image to your desired size?


Thanks for this great work!
Any tips on which sheet print transperant material should be used ? my old one (faulty)is 0.2mm thick 50mm diam. and is made of somehow hard transparant plastic material that will not bend easily when rotated.
Many thanks in advance!

I recommend laser printed transparencies (used for overhead projectors). They can be printed at any copy shop.

is a good contribution, very well men ........... really good 8-)

Great job!!

Just one note:

Although you are right when you specify .25 as default phase for quadrature encoders in the PS program parameters, the plotted phase seems to be half of the expected, and quadrature is achieved with .5.

I believe that is because you are computing the phase based on one segment, but a full wave is actually two segments long.

Nice work! Very fully featured. You've definitely obsoleted my earlier design... which is great :)

P.s. I almost forgot how awesome postscript was!


Any tips on which sheet print transperant material should be used ? my old one (faulty)is 0.2mm thick 50mm diam. and is made of somehow hard transparant plastic material that will not bend easily when rotated.
Many thanks in advance!

This is a brilliant idea. Thank you.

Actually, it wasn't my idea; there have been other PostScript encoder generators before mine. I wrote the program because the other one weren't quite what I wanted. My program is just a bit more flexible and slightly more automated.
Some other encoder generators:
http://mitros.org/p/projects/encoder/http://mitros.org/p/projects/e... - This link has a lot of information on optical encoders as well

@NickAmes, I
´m the original author of the code that appears on the sxlist.
Nice to see the "creature" is evolving and alive, that´s the beauty of open-source!
A few months ago I´ve published the original code on GitHub - http://github.com/rseixasgithub.com/rseixas - I have a lot of PIC code laying around on CD´s and 3-1/2 floppy d
isks that I intend to put there.
BTW, I´ve used the disk generated by this code to create a "wheel car alignment" machine with ~ 0.05° of resolution.

Best Regards,
Ricardo Seixas