Before starting this project, I had no idea about servo or stepper motors. I required a motor that:
- Could provide sufficient torque
- Is either extremely accurate(~0.01 degrees)(no motor is this accurate) or can be attached to a reduction gear to make it really accurate
- Is not very expensive
So I did some research on the internet, and found that stepper motors fit the description perfectly. A servo motor comes close, but to get the required accuracy, it would have to involve digital encoders. This made it much more expensive.
I thus used stepper motors for both axes of the telescope. For the altitude axis I used a 200 step bipolar stepper motor with max. torque 10 N-cm and for the azimuth axis, I used a high power 200 step stepper motor with max. torque 90 N-cm.
BH57SH56-1006A BHOLANATH PRECISION ENGINEERING
14PM-M201 MINEBEA CO.
Controlling a stepper motor is more complicated compared to a regular DC motor. A two phase stepper motor(like the one I used) has two stator coils that rotate a rotor magnet. By controlling the current through the 2 coils, one can control the direction and number of steps that the motor rotates. The following table gives the pin states to rotate a 2 phase stepper motor. When the order of the logic states is followed top to bottom, the stepper moves clockwise and when the order is reversed, the stepper moves counter-clockwise.
I made a motor driver circuit using a dual H-bridge IC(L298). These motor drivers receive input from the arduino microcontroller and amplify these signals to provide power to the motor.
While testing the motors, I found a glitch in the arduino library function myStepper.step(int). When I entered a command to move the stepper a number of steps that is not a multiple of four, the stepper would become unreliable. It would skip the first step or go backward for the 1st step and then go forward for the rest. So I wrote my own function to rotate the motor. The problem in the library function was that every time the function was invoked, it would start from state 1 (refer to table) regardless of which state it was in previously. Thus, I fixed the glitch by defining a global variable in the program that would store the value of the state the motor was in, so that the next time the function is invoked, it steps correctly and reliably.
The lesson I learnt was not to depend on something without verifying if it works reliably. It sounds simple, but I took it for granted. This little glitch had crippled my telescope’s tracking function as, in the tracking mode, the stepper had to move only 1-2 steps at a time.