Engraving
Galleries
Knifemakers

Drawing

 
Engraving Tool
Archive
 
Current Tools
 

 Services

Shop Tour

Other Interests


 Hand Engraving Simulation CNC


Tool Path GCode


DRO


Arrow Pro


Corvette

 

Digital Read Out Quadrature Encode Reader Program
Digital ReadOut version 4.0
Will read 5V quad. encoders via the LPT port and display either linaer measurement or rotary angles.

by Steve Lindsay

DRO version 4.0 is a computer digital readout for linear movement or for rotary (degrees, minutes, secs.) movement. It reads via the printer port quadrature square wave 5V encoders that may be used to control mechanical movement.  To retrieve the DRO4.0 Software (1.2 meg) Click here.

DRO 4.0 software is now free as is the C++ code!
If you use the program please take the time to put together a web page telling about the application you are using it for with info about the hardware you built for it.  In this way others may make use of the knowledge you learned using it in your application.  The C++ code is also available.  I've hung on to the code for a long time thinking someday I wanted to do more with it but I've decided it is better to let it out.  Please feel free to rewrite, change and make it better anyway you see fit.  I do ask that if you make some neat modifications that you not sell it for profit but instead share it with the internet community so we can all benefit.   Note: Good news!!!! Art Eckstein has modified the code and recompiled it with some good improvements.  Please visit Art Eckstein's Web page

Special requirements: ECP parallel port and making of simple hardware interface. Text files and jpg files show you how.

To install Digital ReadOut: Create a directory for it and use PKZIP to extract the DRO40.ZIP file. To run the program change to its directory you made for it and type dro followed by enter.  (you don' t need to have the encoders or interface made just to run and see what is in the program...so feel free to download and run it to check it out.)

Features:

  • Read up to three encoders simultaneously.
  • Reads 4 times the resolution of the encoder by counting all changes per cycle of the quadrature inputs.
  • Reset, Preset.
  • Absolute master mode and four incremental modes.
  • User selectable between Linear and Rotary readouts.
  • User customizable unit to count by for each encoder.
  • Six places right of the decimal point resolutions possible.
  • Linear backlash compensation.
  • Millimeter to inch and inch to millimeter conversion.
  • Reads from most 5V encoders with quadrature square wave output.

dromainscreen.jpg (5443 bytes)
Main DRO Reading Screen

linearsetup.jpg (12983 bytes)
Linear setup options

rotarysetup.jpg (9084 bytes)
Rotary setup options

To retrieve the DRO Software (1.2 meg) Click here.

Here is a link to a company that carries the HP linear encoders and scales.
They also carry the HP rotary encoders with and without housings. I have no connection of any kind with this company.

The program using the lpt port does work well. I can spin a rotary encoder 1/8" shaft (that has a speed increase gear box of 6 to 1) as fast as I can between my fingers and the program will not loose count. This is on a 486-100 computer. I tried it on a 286 and if you spin to fast it will loose count. The program watches itself and if it thinks it lost count it will let you know by counting up the errors.

The electronics hardware interface only consists of two transistors per encoder. Below is a drawing of the hook up.  Click to enlarge.


Below is a pic of the interface board.. Click to enlarge


Here are two pictures showing the device I made to convert linear movement to rotary.
linear2.jpg (86514 bytes)

linear4.jpg (36736 bytes)


The software works well, but the device I built that lets the program do linear readings (pictured above) isn't as dependable as I'd hoped.  HP does sell some encoders and scales for linear movement at 200 lines per inch. (I think about $30) This would quadrature out to 800 lines per inch which is only .00125 resolution. It does not have quite enough resolution for my preferences, but it is more dependable than my device and having to worry about "did the wire slip over the rotary encoder shaft?". With the wire over the encoder shaft setup that I was using (shown in the above) the resolution is .00025". Most of the time it will not slip but it is always in the back of my mind. If anyone figures out a better way to convert linear to rotary for a rotary encoder please email. If you have commercial glass linear scales that output 5V you should be in business.  The program will do indexing too and the rotary encoders work just right for that.

Click here... for troubleshooting the lpt port

Feb 29, 2000: A super do-it-yourselfer Art Eckstein has put together a web page showing his setup using the program on a milling machine.  He is using a Radio Shack IC instead of the transistors for the interface.

Nov 15, 1999: Flash... (looks like I have a flash once a year) I decided to share with the world my C++ code for this program. Here it is.....

Nov 30, 1998: Flash....Latest update news about getting dro40 to work with your LPT printer port
 

PS....Here is the help file from the program....for your reading pleasure:

Digital Read Out Quadrature Encode Reader

This help tells about the functions of each screen and
menu. Read DRO.TXT with your favorite text editor to
learn how to make your own simple interface to
interact with the LPT port and your 5V encoders.

All the menus in the program have highlighted letters.
Hitting that letter on your keyboard will take you to that
function. At any time to return to the previous menu
press the ESC key.

When DRO is started the first screen is where the LPT
port is chosen. The default port is LPT1. The setting
of the IRQ# is unimportant if the IRQ is shut off (IRQ
on/off in the lower right corner of the screen). Shut
the IRQ off in order to use the interface described in
DRO.TXT. The Time Display value is used when the
IRQ is shut off. The program uses the time display
value while DRO is watching the port and displaying
the incoming value changes to the screen. When
information begins to come in to fast (encoders are
spinning fast) the program will stop updating to the
screen and just concentrate watching the port and
counting. The time display value determines when the
program should quit displaying to the screen and only
concentrate watching the port. Try to set this value to
the smallest number without errors coming in. Pertinent
values are from 1 to 300. The default is 10. To view
and/or change the Time Display value press the 't' key
from the main menu. Enter a new value or press ESC to
return back to the main menu.

