Observatory - Controller




The OnCue OCS (Observatory Control System) should be of help to capable DIY'ers who want to automate small observatories. It's based on using an inexpensive and easy to work with Arduino Mega2560 (w/Ethernet Shield) to control some relays and sense switch closures and analog inputs (and operate weather sensors which are usually on an I2C bus if present.)
The OCS hooks up to your wired LAN (router, etc.) and provides a web-site which can monitor/control power, heating and cooling systems, lighting, roll-off roof/dome shutter, and also monitor weather conditions.

There are currently two (optional) ASCOM drivers for your Windows PC that can connect to the OCS via. the USB/Serial interface or IP (internet) connections. They are shareware and are available for a small fee to support the development of this OCS. These allow ASCOM aware applications to monitor and respond to the safety status. If an "UNSAFE" condition is detected (power failure, too cloudy, too windy, or raining) the telescope can be parked (if necessary) and the roof closed... all automatically... Purchase the OCS ASCOM drivers.

All panels except the "Status" panel are optional, and most items on the panels can be disabled if you're not using them.
The OnCue OCS can handle the following from an internet accessible web-site:

Status Panel:
    Date/Time. NTP support for setting the Mega2560's date/time from the internet.
    Up Time. Number of minutes since the controller booted up last.
      Optionally you can enable the Watchdog timer and the OCS will reboot automatically should it hang for some reason.
    AC Mains power good (a digital input.) Signals an "UNSAFE" condition if mains power fails (running on UPS for example.)
    Monitor 12V, 24V, etc. telescope power (an Analog Input.)
    Monitor 12V, etc. battery for DC roof motor (an Analog Input.)

Weather Panel:
    Outside Temperature.
    Barometric Pressure.
    Relative Humidity.
    Wind Speed*. Signals an "UNSAFE" condition if too high.
    Rain. Signal an "UNSAFE" condition if wet.
    Sky Quality*. In mag/sq arc-sec.
    Sky Conditions (cloud cover.) Signals an "UNSAFE" condition if too cloudy.
    *=actual routines to read these sensors aren't present, just function shells.

Power Panel:
    For up to six named relays (AC Outlets, DC Telescope power, etc.)
      Each relay can have setting memory activated to restore it's state across a power cycle.

Thermostat Panel:
    Shows inside temperature.
    Allows setting minimum temerature (heat relay control.)
    Allows setting maximum temerature (cool relay control.)

Lighting Panel:
    Controls for red and white lights.
    Separate controls for "observing room" and "warm room".
    Controls for timed "exit" light.

Roof/shutter Panel:
    Controls for roof or dome shutter.
      Controls to open or close the roof/shutter and to override safety features if necessary.
      Option to automatically close the roof at 8AM (Standard Time.)
      Option to automatically close the roof if an "UNSAFE" condition is detected.
      Slow PWM for DC motors. Set frequency (1 to 100Hz.) Set power in 10% intervals (10% to 100%.)
      Slow PWM soft start for DC motors (ramps up at 5% per second until normal power % is reached.)
      Direction control via two signals A and B. A=HIGH and B=LOW to open the roof, A=LOW and B=HIGH to close the roof, both are held LOW to stop motion.
        A pair of SPDT relay's can use this to change the direction of a DC motor.

Roof/shutter Safety:
    Timed cut-off (if limit switch fails, etc. motor doesn't operate forever.)
    Where possible detects open and close limit switch failures.
      On open start, 4 seconds allowed for closed switch to disengage.
      On close start, 4 seconds allowed for open switch to disengage.
      Both open and close switches active (should never happen.)
    Two power switching methods, by direction relay control and by a power control relay (which is actually a MOSFET power transistor for my DC roof motor.)

The Weather page:
    The OCS logs weather data at 30s intervals to an Micro SD card log-file, one log-file per day. Logs files consume about 82MB of storage space per year.
    The logging is optional and the Micro SD card also needs Chart.min.js renamed to Chart.js and placed in it's root directory.

    A graphic display of the recent log data is then made available:




The OCS hardware:

1) The "Controller" is an Arduino Mega2560 with an Arduino Ethernet Shield. Theres even a ruggedized Mega2560 if you want it.
The Arduino Ethernet Shield V1 I used is a retired but still available on ebay, etc. The newer Arduino Ethernet Shield V2 should work fine too.

2) A "Relay Board" helps the controller switch high current loads like Heaters, AC outlets, etc.
    I built this part from scratch years ago but eBay, etc. have off-the-shelf relay modules that should work just fine for most users.

Relays:
I used 12 relays, six are 110VAC 20A Song Chuan 302WP1-1AH-F-C-12VDC devices. Each of the six high current relays are in turn driven by a OMRON G3VM_351A optocoupled relay. They switch 12VDC at the power levels necessary to drive the coils of the Song Chen devices. The other six relays are 60VDC 0.5A OMRON G3VM_62C1F1 devices. They are arranged as two relays per device and I used four devices - two of them provide four 0.5A channels, and the other two are ganged to provide two 1A channels.

Digital Inputs:
Also on my relay board are connections for four optocoupled digital inputs and four analog inputs. This protection isn't required but is a good idea. The optocoupled inputs are for sensing closed limit switches, etc. The optocoupler is a four channel device I had sitting around in my parts bin for years, a CEL ps2501. Or, you could just use one or two of these instead.

Analog Inputs:
Analog signals used for 12V measurements pass through a 2.2k/220 resistor/voltage divider (about 11:1) and are diode clamped to the 0-5V level to protect the Mega2560 from voltage spikes. Again. this protection isn't required but is a good idea. Inside temperature from an LM335 temperature sensor is also on an Analog input.

Weather Inputs:
The Weather sensors I recommend using are I2C devices. SparkFun.com and Adafruit.com are good sources for these. Usually they even include example code and Arduino Libraries that can easily be incorporated into my OCS to get them working.
    For humidity and temperature I used the SparkFun Si7021 module.
    For barometric pressure I used the BMP180 from SparkFun.
    For cloud IR sensing I used the MLX90614 from Mouser (Adafruit carries them too and I used their Library.)
    For rain sensing I've used similar to this.
    The Sky Quality and Wind Speed sensors haven't been implemented yet but the OCS should be ready for them. I plan to use a "hot wire" type wind speed sensor and a TSL237 for sky quality.


Comments

***DISABLED DUE TO SPAM***