Power outage alert
- jsclownfish
- Posts: 378
- Joined: Mon Oct 24, 2011 7:52 pm
- Location: Saint Louis
Re: Power outage alert
I'm wondering, what do you leave on "life support" in case of a power outage and a switch to battery power. I'm thinking that it may not be much more than the RA unit, relay box, & power heads in the tank for circulation as they draw very little power.
-Jon
-Jon
- jsclownfish
- Posts: 378
- Joined: Mon Oct 24, 2011 7:52 pm
- Location: Saint Louis
Re: Power outage alert
I'm curious if there is a better way to monitor for power. I have it set up on the IO expansion and if it changes from high to low, then the power to most of the relays is turned off. The problem (atleast I think it may be a problem) is that if anything breaks down the connection across the I2C communication, then the system essentially goes into shut down thinking the power feed has dropped. Any thoughts?
Thanks,
Jon
Thanks,
Jon
- jsclownfish
- Posts: 378
- Joined: Mon Oct 24, 2011 7:52 pm
- Location: Saint Louis
Re: Power outage alert
Thanks,
I suppose that would be the best way to get around the issue. I didn't do that initailly because I'd then have to code in the logic for the standard ATO if one of them (low or high) was coming from the IO expansion instead of using the ReefAngel.StandardATO function.
-Jon
I suppose that would be the best way to get around the issue. I didn't do that initailly because I'd then have to code in the logic for the standard ATO if one of them (low or high) was coming from the IO expansion instead of using the ReefAngel.StandardATO function.
-Jon
- jsclownfish
- Posts: 378
- Joined: Mon Oct 24, 2011 7:52 pm
- Location: Saint Louis
Re: Power outage alert
Looking at the StandardATO code a bit in the library, will this work if I receive a signal from the IO expansion for the LowATO? I figure it is best to use that one in case of a communication error as I would rather the sump go low than to overflow.
Thanks,
Jon
Thanks,
Jon
Code: Select all
//Set the Low ATO to the IO device, receive IOLowATO = 1 or 0
byte IOLowATO = 0;
//Temp timeout
unsigned long TempTimeout = ATOTimeout;
TempTimeout *= 1000;
/*
Is the low switch active (meaning we need to top off) and are we not currently topping off
Then we set the timer to be now and start the topping pump
*/
if (IOLowATO == 1)
{
ReefAngel.LowATO.Timer = millis();
ReefAngel.LowATO.StartTopping();
ReefAngel.Relay.On(Box1_Port1); //ATO pump on Box1 Port 1
}
// If the high switch is activated
if ( ReefAngel.HighATO.IsActive() )
{
ReefAngel.Relay.Off(Box1_Port1);
}
/*
If the current time minus the start time of the ATO pump is greater than the specified timeout value
AND the ATO pump is currently running:
We turn on the status LED and shut off the ATO pump
This prevents the ATO pump from contniously running.
*/
if ( (millis()-LowATO.Timer > TempTimeout) && IOLowATO==1 )
{
ReefAngel.LED.On();
ReefAngel.Relay.Off(Box1_Port1);
}
- jsclownfish
- Posts: 378
- Joined: Mon Oct 24, 2011 7:52 pm
- Location: Saint Louis
Re: Power outage alert
Maybe I oversimplified trying to limit the post. It would be broken up like this. The status of the lowATO should come from the I/O..
Code: Select all
//Set the Low ATO to the IO device, receive IOLowATO = 1 or 0
byte IOLowATO = 0;
//Temp timeout
unsigned long TempTimeout = ATOTimeout;
TempTimeout *= 1000;
void setup()
.....
void loop()
.....
GetFlow();
/*
Is the low switch active (meaning we need to top off) and are we not currently topping off
Then we set the timer to be now and start the topping pump
*/
if (IOLowATO == 1)
{
ReefAngel.LowATO.Timer = millis();
ReefAngel.LowATO.StartTopping();
ReefAngel.Relay.On(Box1_Port1); //ATO pump on Box1 Port 1
}
// If the high switch is activated
if ( ReefAngel.HighATO.IsActive() )
{
ReefAngel.Relay.Off(Box1_Port1);
}
/*
If the current time minus the start time of the ATO pump is greater than the specified timeout value
AND the ATO pump is currently running:
We turn on the status LED and shut off the ATO pump
This prevents the ATO pump from contniously running.
*/
if ( (millis()-LowATO.Timer > TempTimeout) && IOLowATO==1 )
{
ReefAngel.LED.On();
ReefAngel.Relay.Off(Box1_Port1);
}
void GetFlow()
{
Wire.requestFrom(7,8);
if(Wire.available())
{
for (int a=0;a<10;a++)
IOIn[a]=Wire.read();
}
Flow0=(IOIn[1]<<8)+IOIn[2];
Flow1=(IOIn[3]<<8)+IOIn[4];
Power=IOIn[5];
Overflow=IOIn[6];
Reservoir=IOIn[7];
}
Re: Power outage alert
How did this turn out? I am very interested in this.
- jsclownfish
- Posts: 378
- Joined: Mon Oct 24, 2011 7:52 pm
- Location: Saint Louis
Re: Power outage alert
Sorry I haven't had a chance to follow-up on this for awhile, but I have time this week to try it all out.
For review, I'm trying to hook the lowATO port to a 5V wall wart to detect a power failure. The main lines are connected to a battery back-up. The plan is to shut-off everything but a powerhead while the power is out and to return back to normal when main power returns.
When I tried a couple versions of this code, I always get an intermittent response to the power from the 5V wall wart being unplugged and or it cycles on and off. Also, something is not right on the masking as the port will cycle with the status change, but the others that are on stay on.
Any ideas? Do I need a resistor to pull up/down the signal?
Here is my abbreviated code....
For review, I'm trying to hook the lowATO port to a 5V wall wart to detect a power failure. The main lines are connected to a battery back-up. The plan is to shut-off everything but a powerhead while the power is out and to return back to normal when main power returns.
When I tried a couple versions of this code, I always get an intermittent response to the power from the 5V wall wart being unplugged and or it cycles on and off. Also, something is not right on the masking as the port will cycle with the status change, but the others that are on stay on.
Any ideas? Do I need a resistor to pull up/down the signal?
Here is my abbreviated code....
Code: Select all
/* Main ReefAngelPlus controller with communication for sound,
auxillary monitor, I/O expansion, and extra relaybox, send master time,
flow, buzzer, overflow and reservoir alarms on the I/O
The following features are enabled for this File:
#define DisplayImages
#define SetupExtras
#define DateTimeSetup
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define RelayExp
#define WDT
#define CUSTOM_MENU
#define CUSTOM_MENU_ENTRIES 9
#define CUSTOM_MAIN
#define COLORS_PDE
#define FONT_8x8
#define NUMBERS_8x8
#define CUSTOM_VARIABLES
*/
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <ReefAngel.h>
#include <IO.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <avr/pgmspace.h>
//Power outage settings
byte BatteryPower1; //first outlet box
byte BatteryPower2; //second outlet box
static boolean fSave = true; //status of highATOPin
//Custom Main Display
void DrawCustomGraph()
{
}
void DrawCustomMain()
{
if ( ! digitalRead(lowATOPin) )
{
ReefAngel.LCD.Clear(255,1,92,102,102);
ReefAngel.LCD.DrawText(COLOR_GREEN, DefaultBGColor,1,92,"Main Power ON");
}
else
{
ReefAngel.LCD.Clear(255,1,92,102,102);
ReefAngel.LCD.DrawText(COLOR_RED, DefaultBGColor,1,92,"BACKUP Power ON");
}
if (ReefAngel.LowATO.IsActive())
{
lowATOPin == 0;
FillCircle(100,96,5,COLOR_RED);
ReefAngel.LCD.DrawText(COLOR_WHITE,COLOR_RED,98,92,"P");
}
else
{
lowATOPin == 1;
FillCircle(100,96,5,COLOR_GREEN);
ReefAngel.LCD.DrawText(COLOR_WHITE,COLOR_GREEN,98,92,"P");
}
pingSerial();
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 110, TempRelay);
// draw 1st expansion relay
TempRelay = ReefAngel.Relay.RelayDataE[0];
TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
ReefAngel.LCD.DrawOutletBox(12, 120, TempRelay);
}
//************************************************************************************
void setup()
{
//...(other stuff)
//Status of the outlets if power is triggered (only 1 powerhead stays on, all other outlets off)
BatteryPower1 = Port3Bit;
BatteryPower2 = 0;
digitalWrite(lowATOPin,LOW);
}
//************************************************************************************
void loop()
{
// Specific functions
//1st Heater at 78.8, 2nd Heater at 77.0, MH on at 10AM off at 8PM, Actinics on at 9AM off at 9PM, Fan kicks on at 82.0
ReefAngel.StandardHeater(Port1,788,792);
ReefAngel.StandardHeater(Port2,770,792);
ReefAngel.MHLights(Port3,10,0,20,0,5);
ReefAngel.StandardLights(Port4,9,0,21,0);
ReefAngel.StandardFan(Port8,792,820);
ReefAngel.DosingPumpRepeat(Box1_Port7,0,60,4); // Dose for 4 seconds every 60 minutes with 0 minutes offset
ReefAngel.DosingPumpRepeat(Box1_Port8,5,60,4); // Dose for 4 seconds every 60 minutes with 5 minutes offset
//Logic for a poweroutage and return to normal
if (digitalRead(lowATOPin))
{
// only execute once during power outage
if ( fSave )
{
// Force on the ports you want, turn them on if they are
// not already on
ReefAngel.Relay.RelayMaskOn = BatteryPower1;
ReefAngel.Relay.RelayMaskOnE[0] = BatteryPower2;
ReefAngel.Relay.RelayMaskOff = ~BatteryPower1;
ReefAngel.Relay.RelayMaskOffE[0] = ~BatteryPower2;
// ReefAngel.Relay.Write();
fSave = false;
}
}
else
{
// only execute once after power returns
if ( ! fSave )
{
// return everything back to where it should be in normal operation
ReefAngel.Relay.RelayMaskOn = 0;
ReefAngel.Relay.RelayMaskOnE[0] = 0;
ReefAngel.Relay.RelayMaskOff = 0xff;
ReefAngel.Relay.RelayMaskOffE[0] = 0xff;
// ReefAngel.Relay.Write();
fSave = true;
}
}
//...other stuff
ReefAngel.Portal("jsclownfish");
ReefAngel.ShowInterface();
}
Re: Power outage alert
Since you have a relay expansion box, you could use this solution:
http://forum.reefangel.com/viewtopic.php?f=2&t=1239
http://forum.reefangel.com/viewtopic.php?f=2&t=1239
Roberto.
Re: Power outage alert
Would a similar situation exist for the PWM expansion module? The module is powered by a 12v power supply - is there any way to determine if power is being supplies to this module or not?
- jsclownfish
- Posts: 378
- Joined: Mon Oct 24, 2011 7:52 pm
- Location: Saint Louis
Re: Power outage alert
Thanks, I'll take a look. That would free up my low ATO port again as well.
I'm still a bit confused as to the signalling from the wall wart however. Even if I disconnect the wall wart and simply touch the two wires from the port lead wires, I can get the signal to change a bit, there must be something else going on. Maybe I should try the highATO port?
-Jon
I'm still a bit confused as to the signalling from the wall wart however. Even if I disconnect the wall wart and simply touch the two wires from the port lead wires, I can get the signal to change a bit, there must be something else going on. Maybe I should try the highATO port?
-Jon
- jsclownfish
- Posts: 378
- Joined: Mon Oct 24, 2011 7:52 pm
- Location: Saint Louis
Re: Power outage alert
mvwise,
I originally planned to use this on the IO module (similar to the PWM module) but it would have the same downside that any interuption of the signal through connections and the I2C would look like a power outage, so I tried to move it to the main lowATO pin.
-Jon
I originally planned to use this on the IO module (similar to the PWM module) but it would have the same downside that any interuption of the signal through connections and the I2C would look like a power outage, so I tried to move it to the main lowATO pin.
-Jon
- jsclownfish
- Posts: 378
- Joined: Mon Oct 24, 2011 7:52 pm
- Location: Saint Louis
Re: Power outage alert
The extension relay and the I2C scanner seems to work great. Thanks Don and Roberto for the idea and code. I did have one issue however with the Back-UPS. I tripped the circuit breaker on the box and when that happened everything went out so I didn't get any back-up or notice change. It says the outlet box has an 8A capacity. Maybe I need to move some things like the MH lamps or Chiller to another circuit? I could move the MH lamps to the extension relay and power that from another circuit. Your thoughts?
-Jon
-Jon
Re: Power outage alert
Well, if you kill power to the controller, there is nothing that can be done.
Was it intentional trip or too much power for the breaker?
I think you should do what you said. Move the heavy lifting equipment out of the main box.
Was it intentional trip or too much power for the breaker?
I think you should do what you said. Move the heavy lifting equipment out of the main box.
Roberto.
- jsclownfish
- Posts: 378
- Joined: Mon Oct 24, 2011 7:52 pm
- Location: Saint Louis
Re: Power outage alert
yep, I didn't realize the amps that the system pulls now. I had a outlet strip with a 12A breaker on it and it was fine, but the BackUPS is only an 8A breaker. I looked up the chiller and it pulls 6A on it's own, so I moved it to another outlet on a separate panel breaker. Hopefully that will fix the issue.
Thanks,
Jon
Thanks,
Jon