The problem with power cuts
Most remote observatories run on a UPS (uninterruptible power supply) so that a brief power cut doesn't immediately kill the electronics. But the UPS only buys time: if the power doesn't return quickly, the battery will run out and everything shuts down regardless. Without a planned response, this means the mount could still be slewing, the roof might still be open, and automation software won't have had a chance to park and close.
The DragonFly can detect a mains power failure the moment it happens and immediately run an emergency Automata script—parking the mount, closing the roof, and shutting down non-essential power consumers—all before the UPS battery runs out.
How the detection works
The solution uses a small, inexpensive 5V DC relay as a power status sensor. Here's the key design choice:
- The relay coil is powered by a standard 5V mains adapter, but this adapter is plugged into an unprotected mains outlet, not into the UPS.
- While mains power is present, the relay remains energised (closed). Its switch contacts are connected to one of the DragonFly's sensor input pins.
- The moment mains power fails, the relay coil loses power and the relay opens. The DragonFly detects this input state change immediately, even while it's still running on the UPS.
- The DragonFly then fires a pre-configured Automata script to perform the emergency closure sequence.
Use a mechanical relay, not solid-state. Solid-state relays do not have a clear open/close switching action under all load conditions. A standard mechanical relay—such as this one—gives a clean, reliable contact change that the DragonFly can read unambiguously.
Wiring
- Connect the 5V relay coil to a 5V mains adapter plugged into an unprotected outlet (not UPS-backed). This is essential: if the relay is on the UPS, it won't open when mains fails.
- Connect the relay's normally-closed (NC) or normally-open (NO) switch contacts to any available DragonFly sensor input pin and ground. Which contact you use depends on how you want to interpret the input: NC means the input is active (closed) under normal conditions and opens on failure; NO is the reverse.
- In the DragonFly software, configure the input pin as a sensor input and set up an Automata script that runs when the input state changes to the power-fail state.
Emergency closure script
The Automata script triggered by the power-fail input should be fast and reliable. A typical sequence:
- Pulse the mount parking relay—sends the park command to the mount driver via a relay pulse.
- Allow a brief pause for the mount to begin parking.
- Close the roof relay—drives the roof motor or sends the close signal.
- Cut power to non-essential equipment (imaging camera, focuser) to preserve UPS capacity for the roof motor and mount.
The exact relay assignments depend on your wiring. The Automata scripting reference is in the Macros Manual (PDF).
Note: the DragonFly itself must remain powered by the UPS for the duration of the emergency sequence. Ensure the DragonFly is on a UPS-backed outlet and that the UPS has enough capacity to run the DragonFly plus the roof motor and mount until the sequence completes.
