Page 1 of 1

Delay before ATO turns on.

Posted: Sat May 30, 2015 6:40 pm
by Sacohen
There is problem with my Water Level Sensor.
Very often it will drop down to 0% and the ATO will turn on for a second or so before the WL comes back to normal.

Until I can figure out why this is happening I would like to put a delay into the code that will not turn on the ATO until the minimum setting is at the level for 30 seconds or so.

I found this code, but I don't think it is really right for what I want.

Code: Select all

ReefAngel.Relay.DelayedOn(ATO_Pump,1);

Re: Delay before ATO turns on.

Posted: Sat May 30, 2015 7:43 pm
by lnevo
What I would recommend is instead of trying to flag the duration it's less than your minimum, just set the ATO to only be active for let's say 20 minutes per hour.... I'm thinking this might work better also because we could schedule it on a different 20 minute cycle from your de-nitrate dosing so things don't get messy.

Whatever the frequency and time we need, but this way you know in an hour or two hours you'll definitely need some top-off and you'll seriously reduce the time the anomalous 0% could happen.

what you think?

Re: Delay before ATO turns on.

Posted: Sun May 31, 2015 4:43 am
by Sacohen
Are you saying to not use the min and max and just have it run for 20 an hour or just set the min and max to be active for 20 min an hour.

Let's say X:35 to x:55?

Re: Delay before ATO turns on.

Posted: Sun May 31, 2015 6:56 am
by cosmith71
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( TopOff,6000,98,100 );                     // 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: Delay before ATO turns on.

Posted: Sun May 31, 2015 11:03 am
by lnevo
Simpler...

Code: Select all

if (now()%3600<1200) { ReefAngel.WaterLevelATO(TopOff, 98, 100); } else { ReefAngel.Relay.Off(TopOff); }
This will run the ATO for 20 minutes at :40 past the hour.

Re: Delay before ATO turns on.

Posted: Sun May 31, 2015 11:04 am
by lnevo
Actually Colin's performs the original request :) I thought it was Steve posting code based on what I had suggested

Re: Delay before ATO turns on.

Posted: Sun May 31, 2015 11:20 am
by Sacohen
Come on Lee, do you really think I could have come up with that code. Ha.

Colin this looks like it may be what I wanted. Thanks, I'll try it later.

Re: Delay before ATO turns on.

Posted: Mon Jun 01, 2015 5:20 pm
by Sacohen
Colin;

Should TopOff in your could be replaced by the port # or name of my ATO port?

Like this...

Code: Select all

  // *******************  Debounced ATO code. Activate ATO no more than every 30 seconds.  *******************
  if (ReefAngel.WaterLevel.GetLevel(0) < 34) 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(ATO_Pump);                         // If so, make sure the topoff pump is off
  else
    ReefAngel.WaterLevelATO( ATO_Pump,6000,34,36 );                     // Otherwise, use the normal topoff routine.
Also what sets the timeout?
For example my original ATO code was this...

Code: Select all

ReefAngel.WaterLevelATO(0,ATO_Pump,720,34,36);
Or is that what the 6000 in your code is?

Re: Delay before ATO turns on.

Posted: Mon Jun 01, 2015 5:36 pm
by cosmith71
Change this line:

Code: Select all

    ReefAngel.WaterLevelATO( ATO_Pump,720,34,36 );                     // Otherwise, use the normal topoff routine.
The 720 (6000 in the original code) is the timeout.

Re: Delay before ATO turns on.

Posted: Mon Jun 01, 2015 5:42 pm
by Sacohen
Ok that's what I thought.
Also I noticed that my code has a 0 before the port. That designates the single WL sensor, right?

Re: Delay before ATO turns on.

Posted: Mon Jun 01, 2015 5:50 pm
by cosmith71
I believe so.

Re: Delay before ATO turns on.

Posted: Mon Jun 01, 2015 5:51 pm
by Sacohen
Thanks man.

Re: Delay before ATO turns on.

Posted: Thu Jun 04, 2015 8:32 am
by Sacohen
I've been watching it the past couple of days and this doesn't seem to be working right.

I can't really determine what is going on, but it seems to be running for 30 seconds and then stops, but I think the system still thinks it's on because I get an ATO timeout and have to clear it before it starts again.

I put my original coed back in for now.

Thanks for the try.