Remote Operations and Nightly Automation of The Red Buttes Observatory

We have implemented upgrades to the University of Wyoming's Red Buttes Observatory (RBO) to allow remote and autonomous operations using the 0.6 m telescope. Detailed descriptions of hardware and software components provide sufficient information to guide upgrading similarly designed telescopes. We also give a thorough description of the automated and remote operation modes with intent to inform the construction of routines elsewhere. Because the upgrades were largely driven by the intent to perform exoplanet transit photometry, we discuss how this science informed the automation process. A sample exoplanet transit observation serves to demonstrate RBO's capability to perform precision photometry. The successful upgrades have equipped a legacy observatory for a new generation of automated and rapid-response observations.


Introduction
The Red Buttes Observatory (RBO) was constructed in 1994 as the second research observatory at the University of Wyoming (UW). Located at 2,240 m elevation, the observatory lies 15 km south of Laramie, Wyoming at 41.3167 • N, 105.5833 • W. Its 0.6 m f /8.43 Ritchey-Chrétien Cassegrain telescope was constructed and installed by the Colorado-based company DFM Engineering, Inc (DFM). RBO began operation with the mission of enriching the undergraduate astronomy curriculum with practical experiences in observation. Successful research projects have included prototyping new instrumentation, measuring eclipsing binary distances to star forming regions, and followup confirmation of γ-ray bursts (Rodgers et al. 2006;Monson & Pierce 2009;Kiminki et al. 2015). The observatory was operated for two decades in the classical fashion with on-site observers.
We initiated a series of upgrades in 2014 to the telescope control system and observatory infrastructure to enable remote and autonomous operation. The project's goal was to increase the scientific productivity of the observatory by enabling nightly observations without on-site real-time human interaction. A remote-enabled observatory mitigates logistical issues of Wyoming weather and department resources, permitting increased year-round observing. Renovations have been completed which have enabled remote and autonomous operation of the observatory.
We found in the course of the upgrades, that there existed little literature to guide the conversion of small legacy observatories to autonomous operation. Our goal in this publication is to describe the RBO upgrade process in sufficient detail such that observatories of similar vintage can enact like upgrades. DFM has installed 24 telescopes which have similar control systems to RBO. Section 2 details the hardware and software implemented in the automation process. We also provide details regarding the in-house scripts required to interface the observatory devices in this section. Section 3 describes the event sequence during a typical remote or automated night. Section 4 describes the science driver for RBO, how it informed the automation process, and a sample dataset of a transiting exoplanet to demonstrate current photometric capabilities.

Upgrade Implementation
The upgrades at RBO can be categorized as either hardware-or software-based. In the first subsection, we detail the hardware components necessary for remote and autonomous operation. In the second subsection, we describe software and additional scripts used to interface components of the observatory. Emergency contingencies are included with the descriptions of each relevant component.

