Projects Research & Design Hub

Field Derotator for Astrophotography (Part 2)

Written by Cheng-Yang Tan

The Process of Building a Field Derotator

This month, Cheng-Yang Tan explains how he built a field derotator. He details the design of the Arduino-based system, which includes a controller module. He also covers the user interface that he uses to remotely control the design.

  • How to to build a field derotator for astrophotography

  • How to build the controller and driver modules

  • How the set up the gears

  • CC3000 WiFi Shield and RGB LCD Shield Kit from Adafruit

  • DRV8825 Stepper motor driver and Sanyo Pancake Motor from Pololu

  • US5881 Unipolar Hall Switch from Melexis

In the first part of this article series, I detailed how a field derotator worked and explained my motivation for building one. My design consists of two parts: the controller and a mechanical derotator. I required the controller to act either as the interface between a computer and the derotator or it could operate in stand-alone mode. The project required the controller to have a microcontroller with enough memory and speed to execute user commands and to perform the required corrections. Based on these specifications, I decided that the Arduino platform would be perfect for building the controller. On the mechanical side, I used as many standard parts as possible. For parts I couldn’t find, I used eMachineShop and Pokono for fabrication.

DEROTATOR SYSTEM

Figure 1 is an overview of the field derotator system. You can run the field derotator in two ways. In non-standalone mode, the user controls the derotator by using a GUI to send commands via Wi-Fi or serial line to the controller. In standalone mode, the user selects commands from a set of menus on the controller to send to the derotator. In both cases, I have the controller calculate the corrections for the derotator to carry out. I designed the controller to query the required information for derotation directly from the Meade Instruments LX200 telescope rather than from the user. This is advantageous because real-time pointing information can be incorporated into the correction algorithm, which, in effect, improves the accuracy of the corrections.

Figure 1 This is a block diagram of the field derotator system. The user interface that runs on a computer is optional because the controller is capable of running in stand-alone mode.
Figure 1
This is a block diagram of the field derotator system. The user interface that runs on a computer is optional because the controller is capable of running in stand-alone mode.

For the derotator, I have it receive the step commands from the controller so that it can make the stepper motor step at the correct time and rate. The stepper motor’s angle per step is too coarse and has to be reduced with gears. I discuss the details of how I selected the gears for step reduction below. I also designed a magnet into the final drive gear and added a Hall switch so that an accurate and reproducible hardware home position can be defined. This is a useful feature that allows the user to always be able to set the imaging camera to a known home position for initialization.

CONTROLLER & DRIVER MODULES

I built the controller around an Arduino MEGA 2560 because it has the horsepower to perform both the corrections and execute user commands at the same time (see Figure 2). An advantage is that the Arduino ecosystem is actually quite mature and there are many shields from different manufacturers to choose from. For the controller to run in stand-alone mode, I have an LCD menu system that’s navigable with buttons. I found the Adafruit Industries RGB LCD Shield Kit fit the bill. The best part is that there’s already an API, which means I didn’t need to write driver code for the MEGA 2560 to talk to it.

Figure 2 The controller's block diagram shows the devices that are connected to the Arduino MEGA 2560 and the pins that are used.
Figure 2
The controller’s block diagram shows the devices that are connected to the Arduino MEGA 2560 and the pins that are used.

When not in stand-alone mode, I use Wi-Fi to send commands to the controller. This is a nice feature because I want to be able to control everything from inside the house. I added an Adafruit Industries CC3000 WiFi Shield for this purpose. The other way to send commands to the controller is via the USB serial port that already exists on the MEGA 2560.

For communications with the derotator, I designed a board—named “controller module”—that takes the step signals from the MEGA 2560, buffers them, and sends them through a cable to the driver module that contains the stepper motor driver. Besides the stepper motor driver, the driver module also sends a buffered Hall trigger signal back to the MEGA 2560 that tells it whether the derotator has found the home position. Lastly, the controller module contains the RS-232 level conversion circuitry that allows the MEGA 2560 to talk to the LX200. Figure 3 depicts the controller module’s circuitry. As you can see, it is basically a buffer I/O board.

— ADVERTISMENT—

Advertise Here

Figure 3 The controller module
Figure 3
The controller module

