These instructions have been written for the benefit of those who have obtained a PC board and microcontroller chip from FAR Circuits for my digital setting circles interface circuit. The remaining parts needed for this kit are inexpensive and are readily available from a variety of sources. If you have any electronic construction experience at all, you should find this interface to be easy to build. If you have questions or problems, please contact me and Ill help as best as I can.
See my software page for a list of software packages known to work with my interface.
All the parts can be obtained from Jameco, but I recommend that you purchase the 4 MHz oscillator from Mouser Electronics instead. Ive seen two of the oscillators provided by Jameco cause trouble. The FOX oscillators from Mouser seem to work more reliably.
Encoder interface parts list.
|Component||Description||Jameco Part No.|
|U1||7805 voltage regulator||51262|
|U2||Programmed PIC16F84/04P microcontroller chip||145111|
|18-pin socket for U2||112230|
|U3||MAX232CPE RS-232 level converter||24811|
|16-pin socket for U3 (optional)||112221|
|C1, C4-C7||10uF 35V electrolytic capacitor||94369|
|C2, C3||0.1uF monolithic capacitor||25523|
|R1-R13||10K-Ohm 1/4 watt resistor||29911|
|D2||LED (any small LED will do) (this and R13 are optional)||94511|
|OSC1||4 MHz TTL crystal clock oscillator||Mouser Stock Number 559-F1100E-400|
|Switch (not shown on schematic)||Normally open momentary SPST pushbutton for a reset switch (optional)||164654|
Feel free to substitute your own preferences for the connectors, but I highly recommend that you do not wire the encoder or serial cables directly to the board (theyll break off easily). Use pins and connectors for a sturdier connection. The right-angle DB9F connector for the serial cable is especially good for ensuring a good connection.
Some recommended connectors for the interface PC board.
|Description||Jameco Part No.|
|0.1" non-polarized connector housing (5-pin) for connecting to the encoders||163686|
|0.1" non-polarized connector housing (4-pin) for attaching encoder cables to PC board||100802|
|D-Subminiature right-angle PC mount DB9F connector||104977|
|Female connector pins for housings||100765|
|0.1" right-angle headers (male pins board-mounted over which the housings fit)||103270|
|Pin crimping tool for crimping the female connector pins||99442|
|4-conductor cable (phone wire) for encoder cables||103430|
These diagrams are not drawn to scale. If you want to make your own board, download this file. See the readme.txt file in that file for further information.
PC board parts layout.
PC board foil side layout.
Note: you can purchase a preprogrammed PIC16F84 microcontroller chip--go here for details. The PIC16F84 microcontroller chip requires a bit more attention than simply buying one and popping it into the circuit. First, it must be programmed. A hardware device called a programmer is required for this task. Luckily, this particular chip can be programmed with very simple-to-build hardware. I'm not going to go into details about programming the chip because there is a ton of information on the web about this topic. I will mention that the Oct 98 issue of QST magazine contained an article titled "Using PIC Microcontrollers in Amateur Radio Projects," by John Hansen (p. 34)--this was the article that got me started on this project. If you choose to program the chip yourself, the firmware file you need for this project is dsc.hex.
My interface is capable of working with encoder setups having up to 65535 tics per revolution of the telescope axis. Frankly, a resolution that high is overkill and runs the risk of dropping counts if the telescope is moved quickly. I usually encourage builders to choose encoders that result in somewhere between 4000 and 10000 encoder tics/rev, factoring in any gearing or pulley systems that are used to connect the encoders to the telescope. My own setup uses about 4500 tics/rev for each axis, and I haven't been able to make the interface drop a count. I usually recommend the S1 or S2 encoders from U.S. Digital. You don't need the index or ball-bearing options.
Connecting encoders to your telescope can be a challenge, depending on the design of your mount. Unfortunately, I can't offer much in the way of help, since the mounts vary so widely. There are links to some illustrated digital setting circle projects on my links page that might be of help. Regardless of the type of mount, it's important that your encoders always turn whenever the telescope moves, whether manually or by a drive motor.
Construction of this interface is quite straightforward, but there are a few issues worth considering prior to starting. First, this interface has a number of external connectionsthe serial cable, the encoder cables, and the power supply. Some thought should be given to exactly how you intend to make these connections so that they are solid and reliable. Ive designed the PC board so that you can install 0.1" male headers at the encoder and power connections, and use 0.1" connector housings with crimp pins on the ends of the cables. This sort of arrangement is much stronger and more reliable than soldering the wires directly to the board.
Similarly, the serial connection is laid out so you can use a straight or right-angle pc-board-mount DB9 connector. Pins 1, 4, and 6 are connected via traces on the circuit board, as are pins 7 and 8, to accommodate software that expects serial handshaking to be implemented. If you only use the connections for pins 2, 3, and 5 on the board, make sure that you connect pins 1, 4, and 6, and pins 7 and 8, at some other point in the cable to achieve the same effect.
Its very important to make sure that you make the encoder connections correctly. The encoder connections are labeled on the PC board for each of the two encoders. There are typically five pins on an encoder, labeled Ch. B, +5V, Ch. A, N/C, and GND (see Figure 1).
The above figure shows pin 2 to be labeled Index rather than GND. This encoder interface circuit does not use the index signal. If your encoders have index pins, leave those pins unconnected.
Similarly, the interface PC board has five holes for connecting each encoder, with the same labels. On the PC board, the N/C hole for each encoder is connected to the GND hole next to it. This allows you to use a four-pin male header and connector housing rather than a five-pin, if you desire (if you use a four-pin connector, mount it in the holes for Ch. B, +5V, Ch. A, and N/Cthe N/C hole will serve as your ground and should connect to the GND pin on your encoder).
There is also a place on the PC board for connecting a reset switch. Its labeled "RESET" and is located between C7 and R11. If you use a reset switch, it should be a normally-open momentary SPST pushbutton switch. Pressing and releasing it restarts the software in the microcontroller. If the interface is not functioning correctly, resetting it will usually fix the problem.
Construction of the interface is not difficult. The parts may be placed on the board in nearly any order. Make sure to note the polarity of the diodes, the electrolytic capacitors, the ICs, the voltage regulator, and the oscillator.
The order in which you install the parts isnt critical. Heres what Id recommend. The parts layout on the PC board is reproduced for you in Appendix C for convenience.
Check all your solder joints. They should look smooth and shiny. If they dont, give them a bit of heat with the iron to remelt them. Also, check for solder bridges (solder connecting two points that should not be connected).
The basic approach to testing the interface is to hook everything up and see if it works. You can use this QBASIC program to test your interface. Be sure to change the program to use the correct serial port if youre not using COM1. Alternatively, you can use a communications program such as Hyperterminal on your PC to test the interface. Connect your interface to your PC and configure Hyperterminal to talk to the correct COM port using 9600 baud, 8 bits, 1 stop bit, no parity, and no flow control (handshaking). Then, in Hyperterminal, type Q (note that it won't appear on your screen unless you turn local echo on, because the interface doesn't echo the characters sent to it). You should see "+00000 +00000" appear. If so, the communications are working correctly. Next, if you have encoders connected to your interface, turn each encoder a little and type Q again. The numbers that appear on your screen should now be nonzero. If they're still zero, check your encoder connections.
If the interface doesnt appear to be working properly, first check all the connectors to make sure that they are properly connected and that they are firmly seated. Next, make sure that youre supplying the interface with power. A 9V transistor battery is sufficient to power the interface, but it must be a fresh battery. You can also use other voltage sources, but make sure that the voltage is at least 9V (but preferably no more than about 15V) and capable of supplying 50 mA of current on a continuous basis. Nearly all battery configurations that result in 9V or more can supply this moderate amount of current. If possible, measure the output of U1, the voltage regulator, to verify that its supplying 5V to the rest of the circuit (you can measure this at pin 14 of U2).
If youre still having trouble, verify that all the parts have been installed with the proper polarity. Pay special attention to the orientation of U2 and U3the circuit will not work if either of these is installed backwards. Also, if you have an oscilloscope or frequency counter, see if you can detect the 4 MHz clock signal coming from OSC1 (check at pin 16 of U2).
If everything's installed correctly, flip the board over and double-check all your soldering. Bad or missing solder joints are the number one cause of problems in this project. Also check for solder bridges that connect things that shouldn't be connected. Your solder joints should appear shiny and smooth and should completely cover the hole and surround the part leads. Use just enough solder to make the joint, but no more. If you don't see any obvious solder problems, heat up your iron and reheat each solder joint, and try again.
My software page describes how to use my interface with the software packages that support it.
Contact me if you need assistance or have questions. Ill do my best to help.
If you wish to modify the circuit or the embedded software, I can provide you with the source files you might need. The circuit diagram and PC board layout were done with a freeware package called Eagle Layout Editor (the lite version) from CadSoft USA. The embedded software was written using Microchips MPLAB software (another freeware package). Contact me for details.
Last upate: 8 Aug 2004