Page 1 of 1

ATO if PH is less than 8.5 and Res is full

Posted: Thu Feb 06, 2014 8:30 am
by Smotz
All - will this work?

I want to ensure that I have at least 15% water in my reservoir AND PH is less than 8.5 for the ATO to activate. More importantly, I want the ATO to stop if PH hits 8.5

Code: Select all

// Main Top Off
    if ( ReefAngel.WaterLevel.GetLevel(2) >= 15 && ReefAngel.Params.PH<850) // Ensure there is 15% of water in the Top Off reservoir and PH is less than 8.5
    {      
      if ( ReefAngel.WaterLevel.GetLevel(1) <= 80 )  ReefAngel.Relay.On(Topoff);
      if ( ReefAngel.WaterLevel.GetLevel(1) >= 100 ) ReefAngel.Relay.Off(Topoff);
    }

Re: ATO if PH is less than 8.5 and Res is full

Posted: Thu Feb 06, 2014 9:09 am
by rimai
No :(
But almost there. You got the idea, you just missed one detail.
You need to make sure you turn off the relay should the level go below 15% or ph is greater than 8.5

Code: Select all

// Main Top Off
    if ( ReefAngel.WaterLevel.GetLevel(2) >= 15 && ReefAngel.Params.PH<850) // Ensure there is 15% of water in the Top Off reservoir and PH is less than 8.5
    {      
      if ( ReefAngel.WaterLevel.GetLevel(1) <= 80 )  ReefAngel.Relay.On(Topoff);
      if ( ReefAngel.WaterLevel.GetLevel(1) >= 100 ) ReefAngel.Relay.Off(Topoff);
    }
    else
    {
      ReefAngel.Relay.Off(Topoff);
    }

Re: ATO if PH is less than 8.5 and Res is full

Posted: Thu Feb 06, 2014 9:22 am
by Smotz
Much appreciated, sir. I assumed that since the relay is set off in the setup area it is by default. But, no harm specifying it!

Re: ATO if PH is less than 8.5 and Res is full

Posted: Thu Feb 06, 2014 9:26 am
by rimai
Well, setup section only happens when your controller boots up, but if you code like this, it would work just as well.

Code: Select all

// Main Top Off
    ReefAngel.Relay.Off(Topoff);
    if ( ReefAngel.WaterLevel.GetLevel(2) >= 15 && ReefAngel.Params.PH<850) // Ensure there is 15% of water in the Top Off reservoir and PH is less than 8.5
    {      
      if ( ReefAngel.WaterLevel.GetLevel(1) <= 80 )  ReefAngel.Relay.On(Topoff);
      if ( ReefAngel.WaterLevel.GetLevel(1) >= 100 ) ReefAngel.Relay.Off(Topoff);
    }