As previously mentioned, it is very important to be confident with the remote operation of the observatory before addressing any kind of automation.

Complete automation requires a bit more effort; apart from the Dragonfly, we'll need some automation software (there are many in the market), automated focusing support, etc.—and, most importantly, everything running smoothly.

The ASCOM standard plays an important role here, as it enables different devices and programs to understand each other. In our case, the Dragonfly follows the ASCOM standard for domes, with its functionality reflecting that of a roll-off roof observatory, and also offers a switch interface.

Switch

ASCOM's switch interface is a convenient way of accessing the relays and sensors (inputs) of your Dragonfly from a third-party software. Just select the Dragonfly in the ASCOM chooser and you'll be ready to control everything similarly to how you would from the Dragonfly software, but from inside this 3rd-party program.

Dome control

Not so straightforward, but easy enough. Basically, thanks to the ASCOM standard, when our automation program wants to close the roof, the Dragonfly will be asked to do so. We will get three kinds of messages or requests from the automation program:

  • Open the roof
  • Close the roof
  • Tell me the status of the roof

For each of these messages, the Dragonfly software will launch a script. All Dragonfly scripts are located in its home folder (usually c:\program files\dragonfly), under the "dfscripts" folder (that is, c:\program files\dragonfly\dfscripts). For 64-bit Windows editions, the correct folder is c:\program files (x86)\dragonfly\dfscripts.

Scared? Don't be! Scripts can be very simple if the actions they command are simple. There are sample scripts with the Dragonfly software, and we can help—even write scripts for you if you're stuck!

We have one script for each ASCOM message:

  • Open the roof: OpenShutter.vbs
  • Close the roof: CloseShutter.vbs
  • Tell me the status of the roof: ShutterStatus.vbs

Programming the scripts can be a bit scary at first, but it is (or can be) simple indeed. Nevertheless, it involves thinking in advance and foreseeing possible situations.

On the plus side, scripts allow for full customization, and this is a big plus, worth the effort. For example, we can not only check if the mount is parked before closing or opening, but also command it to park by issuing a few ASCOM calls from the script.

Worked example: opening and closing the roof

Let's work out the scripts for our sample observatory, leaving aside for the moment the park sensor, as it adds complexity and not everybody needs it.

So, what do we want the Dragonfly to do when requested to open or close the roof? For the open case:

  • Check if it's already open, as in that case we don't need to do anything.
  • If it's not, then we need to push the roof control button, and wait for a period of time until the roof opens.
  • If the period expires and the roof is still closed, we should issue a warning.
  • If the roof successfully opens, we probably want the CCD and mount powered, and the lights powered off.

For closing the roof it is, of course, very similar.

Before going on, please bear in mind: we can't teach how to program in this manual; we will, however, explain things as clearly as possible so at the very least you can understand and modify the supplied scripts. Scripts are programs, usually simple ones but programs nonetheless; your computer will read the scripts line by line, taking actions as per the script commands. If you are an accomplished programmer, well, you'll know what to do—there's a reference section a bit further in the manual (Section 6, Dragonfly functions). If you need help, we will gladly assist to get your scripts running, and can even write them for you, as a free-of-charge service for our customers.

So let's start. We just have to program (most probably we'll just use one of the examples, and maybe modify it) two scripts: one for opening, the other for closing the roof. The one for opening is to be called "SyncOpenShutter".

Here's a simple (slightly stripped down) but useful version of the script you'll find installed—the comments (any text after a single quote ') explain each part:

' Dragonfly SyncOpenShutter script
' (c) Lunatico 2016, 2025
'
' This will work "out of the box" if you follow the setup in the users' manual:
' - you have 2 sensors for open (sensor 1) and closed (sensor 2) roof
' - the roof motor is activated by a pulse, and its control is attached to relay 1
'
' Only thing you may want to adjust is the time allotted for the roof moving,
' currently at 120 secs
' The pulse for the motor is set at 2 secs (2000 milisecs) and should work in any setup

Option Explicit

' ASCOM Shutter State
const ShutterStatus_Open = 0     ' values from ASCOM standard, cannot be changed!
const ShutterStatus_Closed = 1
const ShutterStatus_Opening = 2
const ShutterStatus_Closing = 3
const ShutterStatus_Error = 4

' Own constants
' define your own constants here
const Sens_OpenRoof = 1
const Sens_ClosedRoof = 2
const Rel_Roof = 1

const Timeout_OpenClose = 120000   ' 120 secs time for the roof to move
const RoofPulseLenght = 2000       ' 2 secs pulse for the roof "button"

Dim Dfly
set Dfly = CreateObject("Dragonfly.Help")

' Important: the first thing to actually do is notify we're opening the roof
df.AscomShutterStatus = ShutterStatus_Opening   ' opening

' check if already open
if ( df.SensorDigRead( Sens_OpenRoof ) ) then   ' sensor marks roof as open
    df.AscomShutterStatus = ShutterStatus_Open  ' notify it is already open
    df.LogAddLine( "Already open!" )
    ' nothing else will be done
else
    ' in any other case - we assume it is closed, and simply go on
    Call Dfly.RelayPulse( Rel_Roof, RoofPulseLenght )   ' pulse to the roof
    wscript.sleep( Timeout_OpenClose )                   ' and wait before checking
    if ( Dfly.SensorDigRead( Sens_OpenRoof ) ) then
        Dfly.AscomShutterStatus = ShutterStatus_Open
    else
        Dfly.AscomShutterStatus = ShutterStatus_Error
    end if
end if

And that's all needed to have our simple observatory automated using ASCOM. With these scripts, any ASCOM-aware program will be able to open, close, and report roof status.

Very important: the Dragonfly software will execute the scripts found in its install folder, "dfscripts" subfolder. If you program your own SyncOpenShutter.vbs and SyncCloseShutter.vbs scripts, you have to copy them to that folder, along with the supplied OpenShutter.vbs, CloseShutter.vbs and ShutterStatus.vbs scripts. Also, if you don't follow the "roof open is sensor 1, closed is sensor 2" standard, you'll have to also tweak ShutterStatus.vbs. The optional scripts for relays and sensors, explained in the next section, also have to be placed in the same folder.