Operation Hardware
In the Summer of 2014, DFM designed and implemented a next-generation telescope control system (TCS), replacing the original 1994 DFM proprietary TCS at RBO. Figure 1 is a schematic overview of the hardware components, power, and communications infrastructure of the new DFM control system and the observatory at large utilized in remote/automated operations. The gray shaded area encapsulates the TCS. Single solid lines denote 120 V AC power, dash-dot lines represent serial or USB connections, dashed lines indicate ethernet and network connections, and solid double lines indicates low-voltage motor control or TTL connections. The rest of this subsection will describe each of the main components in the figure.
The new TCS is a hybrid, consisting of DFM proprietary code running on a 32-bit Windows 7 operating system computer (TCS PC) and an external, commercial, solid state motion controller (Galil DMC 4183) with embedded code. The motion controller provides the real-time control interface for commanding the telescope, dome, mirror doors, and focus motor speeds. The motion controller also mediates hand paddle inputs and updates the states of dome/tracking switches. 1 The motion controller and additional custom circuits -providing linear servo power, electronic surge suppression, horizon interlock circuitry, solid state relays for dome control, and long-cable signal conditioning -reside in a rack-mounted Motor Driver Chassis (MDC) adjacent to the TCS PC.
The TCS provides control of the telescope, focus, dome rotation, dome upper and lower shutters, and mirror door covers. Communication between the TCS PC and motion controller occurs over TCP/IP on a dedicated local area network using a dedicated network interface card. A key feature of the TCS, implemented in the updated code, is its inclusion of ASCOM (Astronomy Common Object Model) compliant drivers that allow users and third party software to gather telescope, dome, and focus status and issue commands through the established ASCOM standard protocols. These protocols have been available since 1999 and are now widely deployed on small telescopes. 2 Other hardware upgrades included replacing the original friction-driven quadrature encoders on each telescope axis with Heidenhain ROC 425 25-bit on-axis absolute encoders. The on-axis encoders provide the TCS with absolute telescope position without requiring initialization. The dome position encoder, driven by a gear on the dome track, was augmented by the addition of a "dome home" fiducial switch at azimuth 270 • to ensure absolute positioning. Together these upgrades ensure accurate knowledge of telescope and dome position, even in the event of an unexpected shutdown or power failure. A proprietary Heidenhain IK220 PCI card within the TCS PC provides the interface between the ROC425 encoders and the TCS code.
Because there is no line-of-sight path between the UW campus and RBO, internet is provided by a two-segment microwave radio link, with a relay point at the Wyoming Infrared Observatory (WIRO) on Mt. Jelm, which has a line-of-sight path to both locations. The 34 mi RBO-to-WIRO segment uses by a 25 Mb s −1 5 GHz unlicensed radio link, with a Motorola PTP 500 series radio at each end. The 40 mi WIRO-to-UW campus link occurs over a 300 Mb s −1 licensed 11 GHz radio link with a pair of Motorola PTP 800 series radios and 2 ft diameter antennas. The two segments converge at WIRO within the local area network anchored by an ethernet switch. RBO's internet bandwidth is sufficient for all needs of a modern observatory (i.e., simultaneous data transfer of 4 MB images or larger, remote desktop connection, and audio/video feed). In the event of a network outage, a weather parsing script triggers a dome closure to ensure observatory safety. The details of this script are discussed in the software section. Figure 1 summarizes the power control hierarchy and local area network at RBO. We accomplish power management and distribution at RBO with an APC 2200 XL Smart-Uninterruptible Power Supply (UPS) and a TrippLite MH30NET Power Distribution Unit (PDU). A single municipal power line provides 120 V power to the UPS, which, in turn, powers all other devices necessary dome rotation, and mirror doors. These switches, formerly activated by an on-site user, now remain in the "on" position for remote and automated operation.
for remote/autonomous observatory operation. As the schematic shows, the UPS provides power to the TCS PC, MDC, dome/telescope/mirror door/focus motors, PDU, weather stations, science devices, radio, ethernet hub, and dome camera and lights. This represents a total maximum power load of about 1035 W, requiring a UPS rated to at least 1.28 kVA. Appendix A is a tabulation of estimated power requirements. A UPS battery extension module increases the emergency power runtime to a total of fifteen minutes in the event of a municipal power loss. An emergency power shutdown takes approximately five minutes to complete with no human interaction necessary, but reinitializing operations once power is restored does require a human operator. The PDU distributes power to the various observatory devices -TCS PC, MDC, dome lights, and science devicesvia sixteen 120 V receptacles which are independently controllable through a web-based interface on the PDU's network card. The PDU is programmed to schedule power events, such as enabling or disabling power to all devices on a daily basis. In the event of a municipal line power outage, the UPS triggers a dome closure through a single TTL output that connects to the MDC and provides the TCS with a signal to close. Through an AP9617 network card, the UPS is configured to send emergency emails to alert necessary contacts of the power loss.
There are two weather stations installed at RBO: an Aurora Eurotech Cloud Sensor III and a Davis Vantage Vue. Both weather stations are powered directly by the UPS to ensure continuous operation. The Aurora unit measures wetness, light, and the presence of clouds; it provides a signal through a TTL output that connects to the MDC and provides the TCS with a trigger for precipitation or overcast induced dome closure. In the event of a dome closure signaled by this line, image capture continues and affected images are manually removed during analysis. The Davis weather unit measures humidity and wind data, uploads a weather record to a public website 3 . Together, the weather stations help ensure full observatory weather protection and network loss protection. Both stations were calibrated experimentally to establish the cautionary thresholds (40 km hr -1 windspeeds or 80% humidity).
Scientific devices on the telescope include two cameras, an Andor Apogee Alta F16 4096×4096 with 9 µm pixels and an approximately 25 ′ ×25 ′ field of view (FOV) and an Andor Apogee Aspen CG47 1024×1024 with 13 µm pixels and a 9 ′ × 9 ′ FOV, given the 5.06 m focal length of the telescope (plate scale of 0.04 ′′ µm -1 ). Either camera may be mounted behind a modified DFM 8-slot filter wheel, typically filled with 2 inch × 2 inch Bessel filters (UBVR C I C ), H-α, O III, and an empty slot. As seen in the schematic, the TCS PC controls these science devices over USB (cameras) and serial (filter wheel) connections. Given the approximate 6 m distance between the telescope and TCS PC, the cameras use an active USB extension cable to ensure reliable connectivity.
Dome lights and a dome camera provide additional environmental monitoring at RBO. The PDU allows activation of the dome lights for use by a remote observer. The dome camera is a D-Link DCS-933L ethernet home security camera with IR capabilities and an audio module mounted on the east interior dome-ring wall. The dome lights and dome camera only provide a passive means to monitor the observatory and are not utilized during automated observations.

