A Smart "Barn Door" Drive for Astrophotography

My senior year in college, the northern hemisphere was treated to the most spectacular comet of the last four decades: Comet Hyakutake. On the night of its closest approach, the tail stretched so far across the sky that one had to move one’s head around to take it all in. Unforgettable.

The following year, with another bright comet (Hale-Bopp) in the news, I decided to build a tracking mount for my trusty Minolta SRT-101. My untracked photos of Hyakutake had not done the comet justice; the exposures were too short.

If one mounts a camera to a sturdy tripod and opens the shutter for several minutes, the developed picture will be trailed, with every object in the frame creating a short or long streak depending on the length of the exposure and the part of the sky being imaged. Because of the Earth’s motion, the positions of the stars shift during any long exposure, thereby limiting the practical exposure time for a fixed camera. This limit works out to around 30 seconds for a normal wide-angle lens. Of course, very long exposures exploiting this effect have their own artistic appeal, but
accurate images of a particular object (like a comet) will not be possible.

To counteract the Earth’s rotation and allow longer exposures, some kind of drive system is needed. If an equatorially-driven telescope is available, it can provide the tracking with the camera mounted “piggy-back” on the side. For beginning astrophotographers seeking a more economical approach, a “barn door” mount is a simple way to track a camera for wide-angle pictures.

Barn-door geometry

The simplest barn-door drive consists of two pieces of wood, hinged at one end. One piece is mounted to the tripod and has a threaded rod going up through the end opposite the hinge.

Basic barn-door configuration

Basic barn-door configuration

This drive screw is turned by hand at regular intervals, or driven by a motor, to gradually push the boards apart. If the hinge axis is aligned with the north celestial pole, very near the star Polaris, a camera riding on the top board will have the Earth’s motion canceled out, resulting in sharp images of the sky. This basic configuration is sometimes called a tangent arm drive, because the drive screw and the boards form a right triangle. If the screw is turned at a constant rate, errors accumulate rapidly.

Isosceles drive

Isosceles drive

A popular variation is the isosceles or single-arm drive. Here the screw screw is pivoted at both ends, forming an isosceles triangle as the boards open. In published designs, the screw is almost always driven at a constant rate using a stepper motor and an oscillator/divider circuit built from standard CMOS logic. Some simple math shows how the angular velocity of the mount is related to the motion of the drive screw:

\[ \sin(\theta/2) = \frac{L/2}{x}\\ \theta = 2 \arcsin\left(\frac{L/2}{x}\right)\\ \omega = \frac{d\theta}{dt} = \frac{dL/dt}{x\sqrt{1 - L^2 / 4x^2}} \]

In other words, the angular velocity of the mount, omega, will not be constant when the drive screw is turned at a constant rate yielding constant \(dL/dt\). The approximation to perfect tracking is much better than the tangent-arm drive, but significant errors will accumulate after a few minutes.

A Smart Barn Door

To further reduce tracking errors, a mechanical scheme involving multiple boards and hinges has been used[1]. If the dimensions are chosen correctly, the sine approximation errors in this system will mostly cancel out. While interesting, this is not appealing to an electrical engineer. Anything mechanical is hard, or at least harder than circuits and software, so why not take the easy way out and vary the speed of the drive screw, counteracting the errors in the single-arm drive? This may be accomplished with a single-chip design (a microcontroller), making the electrical construction no more difficult than the classic circuits designed around SAA-xxxx chips.

Suppose we pick \(L = L(t) = 2x\sin(at)\), where \(a\) is some constant. Now,

\[ \theta = 2\arcsin\left(\frac{2x\sin(at)}{2x}\right) = 2at \]

and the boards are opening at the hinge at a constant angular rate — just what we need. Notice that \(dL/dt = 2ax\cos(at)\), indicating that perfect tracking is achieved when the drive rate slows down over time.

Mechanically, the smart barn door uses a single-arm (isosceles) design, as this is easy to build and can track longer before running out of screw length. For the control circuit I used an 87C51FA microcontroller (an EPROM version of Intel’s popular 8051); any other 8051 derivative should work with the same or very similar assembly code and only minor circuit changes. Four of the port 3 pins are used to drive NPN darlington-pair transistors of sufficient power-handling ability to energize the four windings of a unipolar stepper motor. Three of the port-1 pins control status LEDs, and four more serve as switch inputs.

Schematic diagram

Schematic diagram

The drive-screw speed, and thus the stepping rate of the motor, must be varied according to a sine function, and this poses an implementation challenge. Any sort of extended-precision or fractional arithmetic would be work to implement on the 8051. A data table with timer values for each step was considered, but there was not enough memory for the thousands of steps needed over the course of a few hours.

Because a performance simulation in MATLAB was desired anyway, a unique solution was developed: The simulation was used to generate the needed tracking corrections for a chordal approximation to the ideal sine-curve drive rate. In this approach, the stepper motor is started at some initial rate, then the time between steps is increased or decreased only as needed to keep the tracking error within specified bounds. As the simulation runs, it also stores the speed corrections to a file. Each correction consists of two numbers: a step number (counting from zero with the two boards fully closed) and the new stepping interval in milliseconds. Here are the first few data points from one simulation run:

        .word   1474
        .word   254
        .word   1616
        .word   253
        .word   2998
        .word   254
        .word   3153
        .word   253

Source code

  • MATLAB simulation script
  • 8051 assembly program

As long as the software keeps track of the number of steps executed since the closed position, it knows the proper stepping interval. Because corrections are relatively infrequent, especially near the start of tracking, the required data table size is quite small. Best of all, the simulation results from which these numbers are derived guarantee an arbitrary level of accuracy. Of course, tracking errors from mechanical imprecision and less-than-ideal polar alignment will dwarf those based on geometry and timing alone. The best that can be said is that the smart barn door has no inherent error.

Another interesting plot is the graph of stepping interval versus time. Although one might initially expect the stepping interval to increase monotonically, quantizing it to one-millisecond units requires back-and-forth dithering. This is analogous to pulse-width modulation, and the gradually changing “duty cycle” of the trace can easily be seen.

The user interface of the tracker is simple and follows a cassette-tape-player metaphor. Four switches are used in the usual orientation for rewind (a fast reverse drive to prepare for another exposure), stop, play (normal tracking operation), and fast forward. The barn door mount is smart enough to automatically slow down and stop when it is in fast reverse mode and the end of travel is reached with the boards touching.

Should the mount lose synchronization, i.e. if the software thinks it is at step zero when the two boards are not touching, tracking error will result. Errors will also result from any difference between the simulated and actual board lengths.


The smart barn door has several advantages over the more common designs currently used by amateur astrophotographers: a lower chip count, easier availability of parts (no special stepper motor driver IC), less weight than a double-arm design, and programmable flexibility for future changes. In theory, more elaborate corrections could be added for things like atmospheric refraction, but the virtual elimination of geometric error already makes this mount’s accuracy completely dependent on mechanical imperfections and polar alignment.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.