Tuesday, November 26, 2013

Beaglebone Black and Astrophotography: Preamble

Background
Astrophotography has many aspects, depending on ones' goals.  In a simplistic categorization, astrophotography can be divided into two classes: wide-field, and narrow field.  In wide field astrophotography, wide angle lenses are used to capture large regions of the sky.  Frequently, digital cameras with large aperture lenses are used, and often tracking systems that match the Earth's rotation are not necessary since exposure times are short.  Photographic systems, be it cameras alone or digital imaging devices attached to telescopes, with smaller apertures may need tracking systems to avoid star trailing and/or to get more detail.  In narrow field astrophotography, typically when imaging faint deep space objects (DSOs), accurate tracking systems to match Earth's sidereal rate are necessary due to the requisite longer exposures.  Cameras need sufficient time (in the order of minutes) to capture enough photons from DSOs to resolve the distant objects, and any movement degrades the image quality.  Therefore, for high quality pictures, a sturdy photographic mount that accurately tracks celestial objects is necessary.  For this, I once built my own "barn door tracker" and got decent results with up to 55mm camera lenses and 60 second exposures.

Telescope mounts come in a few varieties, but the altazimuth (alt-az) and equatorial mount are perhaps most commonly known.  For my purposes, I will be focusing on the german equatorial mount (GEM) found in the Celestron Advanced VX.  For the GEM, an axis of rotation is aligned with the Earth's rotation axis.  If the telescope is then rotated around this axis at the same rate as the Earth's rotation, all objects will stay stationary in the telescope's view.  Accurate alignment with the celestial pole is therefore important for proper tracking, as well matching the earth's rotation speed.  A perfect polar alignment combined with perfectly matched mechanical rotation has the possibility of supporting indefinitely long photographic exposures without star trails.  Unfortunately, this is not possible.  Consequently, shorter photographs that don't exhibit noticeable star trailing are typically taken in astrophotography, and multiple images are "stacked" with computer software to produce an enhanced image.

One way to enable longer photographic exposure times without star trailing is to actively adjust the direction in which the telescope is pointed when deviations are experienced.  In this scenario, a "guide star" is used as a reference point, and the telescope is nudged in whichever direction necessary to maintain the relative position of the guide star in the field of view.  To that end, autoguiders were created - smaller scopes attached to a main scope who's duty it is to keep a guide star stationary in the view.  The autoguiders typically have a CCD (or other digital sensors) linked to a computer that analyzes the position of a star or stars.  If a deviation in position is observed, corrective motor signals are sent back to the telescope mount, often to a dedicated autoguider port, to reestablish the initial alignment.  This system requires an imaging device separate from the main photographic imager as well as an attached computer to make all the adjustments.

Telescope directional control with a microprocessor
Many modern telescope mounts come with attached, handheld control boxes for adjusting the aim of the telescope.  With the advent of "GoTo" systems, the control boxes contain microprocessors with positional information on a large number of celestial objects.  If a telescope mount with GoTo is accurately aligned, for instance a GEM with good polar alignment, a simple press of a few buttons can "slew" the telescope to view stars, planets, and DSOs.  "Hobbiest" microprocessor boards such as the Raspberry Pi have also been configured to control GoTo mounts, allowing for connections to popular software such as Stellarium for slewing.

Long exposure astrophotography requirements
1. Motorized telescope mount
2. Accurate polar alignment (or as accurate as possible)
3. Photographic camera with "Bulb" setting
4. Imaging telescope or long focal length camera lens
5. Guide scope or off-axis guider
6. Guide camera
7. Hardware for analyzing guide camera data and sending adjustments to mount
8. Power supply

Item 7 in the list has typically taken care of with a laptop PC, which adds a significant cost if one is not already available.  A table would likely also be desired to keep the laptop off of the ground, and USB/serial cables of sufficient length would be needed to connect the computer to the guide camera and motorized mount.  To me, this looked like a hassle, but I still wanted to produce some great astrophotographs.

Not (conveniently) having a laptop, and not really interested in buying one nor leaving one outside for log periods of time, I wanted to build a different solution.  Could a microprocessor take the place of the computer?  Having toyed with a MSP430, I knew it could be configured to control the telescope mount, but it would not have the processing power or connectivity for analyzing CCD/webcam images.  Next up from that I looked at the Arduino, and I came to a similar conclusion at the time.  The Raspberry Pi (RPi) on the other hand had some distinct advantages.  RPi can run Linux, and there are Linux software packages (specifically linguider, INDI, and open-phd-guiding) for controlling telescope mounts via autoguiding.  A thread at Cloudy Nights Telescope Reviews described a project to do just that.  While remote GoTo control was achieved with the RPi, the original author decided to move to a MK808 ARM® system since the RPi didn't have the desired processing power.  The MK808 system additionally needed a USB hub for a GPUSB Guide port interface and webcam, although it had built-in WiFi.  A main downside to this solution, in my opinion, was the lack of expansion via GPIO and the extra guide port interface.

It was at this point I learned about the Beaglebone Black (BBB).  While not dual-core like the MK808, I figured that the fast, 1GHz ARM® Cortex-A8 processor would be able to handle necessary image processing for my project.  The BBB also has a large number of configurable pins available for all sorts of expansion.  I recognized that I could build an equivalent Guide port interface onto the BBB, avoiding the GPUSB dongle.  However, since the BBB only has one host USB port, a separate USB hub would still be necessary to simultaneously use a WiFi adapter and webcam (at least until a USB or WiFi expansion cape becomes available for the BBB).  Moreover, the BBB has the possibility to use LCD and LED displays for visual feedback without the need of an external monitor, as is the case for the MK808.

And here starts my tale with the BBB.

Phase 1: Configuring the BBB
Phase 2: Building astronomy software
Phase 3: GPIO-based guide port interface
Phase 4: Autoguiding
Phase 5: Celebrate
Phase 6: Digital camera control
Phase 7: Cape with USB hub and guide port interface