Modified ATO to monitor reservoir

Do you have a question on how to do something.
Ask in here.
Post Reply
ufgators2k
Posts: 57
Joined: Sun May 12, 2013 2:21 pm

Modified ATO to monitor reservoir

Post by ufgators2k »

I am new to the Reef Angel but I currently have a JBJ Auto Top Off that has a mode where one float switch goes in the sump and the other in the ATO reservoir to turn off the pump if the water level is too low. I created a custom ATO function to perform this same function (based off of StandardATO) that assumes both float sensors are in the "wires up" position. I believe this should work (please let me know if I missed something):

in ReefAngel.h:
void CustomATO(byte ATORelay, int ATOTimeout);

in ReefAngel.cpp:

Code: Select all

 
/* This function activiates the ATO pump to refill (ATOLow Active) if the reservoir
   is not empty (ATO high inactive). It also limits the time the ATO pump can run to the
   ATOTimeout value (s).
*/
void ReefAngelClass::CustomATO(byte ATORelay, int ATOTimeout)
{
    // Input:  Relay port and timeout value (max number of seconds that ATO pump is allowed to run)
	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. Before enabling the top-off pump,
	check if the reservoir has water.
	*/
    if ( !HighATO.IsActive() )
    {
       LED.Off();
	   if ( LowATO.IsActive() && ( !LowATO.IsTopping()) )
      {
           LowATO.Timer = millis();
           LowATO.StartTopping();
           Relay.On(ATORelay);
       }
	   // Low switch is deactivated so turn off the pump
	   else if ( (!LowATO.IsActive()) && (LowATO.IsTopping()) )
	   {
		   LowATO.StopTopping();  // stop the low ato timer
		   Relay.Off(ATORelay);
	   }
    }
    else LED.On(); // Turn on the LED if the water level in the reservoir is low

    /*
    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) && LowATO.IsTopping() )
	{
		LED.On();
		bitSet(Flags,ATOTimeOutFlag);
#ifdef ENABLE_EXCEED_FLAGS
		if (InternalMemory.read(ATO_Exceed_Flag)==0)
			InternalMemory.write(ATO_Exceed_Flag, 1);
#endif  // ENABLE_EXCEED_FLAGS
		Relay.Off(ATORelay);
#ifdef ENABLE_ATO_LOGGING
		// bump the counter if a timeout occurs
		AtoEventCount++;
		if ( AtoEventCount >= MAX_ATO_LOG_EVENTS ) { AtoEventCount = 0; }
#endif  // ENABLE_ATO_LOGGING
	}
}
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Modified ATO to monitor reservoir

Post by rimai »

Actually StandardATO assumes one wire up and one wire down.
But I think you are over complicating this :?
I would suggest this in your loop():

Code: Select all

  ReefAngel.SingleATO(true,Port1,60,0);
  if (ReefAngel.HighATO.IsActive()) ReefAngel.Relay.Off(Port1);
Roberto.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Modified ATO to monitor reservoir

Post by lnevo »

Yeah, that is what most people have used to replicate the JBJ type behavior.
ufgators2k
Posts: 57
Joined: Sun May 12, 2013 2:21 pm

Re: Modified ATO to monitor reservoir

Post by ufgators2k »

Thanks for the quick replies. I will implement it that way instead.
Image
Post Reply