Power outage detection?
Posted: Fri Sep 18, 2015 8:48 pm
Is there a power outage solution for RA? (at least some way to detect the power has gone out if everything were on a ups)
Community discussion about Reef Angel Controllers and reefing related subjects
https://forum.reefangel.com/
Code: Select all
boolean powerOutage=false; // For power outage code
Code: Select all
CheckPower(); // Check for power outage and take appropriate measures. Needs to be near the end to override everything else.
Code: Select all
void CheckPower() {
// Power Outage - turn off everything
if (!ReefAngel.Relay.IsRelayPresent(0)) // Expansion Relay NOT present because it's not hooked up to UPS and power is out.
{
powerOutage=true; // Set a flag
// Replace all this stuff with what you want to do when the power is off
ReefAngel.Relay.Off(Heater); // Turn all this stuff OFF
ReefAngel.Relay.Off(Skimmer);
ReefAngel.Relay.Off(Return);
ReefAngel.Relay.Off(Fuge);
ReefAngel.Relay.Off(Swabbie);
ReefAngel.Relay.Off(CanopyFans);
ReefAngel.Relay.Off(Fan);
ReefAngel.PWM.SetChannelRaw(Blues,0); // Turn off Blues on PWM Expansion.
ReefAngel.PWM.SetChannelRaw(Whites,16); // Set Whites to minimal as a visual indicator. Uses minimal power.
ReefAngel.DCPump.UseMemory = false; // Turn off memory/portal control of powerheads
ReefAngel.DCPump.SetMode(Constant,30,0); // and set them to a constant 30 for emergency circulation.
}
// Power Restored - Turn things back on
if (powerOutage && ReefAngel.Relay.IsRelayPresent(0)) // Has there been an outage, and is the expansion relay there again?
{
powerOutage=false; // Clear the flag
// Replace this stuff with what you need to turn back on when the power returns.
ReefAngel.Relay.On(Skimmer); // Turn always on things back on
ReefAngel.Relay.On(Return); // Everything else will return to automatic control
}
// If there has been no power outage, nothing happens at all.
}