Rotary Encoder Disk
Faced with a need to count turns of magnet forward and reverse,
and not satisfied with extant code found on the Web,
I have developed a somewhat general purpose PostScript program
to print a quadrature encoder wheel pattern.
Use methods appropriate to download the PostScript source code,
then edit it to suit your needs. Units are in printers points,
constants are defined so that you can also use inches or millimetres.
For example, 144 , 2 inch , 51 mm are roughly equivalent; note that
the spaces between number and unit are significant.
diskradius is outside radius of the encoder pattern
stripewidth is the width (inside to outside) of the
shaftdiameter is the size of circle printed for the
central shaft - note that this is a diameter, where
other dimensions are radii.
segments is the number of segments, or cycles,
doublestripe is false for a single pattern, where only
one encoder is needed to detect speed; or sensors are positioned
in quadrature along the circumference to sense direction.
When doublestripe is true, a second pattern is
printed in quadrature within the first pattern so that sensors
may be set up along a radius; this makes it possible to change
encoder frequency (cycles per revolution) without needing
to relocate the second sensor.
For this project I will most likely use Sharp GP2S40 reflective
photointerrupters, with 7mm optimal sensing distance.
Above picture shows wheels printed with single row of
segments /doublestripe false def
for use with sensors spaced along the circumference,
and with a double row
/doublestripe true def for sensors oriented
along a radial line.
GNU General Public License.
Corrections, additions or comments?
(if supported by your browser) to the author,
Original: 2004 July 08
Last modified: Jul 9 14:31 2004 /