Delay before ATO turns on.

Do you have a question on how to do something.
Ask in here.
Post Reply
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Delay before ATO turns on.

Post 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);
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Delay before ATO turns on.

Post 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?
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Delay before ATO turns on.

Post 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?
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Delay before ATO turns on.

Post 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
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Delay before ATO turns on.

Post 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.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Delay before ATO turns on.

Post by lnevo »

Actually Colin's performs the original request :) I thought it was Steve posting code based on what I had suggested
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Delay before ATO turns on.

Post 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.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Delay before ATO turns on.

Post 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?
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Delay before ATO turns on.

Post 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.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Delay before ATO turns on.

Post 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?
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Delay before ATO turns on.

Post by cosmith71 »

I believe so.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Delay before ATO turns on.

Post by Sacohen »

Thanks man.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Delay before ATO turns on.

Post 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.
Post Reply