Press the 'r' key from the main menu to begin reading
the port. This encoder reader screen uses X, Y and Z
to designate the 3 encoders. The X axis is hooked to
pins 2 and 3 of the LPT port, Y is hooked to 4 and 5,
and Z is hooked to 6 and 7. There is a quick zero
reset for each axis from this screen. They are F1 for
X, F2 for Y and F3 for Z.

There are four increment modes and one main Master
Mode. Press the 'm' key or space bar to toggle
through them. Each axis (encoder) has it own setup
screen and depending if you are in Master mode or a
increment mode the setup is different. The
increment mode is a more limited setup screen.
Toggle the mode by pressing the space bar until you
are in Master Mode. Now press the 'x' key. This takes
you to the X axis (encoder1) Master setup screen.
The available options in this setup are:

COUNTING UP/DOWN +/-
To change the direction that encoder is counting.

RESET TO ZERO
To reset the encoder to zero. Press it again to undo
the rezero. (F1 will do the same from the reading
screen but there is no undo from there)

CURRENT VALUE
Enter in a new current value

UNIT TO COUNT BY
Enter in a value for this encoder to count by (up to 14
places to the right of the decimal).

BACKLASH ON/OFF
Use if you are hooking directly to a lead screw that
has backlash.

LASH DISTANCE
The backlash distance of the screw.

LASH TENSION DIR.
Which way you want the tension of the lash to go from.
(Once you set this it will keep track of where you are
in the backlash. So if you take the backlash up the
opposite of what it once was and rezero the axis it
will automatically switch the "lash tension dir." for
you.)

POSSIBLE ERRORS
This will show a running count on the encoder reader
screen of any possible errors.

PLACES SHOWN RIGHT OF DECIMAL
How many places to the right of the decimal you would
like displayed on the encoder reader screen.

F2 CONVERSION
Menu to a inch to mm and mm to inch setup screen.

When you are finished entering in the data press the
ESC key to return back to the encoder reader screen.

Press the space key to go to any other mode than the
Master mode. Now press the 'x' key. This is the
incremental mode setup screen. The options are
Reset to zero, Entering in a new current value and
changing direction of counting +/-. Press the ESC
key to return back to the encoder reader screen.

When you press the F1, F2 or F3, key to rezero from
the encoder reader screen this will rezero only what
mode you currently in. If you press one of these hot
keys from the Master Mode it will rezero all the modes
however.

It should be noted that if you are using an interface to
your encoders without an IRQ (interrupt) and you are
in any other screen besides the encoder reader
screen and one of the encoders moves, the program
will not see it move. This is not true with an IRQ
interface though.

You may setup any three of the encoders to read as a
rotary readout to use in indexing. From the encode
reader screen press the 'r' key. The program will ask
you for what axis you would like setup as rotary. In
the Rotary Settings screen the options are:

ROTARY COUNTING ON/OFF
Shut this off to go back to linear counting.

RESET TO ZERO
Reset the encoder to zero.

CURRENT VALUE
Enter in the current degrees value. Either decimal or
in degrees, minutes, secs.

DISPLAY
Display in degrees, minutes, secs or in decimal
degrees.

NUM. IN 360 DEGREES
Enter in the number of counts per rev. of your
encoder times four because DRO reads the
quadrature.

SHOW REVOLUTIONS
Toggles between showing how many times past 360
was hit.

COUNT DIRECTION -/+
Change direction of counting up or down.

After entering in the data press ESC to return to the
encode reader screen.

There is one other hot key that is not shown on the
encoder reader screen and that is the 'h' Help key.

www.AirGraver.com
www.EngravingArtist.com
www.EngravingClasses.com
www.EngravingLessons.com
www.EngravingSchool.com
www.EngravingForum.com
www.EngravingGlossary.com

          Copyright 2010 Steve J. Lindsay, All rights reserved.