Page 1 of 1

ATO delay

Posted: Tue Aug 11, 2015 1:25 pm
by palmer
trying to get the ATO port to turn on 5 mins after being triggered-
how do i modify what i have here?

Code: Select all

if (ReefAngel.LowATO.IsActive())
      ReefAngel.DosingPumpRepeat(Port7,0,30,300);
    else
      ReefAngel.Relay.Off(Port7);

Re: ATO delay

Posted: Wed Aug 12, 2015 4:18 am
by cosmith71
I just happen to have code laying around for that. :D

Put this up in globals:

Code: Select all

unsigned long LastUpdate1=0; 
Put this in your loop:

Code: Select all

if (ReefAngel.LowATO.IsActive() && LastUpdate1==0)
  {
    LastUpdate1 = now();
    ReefAngel.Relay.On (Port7);
  }
if (now() - LastUpdate1 >= 300 && LastUpdate1 != 0)
  {
    LastUpdate1 = 0;
    ReefAngel.Relay.Off (Port7);
  }
--Colin

Re: ATO delay

Posted: Wed Aug 12, 2015 8:40 am
by palmer
tried it .didn't work !
it trigger off the ATO immediately ( no delay) and ran for 5 mins

Re: ATO delay

Posted: Wed Aug 12, 2015 8:59 am
by cosmith71
That's what it's supposed to do. :D I mis-read your question.

What is it you're trying to accomplish? What happens after the 5 minute delay?

Re: ATO delay

Posted: Wed Aug 12, 2015 10:18 am
by Sacohen
If I understand the question correctly. he wants to have the ATO actually start 5 min after the RA triggers it to.

Here is a thread that I asked to do the same thing.
http://forum.reefangel.com/viewtopic.ph ... 2&start=10

It didn't work for me either though.
cosmith71 wrote:Something like this? Note, this compiles, but I haven't tested it.

Put this up in globals:

Code: Select all

static time_t LastATO=millis();    // For de-bounced ATO
And this in your loop in place of whatever line you're using for topoff.

Code: Select all

// *******************  Debounced ATO code. Activate ATO no more than every 30 seconds.  *******************
  if (ReefAngel.WaterLevel.GetLevel(0) < 98) LastATO=millis();    // Start a timer
  if (millis()-LastATO<30000 && millis()-LastATO>10)     // Has it been less than 30,000 ms? (30 secs)
    ReefAngel.Relay.Off(TopOff);                         // If so, make sure the topoff pump is off
  else
    ReefAngel.WaterLevelATO( ATO_Pump,720,34,36 );                     // Otherwise, use the normal topoff routine.
Replace the two 98's and the 100 with whatever your desired low and high levels are.

--Colin

Re: ATO delay

Posted: Wed Aug 12, 2015 11:59 am
by palmer
actually I am going to keep that code because the end result is the same I guess- What was happening was the chattering of the ATO trigger port when the ATO low is fired off- I was just trying to protect the pump. Obviously this also works to alleviate that.

Re: ATO delay

Posted: Wed Aug 12, 2015 12:06 pm
by cosmith71
Oh, I have that too. :geek:

Up in globals:

Code: Select all

static time_t LastATO=millis();    // For de-bounced ATO
Down in the loop:

Code: Select all

// *******************  Debounced ATO code. Activate ATO no more than every 60 seconds.  *******************
  if (!ReefAngel.LowATO.IsActive()) LastATO=millis();    // Start a timer
  if (millis()-LastATO<60000 && millis()-LastATO>10)     // Has it been less than 60,000 ms? (60 secs)
    ReefAngel.Relay.Off(TopOff);                         // If so, make sure the topoff pump is off
  else
    ReefAngel.SingleATOLow(TopOff);                      // Otherwise, use the normal topoff routine.
This may run backwards...if it does, take out the !.

--Colin