Why make your own Arduino control system?
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.
DC motors or Stepper motors
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.
Why ASCOM with Arduino
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.
What is the hardware?
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.
What does my Arduino software actually do?
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
- First the DS1307 real time clock module is consulted by the Arduino to get the current local time.
- Arduino then uses the known longitude of the observatory to calculate the local sidereal time.
- Knowledge of the target RA is then used to find the required Hour angle.
- The required hour angle and declination are then used to calculate the required shaft angles.
- There are around 80000 encoder ticks per degree – so we can find the required encoder tick target
- Signals are then sent to slew the motors at full speed until the required encoder tick count is reach, slowing down and stopping at the correct place
Beyond this core, a whole range of other functions are implemented in the arduino including
- Parking the telescope when finished
- Emergency shut down
- Syncing the pointing to a known star
- Periodic error correction of the transmission gears (PEC)
- Local monitoring of temperature and humidity.
- Finding a home position (using Hall sensors)
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.
Can I download your Arduino source code?
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 [email protected] and will happily share a section of the code if it helps you with your project.
However, I do give instructions on how to write it yourself here in my guide for writing Arduino telescope controllers
Source: The DIY Arduino Telescope GOTO control project