Page 1 of 1

ATO with Multi-Channel Water Level Sensor

Posted: Wed Mar 19, 2014 6:26 am
by Paul_Velasco
Finally able to start playing with the controller.

I started by programming my ATO based on level measured by Water Level Sensor Channel 4
On at 48% and off at 50%

Code: Select all

if (ReefAngel.WaterLevel.GetLevel(4)<=48) ReefAngel.Relay.On(Box1_Port7);
if (ReefAngel.WaterLevel.GetLevel(4)>=50) ReefAngel.Relay.Off(Box1_Port7);
Code works perfectly!!!

I wanted to add some functionality to the code:
Pump is kind of loud so I only want it to work when no one is in the house or when we are awake
Check to see if the ATO reservoir has water in it and at a level that the Kalkwasser will not suck up the bottom

Code: Select all

     if (ReefAngel.WaterLevel.GetLevel(1)>0) //Check level in ATP Res
    {
      if (hour()>6 && hour()<21) //Only work when no one is at house
      {
        if (ReefAngel.WaterLevel.GetLevel(4)<=48) ReefAngel.Relay.On(Box1_Port7);
        if (ReefAngel.WaterLevel.GetLevel(4)>=50) ReefAngel.Relay.Off(Box1_Port7);
      }
    }
This does not work?? Is the logic flawed?

Re: ATO with Multi-Channel Water Level Sensor

Posted: Wed Mar 19, 2014 6:50 am
by Paul_Velasco
So I had a few cups of coffee and thought about this a bit:

Code: Select all

     if (hour()>6 && hour()<21) //Only work when no one is at house
    {
         if (ReefAngel.WaterLevel.GetLevel(4)<=48 && ReefAngel.WaterLevel.GetLevel(1)>0) ReefAngel.Relay.On(Box1_Port7);
         if (ReefAngel.WaterLevel.GetLevel(4)>=50) ReefAngel.Relay.Off(Box1_Port7);
    }

Re: ATO with Multi-Channel Water Level Sensor

Posted: Wed Mar 19, 2014 9:09 am
by rimai
I think that works :)

Re: ATO with Multi-Channel Water Level Sensor

Posted: Wed Mar 19, 2014 9:12 am
by rimai
On another thought, no... :(
Use this:

Code: Select all

     if (hour()>6 && hour()<21) //Only work when no one is at house
    {
         if (ReefAngel.WaterLevel.GetLevel(4)<=48 && ReefAngel.WaterLevel.GetLevel(1)>0) ReefAngel.Relay.On(Box1_Port7);
         if (ReefAngel.WaterLevel.GetLevel(4)>=50) ReefAngel.Relay.Off(Box1_Port7);
    }
    else
    {
        ReefAngel.Relay.Off(Box1_Port7);
    }
Just to ensure that Box1_Port7 will be off when not within those hours.

Re: ATO with Multi-Channel Water Level Sensor

Posted: Wed Mar 19, 2014 10:11 am
by Paul_Velasco
Thank Roberto. I will try to upload tonight

Re: ATO with Multi-Channel Water Level Sensor

Posted: Thu Mar 20, 2014 9:12 am
by Paul_Velasco
Did not work???

Code: Select all

         if (hour()>6 && hour()<21) //Only work when no one is at house
        {
             if (ReefAngel.WaterLevel.GetLevel(4)<=48 && ReefAngel.WaterLevel.GetLevel(1)>0) ReefAngel.Relay.On(Box1_Port7);
             if (ReefAngel.WaterLevel.GetLevel(4)>=50) ReefAngel.Relay.Off(Box1_Port7);
        }
        else
        {
            ReefAngel.Relay.Off(Box1_Port7);
        }
Took out the time condition - Did not work
Took out ReefAngel.WaterLevel.GetLevel(1)>0 - Worked!!!

Tried this also??? Did not work

Code: Select all

         if (hour()>6 && hour()<21) //Only work when no one is at house
        {
             if (ReefAngel.WaterLevel.GetLevel(4)<=48) ReefAngel.Relay.On(Box1_Port7);
             if (ReefAngel.WaterLevel.GetLevel(4)>=50) ReefAngel.Relay.Off(Box1_Port7);
        }
        else
        {
            ReefAngel.Relay.Off(Box1_Port7);
        }
What am I doing wrong? I can post all the code if need be.

Re: ATO with Multi-Channel Water Level Sensor

Posted: Thu Mar 20, 2014 10:24 am
by rimai
Is channel 1 greater than 0%?

Re: ATO with Multi-Channel Water Level Sensor

Posted: Thu Mar 20, 2014 11:18 am
by Paul_Velasco
Portal says:

Channel 1 = 52 (This is my ATO tank)
Channel 4 = 49 (My Sump)

Re: ATO with Multi-Channel Water Level Sensor

Posted: Thu Mar 20, 2014 11:24 am
by lnevo
That would be an OFF condition...

Re: ATO with Multi-Channel Water Level Sensor

Posted: Thu Mar 20, 2014 11:29 am
by lnevo
Also, something to keep in mind, the water level sensors tend to bounce a little bit.. you may not even see it based on the drawing refresh on the screen.. but between 48-50 if the level is 49.. it could be bouncing +1/-1 pretty easily. I would recommend opening up that window a little bit.. maybe 47-51 at least for troubleshooting purposes.

Re: ATO with Multi-Channel Water Level Sensor

Posted: Thu Mar 20, 2014 12:12 pm
by Paul_Velasco
lnevo wrote:That would be an OFF condition...
Not if the time is between 6AM and 9PM?

It just will never come on when I have two conditional statements:

Using time based to turn off the ATO = between 9PM and 6AM
And using a second channel = to check if my ATO tank is not empty (Channel 1 is not 0)


If I use the water level sensor (Channel 4) to turn on and off it works perfectly. If I use any other conditions it fails.

I will take your suggestion as the pump does cycle quite a bit with the window at 48-50

Re: ATO with Multi-Channel Water Level Sensor

Posted: Thu Mar 20, 2014 12:17 pm
by lnevo
I was just pointing out it was an OFF condition because your water level was at 49. It only turns on when below 48 and turns off when it gets to 50 based on the ruleset.

If you can remove some water and ensure that the water level is well below 48 then I think you might see different results. There's no reason that multiple conditions should not work.

Re: ATO with Multi-Channel Water Level Sensor

Posted: Thu Mar 20, 2014 12:48 pm
by Paul_Velasco
This morning, 6:30AM, Channel 4 was at 41 and Channel 1 was >0 and ATO was off. This is why I started to post to ask for help.

I will open the on window on Channel 4 tonight - 47 on and 51 off. Will put back code to check Channel 1 >0
Will then lift Channel 4 and see what happens.

Second will change to time based on/off. I will change the controller time to a few minutes before 6AM. Then I will lift Channel 4 before the time changes to 6.

If both tests work I will include a code to use both conditions??

Re: ATO with Multi-Channel Water Level Sensor

Posted: Thu Mar 20, 2014 12:52 pm
by lnevo
Your code says hour()>6

So 6:30 is not enough time :) It won't go on until 7am.

If you want it to actually start at 6am, make it >=6

Re: ATO with Multi-Channel Water Level Sensor

Posted: Thu Mar 20, 2014 1:31 pm
by Paul_Velasco
Wow you got it! I will implement tonight.

Re: ATO with Multi-Channel Water Level Sensor

Posted: Thu Mar 20, 2014 7:54 pm
by Paul_Velasco
Works with >=