After completing my homemade telescope mount it was powered by a Meade DS motor kit. This system was extremely slow, underpowered and unreliable. It was also impossible for me to change the programming or maintain the system. I decided to make my own telescope control system from the ground up and the Arduino platform seemed the obvious choice. This project needed a wide range of inputs and outputs, so has been done using an Arduino Mega 1280 board, although a Mega 2560 would do just as well.
Microcontrollers like Arduino have a fundamental problem with stepper motors. Steppers require constant attention from the Arduino to keep going around. Especially when microstepping. This does not leave a lot of time in the Arduino for performing other tasks. Whilst one would architect this using multiple microcontrollers, such an approach seems silly when a single Arduino Mega has far more computing power that you need. Therefore I chose to use DC motors.
Whilst the Arduino can happily handle all the tasks associated with running the motors and pointing the telescope, in a modern observatory the PC rules. A wide range of astronomy applications are needed for successful imaging. All such applications talk to telescopes using the common ASCOM interface. None of the planetarium etc software I wanted to use knows a damn thing about my Arduino system: Therefore I had to write an ASCOM driver to sit between the Arduino and the application software I needed to use. Fortunately ASCOM Drivers are well templated and easy to write. The video below shows this tool chain in action.
At the heart of the system is a pair of Maxon Motor precious metal brushed coreless DC motors with 512 cpr encoders and 30:1 reduction gearboxes. These motors are a marvel of technology and can rotate extremely slowly under Arduino control with zero magnetic cogging. When tracking the sky, the motors turn at 12rpm.
This combination gives a resolution of around 24 ticks per arc second when reading 4x via the encoder IC.
This is plenty for provide tracking GOTO and tracking accuracy. However, it is a problem when slewing and the tick rate goes up to around 200kHz. Trying to use an encoder with an Arduino at high rates leads to all sorts of problems. For example, the overloaded interrupt lines will corrupt the serial data. For better to use a dedicated encoder counting IC.
Interfacing the motors to the arduino is a simple L298 dual H Bridge driver. The Encoders are interfaced to the Arduino using an encoder counting IC to cope with the very high tick rates when slewing.
The diagram below roughly outlines the high level layout of the system
Please see here for discussion on Arduino PWM
The Arduino Mega 1280 is housed in a box on the telescope. This includes the L298 unit, the encoder counter, various hall sensors for doing PEC and fuses and relays. Arduino can actually turn off the power to the telescope mount itself - handy when you detect an problem.
The Arduino is entirely responsible for running the motors and pointing the telescope. During sidereal tracking, the arduino monitors the tick rates from the encoders and adjusts the PWM signal to the L298 to keep the telescope tracking the sky at the correct speed.
That is a fairly simple task. The complexities arise with GOTO. If my planetarium software wants the scope to GOTO a target, it simply tells the arduino the required RA and DEC.
At his point a bunch of stuff happens on the Arduino
Beyond this core, a whole range of other functions are implemented in the arduino including
There is a whole range of safety monitor routine built into the code to detect if something has gone wrong. If a slew is taking to long, or the telescope is moving to slowly, the Arduino will shut down the power to the mount and then go into sulk mode. It won't let the power come back on until a human has come along and cleared the error bit.
In short, no. The code is closely matched to my telescope and has taken me months of research and development. It is not impossible that this may turn into a commercial project one day therefore I do not wish to share my entire source code.
However I would be delighted to answer questions about the project at firstname.lastname@example.org and will happily share section of the code if it helps you with your project.
However, I do give isntructions on how to write it yourself here in my guide for writing Arduino telescope controllers