The first purpose of the driver module is to take the buffered step pulses from the controller to drive the stepper motor. Instead of designing the stepper motor driver from scratch, I designed the driver module circuitry around a Pololu DRV8825 stepper motor driver module. The second purpose of the driver module is to send a buffered Hall switch (Melexis US5881) trigger signal back to the controller. The Hall switch is activated when the magnet on the final gear of the derototor is at the same location as the Hall switch. I added this feature so that a home position can be defined accurately. The derotator module’s circuitry is depicted in Figure 4.

Figure 4 The driver module
Figure 4
The driver module
BUILDING THE MODULES

I used surface-mount components in the two modules to save space, especially for the driver module. I chose the 1206-sized SMDs for the resistors and capacitors because I have found this size to be the easiest to handle and solder by hand. As for laying out the PCBs, I found the controller module to be the trickier of the two. I had to make sure that the module’s pinouts matched up with the MEGA 2560 headers. Unfortunately, despite my best effort, I actually screwed it up and I had to perform in situ cutting and rewiring of the board to get it right. (I fixed the error in the PCB layout files that are posted at https://github.com/cytan299/field_derotator.) As for the controller module PCB’s physical shape, it was also trickier than usual. I needed an odd shape because I designed it to be soldered directly onto the WiFi Shield; in addition, it also had to be the correct length so that sockets for the cables that go to the driver module and the serial line to the LX200 would be flush to the edge. Fortunately, I measured twice and cut once for this part of the design. The header pins matched up with the holes, and the sockets were flush with the edge. Success!

As for the driver module PCB layout, the only constraint was that I wanted to fit everything on a 1″ × 2″ PCB. After minimizing the separation between components as much as possible, I managed to do just that. Photo 1 shows the controller and the driver boards after I had soldered on all the parts.

Photo 1 a—The controller module soldered onto the Wi-Fi shield and inserted into the MEGA 2560. Notice its odd shape. b—The driver module that is installed on the mechanical derotator.
Photo 1
a—The controller module soldered onto the Wi-Fi shield and inserted into the MEGA 2560. Notice its odd shape. b—The driver module that is installed on the mechanical derotator.
MECHANICAL DEROTATOR

My entire motivation for building the field derotator, besides the fact that I needed it to correct the field rotation, was that I just could not find one that would fit on my LX200 when my JMI electric focuser is attached. It would have been a lot less of a hassle and a lot cheaper to buy one off the shelf. Alas, that was not to be and if I wanted one, I had to build and design one from scratch.

For the derotator to fit this space, I must have one of its dimensions be less than 3.25″. (Technically, it is 1.625″ from the optical axis to the edge of the focuser.) This constraint limits my choice of gear sizes for the gear train and their arrangement. Besides the size constraint, I also wanted the derotator to be as light and as thin as possible. This was because I wanted to minimize both the stress on the LX200’s alt-az drive train from the extra weight and the back focus from the extra length. Thus, my goal was to keep its weight to between 1 and 1.5 lbs and its width to between 1″ to 2″.

CORRECTION SIZE

Since I use a stepper motor to perform the corrections, these corrections can only be done in discrete steps. Therefore, to design the gear train, I had to know the size of the correction per step that was compatible with my camera. I can derive the equation that relates the maximum step angle qMAX to the size of each pixel dP and the CCD horizontal and vertical size (DX, DY):

 [1]

N × dP/2 is my assignment of the full-width half-max value (FWHM) of the star image intensity (assumed to be Gaussian) to n pixel samples and then limiting the motion of the peak of the intensity by half that number. The denominator comes from the fact that the largest position change from any rotation is always at the location that is farthest from the center of rotation (i.e., at half the diagonal length of the CCD). For example, when I substitute in the parameters of my camera, the SBIG STF-8300C, I get:

 [2]

To set the value for n, I can apply the Nyquist Sampling Theorem. The theorem states that the minimum number of required pixels needed to sample the star light intensity, assumed to be a 2-D Gaussian distribution, is 3.33.[1] Since I cannot have 1/3 pixels, I set n = 4, and thus:

 [3]
GEARS

I used a Sanyo pancake stepper motor that is specified to have 1.8 (31.4 mrad) degrees per step. This is clearly much larger than qMAX that I have calculated in Equation 3. So, to reduce this number, I have to introduce gears that go between the stepper motor and the camera.

— ADVERTISMENT—

Advertise Here

In principle, there exists an infinite number of combinations of gears for any rational reduction factor. But in practice, and to save costs, I am constrained to commercially available gears. Furthermore, I have to keep in mind that the diameter of all the gears are constrained by the 3.25″ that is available for the derotator.

My final arrangement of the gears is shown in Figure 5. (I used Abel Vincze’s free web app, Gear Generator, to generate the figure.) I selected standard commercially available spur and pinion gears. Their sizes and pitches are also summarized in Figure 5. Note that the final gear, GD, has an outer diameter of 3.156″, and this is the largest gear that I can use because the next size up is larger than 3.25″. It is necessary to use a compound gear made up of GB and GC to do step reduction. I made the compound gear by gluing them together onto a brass tube. My friends D. Johnson and J. Larson modified GB and GD.

Figure 5 These are the gears arranged so that the step-down ratio is the value in Equation 4.
Figure 5
These are the gears arranged so that the step-down ratio is the value in Equation 4.

From the numbers in Figure 5, I can calculate the step down ratio ρ with these gears:

 [4]

TI is the number of teeth of gear GI with i ∈ {A, B, C, D}. Thus, ρ tells me that one turn of the final gear GD requires 30.1471 turns of GA.

Finally, since the stepper motor needs 200 steps to make one turn, the step size qSTEP of my derotator design is thus:

 [5]

This is the same value as qMAX that I had found in Equation 3.

I want to have a consistent and reproducible home position on the derotator so that I can always set the camera to a known position. I did this is by inserting a small cylindrical magnet into the drive gear GD and installing a Hall sensor to one of the shells of the derotator. When the magnet is at the Hall sensor, an interrupt signal is generated and sent back to the MEGA 2560 to tell it that the home position has been found.

CORRECTION ALGORITHM

The correction that I have to apply essentially takes out the accumulated field rotation angle ζ in time T:

 [6]

Ω is the Earth’s angular rotation frequency. η(t), ξ(t) are the alt-az coordinates of the object that the telescope is pointing to at time t. fLAT is the latitude of the location of the telescope.

Since I can only make corrections every ζ = qSTEP, I have to integrate to this value before sending out a correction. The integration can be done numerically by approximating the integral in Equation 6 as a sum:

 [7]

As long as each time step dtJ « tSTEP, where tSTEP is the time required to accumulate qSTEP, N time steps to get to tSTEP, and tJ = tJ – 1 + dtJ with t0 = 0.

In order not to have dtJ set to a fixed value, I created a predictor/corrector method for calculating dtJ. I can do this because I can predict tSTEP by making an approximation:

 [8]

From this value, I found that dtJ = tSTEP/4 works well. For this method to work, I need to know where my telescope is actually pointing to at time tJ, and that is why I have to query the LX200 every time I perform this calculation.

Figure 6 depicts the correction algorithm that resides in the MEGA 2560. The MEGA 2560 is fast enough to execute it as well as handle all the user requests from the menu selector on the controller or from Wi-Fi and serial line.

Figure 6 This is an abridged flow chart of the correction algorithm
Figure 6
This is an abridged flow chart of the correction algorithm
THE GUI

I really hate writing GUIs, and I’d usually write command line programs to do what I wanted. But in this case I had to relent because it was a necessary evil for controlling the field derotator over Wi-Fi. I could have made the GUI in Cocoa, but that would have confined it to the Mac platform and probably would not have benefitted the astrophotography community as much. Thus, I needed to select a cross platform GUI library.

— ADVERTISMENT—

Advertise Here

wxWidgets (www.wxwidgets.org) and Qt (www.qt.io) are two major free cross-platform GUI libraries. Both, in my opinion, are larger than what I’m willing to learn or install. Fortunately, I found the Fast and Light Toolkit (FLTK, www.fltk.org/index.php), which is a cross-platform library that is fast on execution and, although small, has enough elements to do what I needed. Best of all, it has a GUI builder called fluid that really speeds up development. The GUI frontend that I designed for the field derotator is shown in Photo 2. This GUI allows me to connect to the controller either via Wi-Fi or serial line. Both connections work identically except that the serial line requires a cable. The serial line is mainly used for setting up the WPA password of the LAN into the controller because I don’t want to broadcast it over the air. Once programming the controller has been set up for Wi-Fi and connects to the LAN, I can control the field derotator anywhere with the GUI. The GUI enables me to control a few things. I can rotate the camera to any angular position, set up rotation limits to protect the camera from obstructions, tell the camera to go to its home position, and start and stop derotation.

Photo 2 The GUI was built with fltk.
Photo 2
The GUI was built with fltk.
RESULTS

Photo 3 shows the installed derotator, which fits in the space that I have. The weight of the derotator is 518 g, or 1.14 lbs, which, I think, is quite light. And its width is only 1.55″ inches from optical connector to optical connector.

Photo 3 a—The completed derotator is installed on the LX200. It fits! b—The controller installed in its case.
Photo 3
a—The completed derotator is installed on the LX200. It fits! b—The controller installed in its case.

As for the controller, I found that most commercial Arduino cases are really ugly, so I designed my own and sent it to Pokono to be laser cut. I am very happy with result because the case makes the controller look like a high-quality commercial product.

The well-known Messier object, the Dumbbell Nebula, M27, is shown in Photo 4. It is the result of stacking seven frames of 240 s of exposure each. The photograph is, in my opinion, quite good despite the sky glow that is in front of my house. What I’m really happy about is that the oblong stars are gone!

Photo 4 This is Dumbbell Nebular, M27, taken on June 28, 2015. It is the result of stacking of seven frames of 240 s each.
Photo 4
This is Dumbbell Nebular, M27, taken on June 28, 2015. It is the result of stacking of seven frames of 240 s each.

The field derotator works very well. I’ve learned that the idea that derotators are hard to use is absolutely false. I designed it so that it is as automated as possible so that the only thing I need to do to start derotation is with the press of a button. With a properly working field derotator, it is also false that an equatorial mount is necessary for long exposures.

Since the field derotator has worked so well for me, I’ve decided to open source all the software and hardware for the benefit of the astrophotography community. All the information that is necessary to build the field derotator is available at https://github.com/cytan299/field_derotator. 

Read Part 1 Here

REFERENCE
[1] S. Moore, “An Informal Information Theory Approach to Astronomical Imaging,” 2013, www.aicccd.com/archive/aic2013/Moore_AIC2013.pdf.

RESOURCES
A 1B 1-Y64016 and S1066Z-064A200
SDP/SI | www.sdp-si.com/eStore/Catalog#
A. Vincze, Gear Generator, http://geargenerator.com.

SOURCES
CC3000 WiFi Shield and RGB LCD Shield Kit
Adafruit Industries | www.adafruit.com
Arduino | www.arduino.cc
ZEQ25 Center-Balanced Equatorial Mount
iOptron | www.ioptron.com
MOTOFOCUS for Meade Cassegrain Telescopes
JMI | www.jimsmobile.com/buy_motofocus.htm#Meade
LX200 Telescope
Meade Instruments | www.meade.com
US5881 Unipolar Hall Switch
Melexis | www.melexis.com
Pyxis Camera Field Rotator
Optec | www.optecinc.com/astronomy/catalog/pyxis/pyxis.htm
OAG-8300 Off-Axis Guider, STF-8300C camera, and ST-i Guider camera
SBIG | www.sbig.com
DRV8825 Stepper motor driver and Sanyo Pancake Motor
Pololu (distributor) | www.pololu.com/product/2298
Nebulosity 4.0
Stark Labs | www.stark-labs.com

PUBLISHED IN CIRCUIT CELLAR MAGAZINE • MAY 2016 #310 – Get a PDF of the issue

Keep up-to-date with our FREE Weekly Newsletter!

Don't miss out on upcoming issues of Circuit Cellar.


Note: We’ve made the May 2020 issue of Circuit Cellar available as a free sample issue. In it, you’ll find a rich variety of the kinds of articles and information that exemplify a typical issue of the current magazine.

Would you like to write for Circuit Cellar? We are always accepting articles/posts from the technical community. Get in touch with us and let's discuss your ideas.

+ posts

About the author
Cheng-Yang Tan earned a PhD in Physics at Cornell University. He is presently employed as a scientist at a US National Laboratory. His professional interests include high current H- ion sources, RF systems, accelerator lattices, high-intensity beam physics, and solving physics problems with high-performance multiprocessor systems.

Sponsor this Article

Supporting Companies

Upcoming Events


Copyright © KCK Media Corp.
All Rights Reserved

Copyright © 2021 KCK Media Corp.

Field Derotator for Astrophotography (Part 2)

by Cheng-Yang Tan time to read: 12 min