The problem with power cuts

Being able to react on time is critical if the power fails. No wonder some battery backup (UPS) is needed, but in many cases it is not enough to just keep the session going, so some actions must be started.

With the DragonFly's ability to launch scripts upon sensor events, it is really easy.

How the detection works

Just purchase a simple relay, powered at 5 V DC. Use a cheap mains adaptor, such as an old mobile phone charger, to power the relay—but plug it outside the UPS (unprotected!). While there's power, the contact of the relay will remain closed, but if power fails, it will immediately open.

Now wire the relay, its two switch pins, to any of the DragonFly's inputs, and it will detect when the power goes off. As you already know, a script can be launched if one sensor goes off; you can use it to take any appropriate actions.

Use a mechanical relay, not solid-state. Please note that you can't use solid-state relays—please use a mechanical one, such as this one. RS Components code 494-0306.

5V DC mechanical relay: two pins wired to any Sensor IN on the DragonFly, the other two to a +5V DC power supply; polarity is not important
Two wires to any «Sensor IN» in the DragonFly, two to any +5 V DC power supply. Polarity is not important in the connections.

Wiring

  1. Connect two of the relay's pins to a +5 V DC power supply—a mains adaptor 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.
  2. Connect the relay's two switch pins to any «Sensor IN» on the DragonFly. Polarity is not important in either pair.
  3. Set up a script to be launched when that sensor goes off. The macros reference is in the DragonFly Macros Manual (PDF).

Note: the DragonFly itself stays on the UPS-backed side of the installation—only the relay's little power adaptor goes on the unprotected outlet.