Operation Software
ASCOM provides a consistent interface for all necessary observatory devices. There are many advantages to the ASCOM environment, but primarily automation benefits from the ease of interfacing with other software packages and the ability to script additional functionality into the system. ASCOM requires a Windows operating system. The upgrades performed by DFM to the TCS software provided the additional ASCOM functionality required to integrate devices and perform autonomous operation. Specifically, DFM added ASCOM functionality to dome control, dome shutter status, and telescope parking in the TCS software and created an ASCOM accessible mirror door control (as there exist no ASCOM objects or methods for mirror doors). These upgrades allowed us to develop full automation using a single commerical package and two in-house Python scripts 4 .
MaxIm DL 5 version 5 provides camera control and observatory automation via Visual Basic ASCOM scripting. This software can control a majority of commercial cameras. MaxIm also allows multiple devices to be controlled simultaneously, including cameras, focusers, and filter wheels. This program was chosen because it was already in use at RBO. As the rest of the observatory is ASCOM compliant, we use a combination of Python and Visual Basic scripts to prepare an automated observing run solely through MaxIm. Another popular automation software suite is CCDWare's Navigator and Autopilot 6 . A major appeal of CCDWare's products is the user friendly environment. The CCDWare package has also been used successfully with RBO. With all of the hardware interfaced via ASCOM, it is possible to in-house script the entire automation process, removing the need to use additional commercial packages. We are working towards minimizing commercial software use -Appendix B contains a minimal example of controlling multiple ASCOM devices, which is the starting point for this project.
A local Python operations script, called by the commercial package, controls mirror door and dome shutter operations. Mirror doors are always closed during operation of the dome shutter during startup and shutdown to protect telescope optics. As mirror doors are not a standard ASCOM object, there is no native method to control them. DFM's upgrades allow ASCOM access to the mirror doors through the generic telescope class' method Action which our script invokes.
The second Python script is a weather monitoring script that parses the weather data from the Davis station and commands a temporary dome closure, using the same functionality of the 4 These scripts are available freely upon request from physics@uwyo.edu. 5 MaxIm products available at www.cyanogen.com/maxim_main.php 6 CCDWare products available at www.ccdware.com operations script, if wind or humidity exceeds thresholds. The weather monitoring script uses Python module BeautifulSoup 7 to extract RBO's weather data from the website and then analyze it to determine if conditions are suitable for operation. The Davis station occasionally fails to upload weather data at regular intervals, and in this event, the conditions at the Laramie Regional Airport are analyzed instead 8 . When analyzing airport data, we require the script weather thresholds be 10% more conservative to account for the distance to the local station and reporting delays. If neither website can be reached, or if weather data timestamps are older than ten minutes, our script interprets this as a network failure and triggers a temporary dome closure until connections are reestablished.
WinSCP 9 , operating in batch-mode, transfers science images in real-time to the Physics & Astronomy computer cluster archive. WinSCP automatically launches as a task after the user logs on to the TCS PC. WinSCP compares a directory at the observatory to a remote campus directory periodically and uploads any files not present on the remote machine. Copies of all data are stored on a hard drive at the observatory and a drive on campus.

