Encoder A Program for Digital Setting Circles Using a PC Mouse.
The purpose of the Encoder program is to provide the amateur telescope builder an inexpensive means of interfacing between optical encoders on a telescope and a computer running some planetarium or sky position software. This program is free to all amateur telescope builders and is not intended for sale.
The Encoder program requires a PC equipped with a 386DX2 processor or better, at least 4 Megabytes of memory running DOS 5 or better and a DOS mouse driver (like those supplied with the mouse when you buy it). I wanted this program to run on an older, simple (hopefully inexpensive) PC so the users primary, fancy and faster computer was free to run one of the popular planetarium software packages (like The SkyÓ , ECUÓ , DeepSkyÓ ). The Encoder program acts as the interface between the optical encoders connected to the telescope axis and the planetarium software. The optical encoders are connected electrically to a modified PC mouse according to instructions from bitmap supplied in the zip file (and in this document). The PC mouse will convert the electrical pulses from the telescope encoders into pulse counts and send this information to a PC by the serial (or PS/2) cable and port. The modified mouse is connected to the PC you plan to run the Encoder program on, along with a DOS mouse driver. The mouse driver software will read the mouse pulse count information it receives from the serial COM (or PS/2) port. Encoder will query the DOS mouse driver periodically to see if there are any changes in the counts (or telescope movement) from the optical encoders mounted on the telescope. The program Encoder will take an update of the counts from the mouse driver and convert them to a format that is readable by the planetarium program running on the second personal computer.
(Editor's Note: The encoder program is provided in AmSky in a self-extracting archive named encodera.exe. When you open encodera.exe it will extract the encoder.exe file to c:\encoder. If you want the original zip file that includes the C source code and an MS-Word version of this article as well as other useful related files click on the "clikc here to download" link in the next paragraph.)
To install the Encoder program, you will need an unzip program (Encoder.zip - click here to download - is many files compressed into one) like WinZip.exe or the DOS version PKUNZIP.EXE. Unzip the Encoder.zip file, and expand the contents of the zip file into the drive and directory that you wish to execute the Encoder program from. Copy the mouse driver that came with your mouse on the same disk drive, as the Encoder program was installed (it not necessary to copy the mouse driver to the same directory). If you wish the mouse driver and the Encoder program to start up on boot, then you may wish to create an AUTOEXECUTE.BAT file and add entries in that file to start first the mouse driver (with the correct arguments please turn off the accelerators) and next the Encoder program (again with the appropriate arguments for your system). This version of Encoder is capable of emulating several protocols such as Bseg, JMIs NGC-MAXÓ and MicroGuider IIIÓ and other features such reversing x/y axis, turning off screen output and setting the x/y resolution as arguments at program start. The arguments for these features are as follows.
-h A short help message to remind you of the arguments. -v To turn screen output on. -t <MG3, BSEG> For the type of protocol to output. Default is MG3. -r To reverse x and y in the protocol output. (Ive mounted my encoders in reverse before.) -x <integer> The encoder resolution of the x axis. Default is 4000. -y <integer> The encoder resolution of the y axis. Default is 4000. -p <port number>This is the COM port number to output position data to the computer running the planetarium program.
An example of usage is "encoder v r p 2 x 3000 y 5000 <ENTER>" and would result in Encoder first to output raw counts to the screen, reverse the x/y axis, output on COM2 to the planetarium computer, set x axis encoder resolution to 3000/rev and the y axis encoder to 5000/rev.
Above is a diagram for connecting commercial encoders and using the mouse electronics for detecting the pulses. If you plan on using the encoders that are already on the mouse, I would first carefully remove all the encoder components from a first mouse (the mouse that you will use for the serial/ps2 connection) and then with a second mouse, cut up and separate the encoders on the second mouse as described by Dan Stixrud in "Dans Canned Mouse Page". You will have to run cable from the two separated "Can" mice encoders back to the first mouse. Connect the "Canned" mice wire for wire on the first mouse (the one you remove all the locally mounted encoder components from) and in a way that will replace all the original encoders components with those in the "Canned" mice encoders.
After hardware setup is completed you may want to test the encoders with the mouse driver. If you run the Encoder program with the screen output turned on, you can watch the counts as the encoders are being polled by the Encoder program. This screen output can help you troubleshoot problems and verify correct operation of the system.
The computer running the Encoder program is connected to the computer running the planetarium software by an RS-232 serial cable. This serial cable must be a NULL cable, Null meaning the signals are crossed in the cable so as to let two like interfaces (two computers in this case) communicate. I have used a LapLinkÓ cable (LapLinkÓ is a program that allows you to copy files from computer to computer by interconnecting the serial ports) and had good results. The baud rate set by the Encoder program is 9600, 8, no parity. These same settings should be used in the planetarium program as well. Please refer to the planetarium programs help file on setting up the serial ports for an encoder interface device.
Given here are the steps needed to start the Encoder program, the commands may be put into a DOS batch file for convenience to give the user a single command to start the system up. The steps for using Encoder are as follows:
I hope you all have as much fun building the system and running Encoder as I had setting up this project (I especially enjoy its cost!). Please contact me by E-mail firstname.lastname@example.org if you have any problems, dont get frustrated, I may have been challenged with the problem already and may have a solution and if not I would be happy to help you solve it. Please contact Dan Stixrud for questions related mouse encoders (Ill help if I can, but Dan is the real expert here), his Email address is email@example.com.
Back to Canned Mouse