One particular night, after a few weeks of not using my telescope, I
found out the hard way why the 6v EQ-5 hand controller should not be connected
to 12v by accident. It only took, literally half a second to kill my hand
controller. After some examination it became obvious that I had destroyed
the large 40 pin micro controller, the "brains" of the handset.
Upon further examination it became obvious that the controller has no form
of either, overvoltage protection or reverse voltage protection. It doesn't
take much to kill that chip.
So I thought, surely if the hand controller
is that easy to destroy, a simple Google search would reveal a source of
either replacement hand controllers or even better (thinking of the environment)
just the programmed micro controller. It turns out that you have to buy the
lot, at full price. The hand controller and steppers, everything!
Well, I thought... there must be another way! And I am happy to say there is. Build your own hand controller. I could even protect it from over voltage, unlike the poxy standard chinese hand controller. The only down side was I had to learn to program a micro controller from scratch. Using a 555 timer circuit wasn't an option because the stability of the 555 isn't accurate enough. However a PIC micro controller running off a 4MHz crystal ought to be quite accurate.
The image opposite is the hand controller I came up with.
The project box and switches etc you choose use are entirely
up to you. I chose these because they are what I had to hand. If you don't want to get into PIC micro controller programming then I can supply the PIC's at £7.00 each fully programmed up. The price includes postage and packaging. Contact me at astro(dot)bloke(at)ntlworld(dot)com for more details. I have a pay pal account or I will accept a cheque. Alternatively you could get a friend to program you chip for free if they have a PIC programmer. |
The image below shows the functions of the hand controller.
You are
able to select the slew speed. These are faster than the standard hand controller.
The source code is available if you want to change this speed. If you ask
nicely I might provide a second HEX file with a different slew rate for
the switch positions. There are Slew buttons provided for each direction
and also a stop button which will stop the RA drive.
I have also provided
two switches to swap the directions of the slew buttons. One for DEC and
one for RA. These are useful if, for example, you swap from using an eyepiece
to webcam imaging, flick the switches and the buttons move the object in
the direction you expect. It also allows you to use the controller either
way up according to your preference. Please note that the RA direction switch
does not affect the RA drive direction.
I decided at the beginning to use two PIC's. One for the RA drive and one for the DEC drive. The main reason for this was that the RA drive timing has to be accurate. If I have to start running DEC code on the same Chip as the RA drive, it would be very difficult to keep the timing right. Over and above this, there simply aren't enough in/out pins to go around on a PIC16F627.
Here is the circuit diagram.
I've
split the diagram into three parts, hopefully that way it is easier to read.
The RA Drive, the power supply and the
DEC drive.
The RA drive
circuit and the DEC drive circuit are essentially the same. However the DEC
circuit omits the crystal oscillator. This is because timing isn't critical
for the DEC drive, I've used the PIC's internal 4MHz oscillator instead.
Note: that the internal oscillator of the PIC16F627A is also 4MHz.
The
DEC circuit also omits the indicator LED.
The basic circuit consists of the PIC micro controller and a L293D which is an H-bridge driver. There are very few extra components needed for the circuit to work.
The stepper motors supplied with the EQ-5 drive are bipolar. This means
that they have 4 wires connected to two coils. To drive the motor, step
by step the coils have to be exited in the right order. For a bipolar
motor this involves reversing the voltage across each coil in the correct
order. Rather than me reinvent the wheel, take a look at this document for
the L297 stepper driver for more information about how this is done. To
reverse the voltage across the coils requires a circuit called an H bridge
driver. Fortunately for me there is a relatively simple H bridge driver
readily available in the form of the L293D. The
L293D documentation is available here. The L293D has 6 inputs, 4 are
the logic inputs that determine how the coils are driven and the other 2 determine
whether the coils receive any current at all. They are the enable inputs.
Enable 1 is associated with inputs 1 and 2. Enable 2 is associated with
inputs 3 and 4. Also make sure you get the D version. This has diodes that
route the back EMF from the motor coils safely away from the sensitive electronics
of the chip. without these you would need to add the diodes to the circuit.
The
PIC micro controller is used to supply the correct logic to the six inputs
to the L293D, to drive the stepper motor at the correct rate.
There are three ways to drive a bipolar stepper motor. They are
shown below.
Two Phase drive: All the coils are always enabled.
This is the method I initially chose to use, I've since produced a half
step version of the code. Two phase has the advantage of the simplest
logic because the enable is always, err... enabled. It also provides the
highest torque for the motor. The disadvantage is that it uses more power
and runs the battery down more quickly.
|
|
Wave Drive: This method only energises one coil at a time. It creates less torque than the two phase method, the advantage being that it also uses less power so you batteries last longer.
|
Half Step: This is a combination of the Two Phase and Wave Drive methods. It doubles the number of steps by halving the distance the motor travels per step. The advantage is that the motor turns in a less jumpy manner. This ia a good way to run at the RA drive rate. I have now implemented this in code. The RA rate uses half step, while the slewing uses two phase. It also uses a little less power than the Two Phase method without any major sacrifice to torque.
|
At last what you've been waiting for. Here first of all, is a component list. You need:
PIC16F627 (or PIC16F627A) x2 |
Pinout for the PIC16F627(A) |
The Circuit board.
The diagram below shows how I wired up the circuit onto veroboard. Be careful to note the orientation of the chips. I also went a little overboard with the 0v to the L293D, you may omit, if you wish some of those links.
The Yellow circles are external connections to the circuit board.
The only thing missing now is the code. Well here it is. I have included the hex files needed to program the chips and the source code if you want to have a go at modifying the code for your own purpose.
Hex Code...
Click here for the RAdrive Code
HEX file. (Northern Hemisphere)
Click here for the RAdrive Code
HEX file. (Southern Hemisphere)
Click here for the RAHalfdrive Code
HEX file. (Northern Hemisphere - Half Drive)
Click here for the RAHalfdrive Code
HEX file. (Southern Hemisphere - Half Drive)
Click here for the
DECdrive code HEX file.
Source Code...
Click
here for the RAdrive source code TXT file. (Northern Hemisphere)
Click
here for the RAdrive source code TXT file. (Southern Hemisphere)
Click
here for the RAHalfdrive source code TXT file. (Northern Hemisphere
- Half Drive)
Click
here for the RAHalfdrive source code TXT file. (Southern Hemisphere
- Half Drive)
Click
here for the DECdrive source code TXT file.
If you do make an improvement to the code, send it to me and I'll feature
it here.
the address is astro(dot)bloke(at)ntlworld(dot)com
You should now have enough information to make the controller. As added information I have also included some images of my controller in the hope that this will also help you. Note: I used CAT5 cable and then split the cables to the steppers from an RJ45 connector. This allows me to work from further away from the telescope.