Nightly Operations
There are many similarities between remote and automated observations. Figure 2 is a flowchart describing the sequence of events during full night's operation at RBO, with both remote and automated modes shown. Both modes involve three basic tasks required of any astronomical observatory -setup, observe, and shutdown -which are denoted by the three vertically arranged labelled grey regions in the Figure. Boxes in the left and right columns distinguish actions for remote and automated modes, respectively. Boxes in the middle column signify actions that occur in both remote and automated modes. In each mode there are human-controlled actions and software-controlled actions, designated by boxes with solid and dashed borders, respectively. Boxes with dash-dot border indicate actions that are preformed by a human in remote mode and by automation software in automated mode. Arrows designate the continuous observatory monitoring loops.
Any remote or automated operation begins by a user accessing the PDU and powering on observatory devices. The user then connects to the TCS PC via Virtual Network Computing (VNC) protocol, allowing them to interact with the TCS PC as if it were local. The VNC server configuration in use at RBO allows remote users to control the computer immediately on startup.
Once the user is logged on to the TCS PC, the action path diverges, depending on observation 7 More information about this module is available at http://www.crummy.com/software/BeautifulSoup/ mode. For a remote-mode observing run, the observer establishes software connections to the relevant devices through MaxIm and TCS software. The remote observer is then finished with setup. In contrast, for an automated run, the user must generate target lists for either the MaxIm or CCDWare automation software. The automation software optimizes the observation sequence based on airmass and twilight constraints. In general, target selection and optimization is a complex issue -the methods used at RBO will be discussed in the following section. The automation software then automatically establishes device connections, and the user closes the VNC connection, concluding the automation setup phase.
The observation phase for both modes is identical to classical observing with respect to the actions performed. Telescope slewing and tracking, camera temperature regulation and exposures, focus corrections, filter wheel selection, and dome movement are all completed. A remote-mode observer achieves this exactly as a classical observer, via direct interface with the TCS software and MaxIm. Automated-mode operations utilize the automation software to issue commands to control devices, as mediated by ASCOM. A notable exception to the automated solutions currently in use at RBO is the lack of automated focus adjustment -at the time of writing this feature has not been implimented.
Throughout nightly observations, in either mode, two weather stations provide weather data to ensure observatory safety. In remote mode, the observer monitors wind and humidity and initiates dome shutter and mirror door closure, as necessary. Even in remote mode, the Aurora wetness sensor will close the dome in the event of active precipitation, necessitating a decision by the remote observer to reopen if conditions become safe. In automated mode, the Python weather monitoring script assesses humidity and wind data, initiating temporary closures until conditions are within limits for a consecutive five minutes. An automated night is declared over, without the possibility of re-opening, if the wetness sensor is tripped, given the lack of human assessment.
Observations end either when the sequence of targets is finished or when weather prohibits further operations. This begins the shutdown phase. A remote-mode observer closes mirror doors and dome shutters, parks the dome and telescope and disconnects all devices. Finally, they close the VNC connection and switch off all PDU-connected devices, protecting the devices from lightning, and thereby completing the remote-mode operations. Similarly, in automated-mode, the automation software runs the end-of-night sequence, including our Python operation script, and the observatory closes. The automation software disconnects from all devices. At morning twilight, the PDU powers off all connected devices according to a preprogrammed schedule, completing the automated operations sequence.

