Page 1 of 1

ATO with I/O expansion

Posted: Sun Dec 01, 2013 7:29 am
by 74sammy
So I picked up a couple of wp25s and decided to change things up a bit and picked up a few more things. Now I'm stuck.
What I have:
AI cable on ATO low
dimming expansion for wp25s
water level expansion for ATO reservoir
old RA moonlights on day/act ports
I/O expansion with 2 float switches ;set up for single ATO
buzzer on ATO high ;to be mounted in head unit with a wife friendly switch to "make it stop" until i get home

What I think I want to do:

if ATO float down for (seconds) and enough water in reservoir
turn on ato pump until float up for (seconds) or ATO timeout

if ATO reservoir low
sound buzzer (loop: beep,beep,beep,5 sec off)

if ATO reservoir full //for refilling
sound buzzer (single 5 second tone then stop)

if return float down turn off return and skimmer
sound buzzer (loop:1 sec on 1 sec off)

What I have now:

Code: Select all

// ATO---------------------------------------------------------
         static time_t LastATO=millis();
         if (ReefAngel IO.GetChannel(0) && ReefAngel.WaterLevel.GetLevel ()>10) LastATO=millis();
         if (millis()-LastATO<60000 && millis()-LastATO>100) 
         ReefAngel.Relay.On(Box1_Port6);
         else
         ReefAngel.Relay.Off (Box1_Port6);
        
         // short beep when RO reservoir is full
         if (ReefAngel.WaterLevel.GetLevel ()>90) 
         //buzzer// 
         // digitalWrite(highATOPin,HIGH); 
         
         //low top off water alarm
         if (ReefAngel.WaterLevel.GetLevel ()<10) 
         //buzzer// 
         // digitalWrite(highATOPin,HIGH); 
             
         // float switch for return shutoff on low water in sump
         if (ReefAngel IO.GetChannel(1)) ReefAngel.Relay.Off(Port5); 
         // buzzer// 
         // digitalWrite(highATOPin,HIGH);
(You are not authorized to post url links, please remove or rename:
ReefAngel(dot)IO ??)

I tried setting up the buzzer on an arduino uno with a button and led with the "blink without delay" code using millis from the arduino site, but I couldn't make it work right all of the time. Also, I cant figure out the timeout for the ATO either, the I/O class doesn't work like singleATO. Now I've been up all night and can't think.

Re: ATO with I/O expansion

Posted: Sun Dec 01, 2013 10:19 am
by rimai
You will be able to post url at 5 posts.
Let's do one thing at a time.
Let's start with ATO first.
Is it working like you wanted it to?

Re: ATO with I/O expansion

Posted: Mon Dec 02, 2013 1:31 pm
by 74sammy
lastATO is whatever value millis() is whenever the switches are triggered, and millis() just keeps increasing, so we just keep comparing millis() and lastATO until the difference is greater than 60000? Why do we need to know if its greater that 100? I have my relay On/Off in the wrong place above. I still dont have a timeout for the ATO pump. Would this work?

Code: Select all

if(ReefAngel.Relay.On(Box1_Port6) && ReefAngel IO.GetChannel(0)) timeout=millis();

if(millis()-timeout>60000);
ReefAngel.Relay.Off (Box1_Port6);

Re: ATO with I/O expansion

Posted: Mon Dec 02, 2013 2:34 pm
by rimai
>100 is just to make sure the controller has initialized before you change the relay status.
It may work without it too.
But if you add a ; at the end of the if statement above, it would end the statement and the next line would not be conditional. It would simply turn off the relay all the time.

Re: ATO with I/O expansion

Posted: Mon Dec 02, 2013 6:01 pm
by 74sammy
Had to change it to this to get it to compile

Code: Select all

// ATO timeout
             static time_t ATOtimeout=millis();
             if(ReefAngel.Relay.Status(Box1_Port6)==true && ReefAngel IO.GetChannel(0)) ATOtimeout=millis();
              if(millis()-ATOtimeout>60000)
              ReefAngel.Relay.Off (Box1_Port6);
That should turn the pump off after 1 minute, but it will come right back on due to the float switch still being active. I need a way to turn it off until I tell it to come back on. I would like to use ATO clear from the menu, but I could also go with just masking it off and using the app to set it back to auto.

Re: ATO with I/O expansion

Posted: Mon Dec 02, 2013 7:09 pm
by rimai
Ok, so if you want to use masks, instead of .Off, you need to use .Override(Box1_Port6,0);