machine#designs_in_progess: CNC: encoders


Homemade encoder designs, commercial encoder recommendations, salvaged encoder stories

You can print an optical encoder disk on transparency film using an ordinary $100 laser printer. A two inch disk looks fine at 600dpi with up to around 256 lines. Kinkos has 1200dpi printers available for about $1 per page. I doubt photocopying an inkjet printout would work.

a python script that uses the cairo library to draw an encoder in svg, pdf, or postscript. more straightforward and easier to understand than raw postscript.

example output of

scan of one of the discs after being printed at 600 dpi:
see attached file encoder-60mm-256lines.jpg at the bottom of the page.

an experiment with making gray-code absolute encoders. unfortunately pukiwiki can't figure out how to give .ps files the right mime type, so you have to save this to disk and then open with a postscript viewer such as kghostview to see the pattern. open the file with a text editor to see the source code.

if you line up two encoders, one with 359 lines and one with 360 lines, there will be a moire effect: an apparent change in light/dark that travels around the perimeter of the disc once per degree of relative rotation. this concept can be used to make a highly accurate encoder out of relatively normal materials such as two led's and two sensors placed around the disc.


pseudo-random code absolute encoder

Phydbleep hand-wrote this post-script file for a homemade optical semi-random tach/position encoder ring.
Open the file with a text editor like notepad to change/view the sync pattern. Use acrobat reader or equivalent to display the output.
It uses a 128 pixel photodiode strip and a PIC 16F819 to read an abosolute position from the encoded pwm ring..

Phydbleep: I added 3 sync rings (45, 90 and 180 degree) and a ring for a tach pickup.. The sheet has 720/360/180/and 90 division tach rings.
5 of each per 8.5"x11" 2450 dpi heavy acetate sheet which costs $1 at kinko's, for a printing cost of $0.25 each per encoder ring.

Make sure the person on the printer knows WTH they are doing... Conversion to pdf is OK, but a trip into Photoshop at the standard 72x72
will kill the fine detail and render the PWM and Tach tracks useless.

# Try importing it at 2450x2450 and it might work.. It might also eat all the memory and crash the machine..
Again this will kill the fine detail in the PWM track and render the encoder useless.

The details on the fine detail... And why it's so important.
The PWM track is Symmetric PWM.. Go to
for all the scientific explanations or look at the design of the PWM track in Ghostview or another Postscript file viewer at 10X. You will see that the bars
are of 3 different widths, You must preserve this when it is printed or the encoder will not work.

Number the rings counting in.. 1 = PWM, 2= Tach, 3/4/5 are sync.. Read 1 @ 3 o-clock, Read 2 & 4 @ 12, Read 3 & 5 @ 6.
The sensor separation prevents falsing in the pwm and tach rings.. you need 5 leds and 132 photodiodes..
128 diode strip array + 4 discretes for rings 2-5.

The 128 pixel strip is actually reading the pwm code from the outer ring. You can read the shaft position from a cold powerup without jogging the shaft this way. I'm encoding the position right there and shooting it to a data aggregator @ 3Mbit/sec.. The encoder/aggregator will have .5 farad caps for brown-out protection. If the power dies, the machine will coast to a stop and the encoders/aggregator will have enough time to store current position/angle.

Still to do.. Bonding the encoder to a transparent stabilizing substrate and mounting it to the shaft..

Extracting quadrature encoders from mice:
beware that some mouse counter chips frequently lose steps...

more quadrature from mouse stuff

Attach file: 114 download [Information] 120 download [Information] fileencoder-60mm-256lines.jpg 32 download [Information] 105 download [Information] fileencoder.pdf 145 download [Information] 100 download [Information]

Front page   Diff Backup Reload   List of pages Search Recent changes   Help   RSS of recent changes
Last-modified: Fri, 06 Jun 2008 17:46:56 GMT (949d)
The Gingery Machines wiki is published under the
Creative Commons Attribution-Share Alike 2.5 License Creative Commons License