Exoplanets as a Science Driver at RBO
Exoplanet transit photometry is the driving science case behind the RBO upgrades. Many small telescopes perform exoplanet transit photometric observations (Pepper et al. 2007;Siverd et al. 2012). Since completion of upgrades, both remote and automated operation modes have been employed to observe transit events. High-precision transit photometry demands tracking that prevents image motion across the detector. RBO's wide FOV combined with the the new absolute encoders leads to about 1 ′′ hr -1 drift on a single continuously tracked target. The absolute pointing is accurate to approximately 3 ′′ rms over the sky at less than 2 airmasses. These precisions allow RBO to perform high-precision transit photometry without a guide camera. In remote-mode operations, we find that the focus requires no adjustment during a typical week to accomplish successful transit photometry. Typical seeing of 3 ′′ for stellar point spread functions validates our lack of focus solution. In truth, focus is not important for transit observations and defocusing mitigates flat-fielding and fine guiding errors -another strength of automated exoplanet photometry.
Scheduling photometric observations of exoplanets at RBO is accomplished with the TAPIR code (Jensen 2013) and operator decision making. This tool takes target lists with ephemerides, periods, and coordinates and produces a list of visible targets which are transiting within a time frame. On a given night, TAPIR typically produces no more than twenty targets. From these targets, a human operator decides the transit(s) to observe through knowledge of RBO's observational limits, weather forecasts, and fullness of transit event. In practice, this means scheduling and optimization of the night's observations is controlled by the time-domain targets. Logistics of scheduling and optimizing observations will vary between projects.
We observed a transit of TrES-3b (an ∼ 12 mag star in R) with the Andor Apogee Aspen CG47 camera in the Bessel R C filter at RBO on 2016-05-04 UTC. Observations started at 4:40 UT and lasted approximately 3.5 hours, during which we obtained 31 frames. The exposure time for all frames was 200 s and at a camera temperature of -30 • C throughout the entire observation. We used six stars as differential photometric standards. The field was densely populated and standards were chosen based on signal strength and lack of overexposure. The only comparison existing in a catalog was USNO-B1.0 1275-00332540. Sky conditions were photometric at first and became less amenable to observing towards the end of the the transit. This resulted in a typical seeing of approximately 3 ′′ FWHM over the 1.10-1.55 airmass range of observations. Images were bias, dark, and flat corrected using sequences of 50 bias frames, 25 dark frames taken at the same camera temperature, and 30 flat-field frames taken manually on twilight sky that night. Photometry was preformed on the target star and standards with the AstroImageJ package (Collins et al. 2016) using apertures of 10 ′′ radius on all stars. Average frames contained 2.4 × 10 6 photons for the target star with formal uncertainties of 1.0 mmag.  (Parviainen et al. 2016) and created by the BATMAN code (Kreidberg 2015). The good agreement between our data and the synthetic light curve illustrates the potential for RBO to conduct high-precision photometric campaigns and detect planetary transits at the few mmag level. Most points fall on the expected curve within 1σ, with more variability occurring at the end of the transit due to the development of non-photometric observing conditions.

Conclusion
Hardware and software upgrades are now completed that have made remote and automated operations possible at the Red Buttes Observatory. The automated observatory now allows a yearround duty cycle with much greater flexibility of operations, dramatically increasing the number of observed nights. This has spurred the inception of multiple projects covering a range of research and pedagogical interests. Both graduate and undergraduate students have acquired expertise in observatory operations, automation, and data acquisition and analysis during the upgrade process. Undergraduate students routinely conduct transit follow-up photometry and participate in an authentic research program. Additionally, laboratory classes now use RBO to educate and expose undergraduates to astronomical techniques early in their college careers. This modernization has invigorated the legacy observatory, increasing RBO's capability to carry out its teaching and research mission.

Acknowledgments
This project was supported by Wyoming NASA Space Grant Consortium, NASA Grant #NNX15AI08H, Wyoming EPSCoR, and the Wyoming Research Scholarship Program. We are grateful to UW undergraduate Aman Kar for his assistance in observing targets. Additionally, communication with Scott Mecca and Chris Rice at the outset of the project were invaluable to our success.

A. Estimations of Power Usage
We present an estimation of the power usage at RBO in a worst-case scenario. That is, this estimation assumes all devices are simultaneously operating at maximum load. This is never the case, as some actions cannot be performed at the same time, but it provides an upper limit. The estimations include devices not discussed in the text as they are not integral to automated operations, but are, nevertheless, part of the power load at RBO. The load of a power supply is often given in units of volt-amps, while device loads are in watts. The conversion volt-amp to watts is known as the power factor: ( The ASCOM website gives examples of scripting in many coding languages, but not Python. As Python is such a ubiquitous language in the physical sciences, we present a minimal working example of interfacing with observatory hardware as translated from the ASCOM guide for other languages. In this example, we invoke our particular driver (TCSGalilHybrid), which is specific to our hardware installation. As ASCOM is only available on Windows, this program will also only run on Windows.
#Import the Python module that negotiates Windows COM communications import win32com.client as com #Create telescope, dome, and camera objects driver = 'TCSGalilHybrid' #the name of our specific driver #Any ASCOM object (i.e. dome, camera, rotator, focuser) is initialized as # com.Dispatch('DriverName.Object') tele = com.Dispatch(driver+'.Telescope') dome = com.Dispatch(driver'.Dome') #We choose to use the MaxIm controls becuase they are native to the camera #hardware and avoid unnecessary 3rd party control camera = com. Our complete control program utilizes many other modules for other functionality such as coordinate precession and managing target lists. This code is too lengthy to put as an appendix and as such is available upon individual request. The full functionality of each object is available on the ASCOM webpage present in the body. The scripting guide for a MaxIm controlled camera is available at http://www.cyanogen.com/help/maximdl/MaxIm-DL.htm .