Encoder – A Program for Digital Setting Circles Using a PC Mouse.

http://www.worldaccessnet.com/~dstixrud/Jon/Encoder.html

Introduction:

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.

Description:

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.

setup.gif (2660 bytes)

Installation:

(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, JMI’s 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. (I’ve 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.

 

Setup:

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 "Dan’s 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 program’s help file on setting up the serial ports for an encoder interface device.

Operation:

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:

 

  1. For Dobson mount, level the base of the mount and then level the telescope in a 0 or 90 position. If you are using are using an equatorial mount, then setup it as you normally would.
  2. Insure that the cable between the telescope’s encoder mouse (that you are using as an electrical interface for the encoders) and the PC running the Encoder program is connected to the PC’s COM port or PS/2 port.
  3. Boot up the PC you will run Encoder on and start the DOS mouse driver at the prompt. Remember to add the necessary arguments for turning off any mouse acceleration.
  4. Insure that the cable between the PC running the Encoder program and second PC running the planetarium software is connect to the correct COM ports on both PC’s.
  5. If you have a Dobson mount point telescope either to the 0 or 90 position depending on what position the planetarium software needs for proper initialization.
  6. Start the Encoder program on the first PC, set the command line arguments that you require (like the setting resolution of x and y axis, or to turn on polling screen output and the COM port of the second PC) depending on the hardware setup of telescope and mount. If you are not sure of the resolution of your encoders, you can use the screen output option of the Encoder program (you may have to set the resolution of that encoder very high so you do not over-flow the counts) and spin the telescope 180 on the axis in question. This will give you the total counts per axis; this is the value that should be entered on the command line option. If you are using encoders with a gear ratio, the resolution command line option should be set to the encoder counts per revolution multiplied by the gear ratio of the encoder to telescope axis coupling.
  7. The remaining steps will depend of the planetarium software you are using, but typically they go as follows:
  8. On the second PC running the planetarium software, find the menus for setting the encoder interface configuration. Select the Encoder protocol of MicroGuider III if available otherwise any other compatible option. Set the COM port number of the planetarium PC that is connected to the Null modem cable from the PC running the Encoder program. Continue configuring this COM port for 9600 baud, 8 data bits and no parity.
  9. Next set the AXIS resolution in the planetarium software both x and y, these settings should be the same as those set on the command line for Encoder running on the other PC.
  10. Now start or initiate communication on the planetarium software (the planetarium PC should now be communicating with the PC running Encoder) and see that the two PC communicate without error.
  11. Most planetarium software will now take you through a two star alignment (usually Polaris and Capella, practice finding them) for calibration after which the system is ready to track the telescope movement and locate objects.

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 jrock@ixc-comm.com if you have any problems, don’t 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 (I’ll help if I can, but Dan is the real expert here), his Email address is dstixrud@worldaccessnet.com.

 

Back to Canned Mouse

AmSky