How do i code Standard ATO high switch
-
acabano
- Posts: 49
- Joined: Thu Jul 21, 2011 6:09 pm
How do i code Standard ATO high switch
please help, i would like to use the standard ATO setup but i want to keep the high switch wires up.
from reading the forum, the way standard ATO work is.
ATO high switch is triggered(open loop) and ATO low switch is triggered(closed loop) ATO port is enabled.
then fills up the sump when the ATO low switch is triggered(open loop) and ATO high switch is triggered(close loop) ATO port is disabled(stop the pump)
below if possible to program the code in opposite with the ATO high switch.
-------------------------------------------------------------------------------------
ATO high switch is triggered(closed loop) and ATO low switch is triggered(closed loop) ATO port is enabled.
then fills up the sump when the ATO low switch is triggered(open loop) and ATO high switch is triggered(open loop) ATO port is disabled(stop the pump)
Thanks.
from reading the forum, the way standard ATO work is.
ATO high switch is triggered(open loop) and ATO low switch is triggered(closed loop) ATO port is enabled.
then fills up the sump when the ATO low switch is triggered(open loop) and ATO high switch is triggered(close loop) ATO port is disabled(stop the pump)
below if possible to program the code in opposite with the ATO high switch.
-------------------------------------------------------------------------------------
ATO high switch is triggered(closed loop) and ATO low switch is triggered(closed loop) ATO port is enabled.
then fills up the sump when the ATO low switch is triggered(open loop) and ATO high switch is triggered(open loop) ATO port is disabled(stop the pump)
Thanks.
-
binder
- Posts: 2865
- Joined: Fri Mar 18, 2011 6:20 pm
- Location: Illinois
- Contact:
Re: How do i code Standard ATO high switch
Doing this would require modifying the code in the libraries are that is not recommended. You can modify them but if you do, it makes upgrading the libraries much harder.
What you could do is use the SingleATOHigh and SingleATOLow functions and inside your PDE file you create your own version of the StandardATO function and handle it the way you want to handle it.
curt
What you could do is use the SingleATOHigh and SingleATOLow functions and inside your PDE file you create your own version of the StandardATO function and handle it the way you want to handle it.
curt
-
acabano
- Posts: 49
- Joined: Thu Jul 21, 2011 6:09 pm
-
binder
- Posts: 2865
- Joined: Fri Mar 18, 2011 6:20 pm
- Location: Illinois
- Contact:
Re: How do i code Standard ATO high switch
You could use RAGen to get the SingleATO code in the PDE but as for the additional logic, you would have to program it manually. It wouldn't be terribly tough to do. I know some others have done something similar.acabano wrote:Hi Curt, would i be able to use RAgen for this setup?
Somewhere on here somebody has used the SingleATO functions as a low switch being for the normal operation and then the high switch is the failsafe for if the low switch were to fail.
For what you want to do, you would need to look at the way the single and standard ato functions are coded to get a better idea on how to do it manually.
curt
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: How do i code Standard ATO high switch
Before you go hacking on libraries, try this:
Code: Select all
if (ReefAngel.HighATO.IsActive() && ReefAngel.LowATO.IsActive()) ReefAngel.Relay.On(Port1);
if (!ReefAngel.HighATO.IsActive() && !ReefAngel.LowATO.IsActive()) ReefAngel.Relay.Off(Port1);
Roberto.
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: How do i code Standard ATO high switch
Don't use StandardATO or SingleATO functions though. Just the above code.
Roberto.
-
acabano
- Posts: 49
- Joined: Thu Jul 21, 2011 6:09 pm
Re: How do i code Standard ATO high switch
Great! thanks guy's, i will throw this into my pde loop...
-
binder
- Posts: 2865
- Joined: Fri Mar 18, 2011 6:20 pm
- Location: Illinois
- Contact:
Re: How do i code Standard ATO high switch
Yep that's what you should do.acabano wrote:Great! thanks guy's, i will throw this into my pde loop...
curt
-
acabano
- Posts: 49
- Joined: Thu Jul 21, 2011 6:09 pm
Re: How do i code Standard ATO high switch
Thanks again Guy's, for all your hard work and me just pasting all the code
I'm happy with my setup now.
Note: if you use this code please comment out the ReefAngel.StandardATO(); function as Roberto mention.
Thanks,
I'm happy with my setup now.
Note: if you use this code please comment out the ReefAngel.StandardATO(); function as Roberto mention.
Thanks,
-
acabano
- Posts: 49
- Joined: Thu Jul 21, 2011 6:09 pm
Re: How do i code Standard ATO high switch
Hi Guy, I just realize that a timer function would help for added safety, is this possible with the code above?
Thanks.
Thanks.
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: How do i code Standard ATO high switch
If we put a timer, how would you clear the flag if the timer ever exceeds?
Do you use the Client?
Do you use the Client?
Roberto.
-
acabano
- Posts: 49
- Joined: Thu Jul 21, 2011 6:09 pm
Re: How do i code Standard ATO high switch
Hi Roberto, sorry for the confusion, i meant ATO time out function 
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: How do i code Standard ATO high switch
Yes, I understood your question.
We can easily mask the relay off and it will disable that port and ATO won't function no matter what.
But, you still need a way to clear the mask. Do you use the Client or have a wifi attachment?
We can easily mask the relay off and it will disable that port and ATO won't function no matter what.
But, you still need a way to clear the mask. Do you use the Client or have a wifi attachment?
Roberto.
-
acabano
- Posts: 49
- Joined: Thu Jul 21, 2011 6:09 pm
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: How do i code Standard ATO high switch
Try this code:
To clear the timeout, simply use the Client or browse to the wifi attachment and turn the port 1 back to "Auto" instead of "Off"
Code: Select all
#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>
void setup()
{
ReefAngel.Init();
ReefAngel.Timer[1].SetInterval(2);
}
void loop()
{
ReefAngel.ShowInterface();
if (ReefAngel.HighATO.IsActive() && ReefAngel.LowATO.IsActive())
{
ReefAngel.Relay.On(Port1);
ReefAngel.Timer[1].Start();
}
if (!ReefAngel.HighATO.IsActive() && !ReefAngel.LowATO.IsActive())
{
ReefAngel.Relay.Off(Port1);
ReefAngel.Timer[1].ForceTrigger();
}
if (bitRead(ReefAngel.Relay.RelayData,Port1-1) && ReefAngel.Timer[1].IsTriggered())
{
bitClear(ReefAngel.Relay.RelayMaskOff,Port1-1);
}
}
Roberto.
-
acabano
- Posts: 49
- Joined: Thu Jul 21, 2011 6:09 pm
Re: How do i code Standard ATO high switch
Thanks, Roberto.... i will add this to my pde, after i fix my wifi issue...
