Page 1 of 1
Water level expansion coding
Posted: Tue May 21, 2013 7:48 pm
by Ciwyn
So I'm just getting my reef angel up and running on my new tank. I was able to use the wizard to get a few things basically set up.
I have a very basic understanding of how the code works, I still have a lot to figure out before I feel like I could write anything. I figured a good place for me to start learning would be setting up my ATO to work with the water expansion module I purchased. I have the water level tube calibrated. I am just not sure what code to add, and where to add the code to make this all work.
I have even more elaborate plans for this such as an auto water change system. I figured just getting the top off working would be a good start though.
Thanks for any help.
Re: Water level expansion coding
Posted: Tue May 21, 2013 8:54 pm
by rimai
You can use this:
Code: Select all
ReefAngel.WaterLevelATO(Port1,30,65,68);
http://www.easte.net/RA/html/class_reef ... f160f6a39c
Re: Water level expansion coding
Posted: Wed May 22, 2013 5:35 am
by Ciwyn
Wow, its really that simple? That would go in the custom coding section? A 30 second timeout would be fine, then I just have to find the appropriate percentages for the water level.
Re: Water level expansion coding
Posted: Wed May 22, 2013 7:51 am
by rimai
Yes, in the custom section of your loop() function.
Re: Water level expansion coding
Posted: Wed May 22, 2013 9:33 am
by Sacohen
So the 30 is a 30 second time out after the water level reaches the max point.
If I wanted to do a 2 minute timeout would it be 120?
Re: Water level expansion coding
Posted: Wed May 22, 2013 9:44 am
by rimai
Yes, 30 is the number of seconds the ATO can run. If it runs for more than that, it will timeout and disable the ATO to prevent either overflow or pump running dry.
Re: Water level expansion coding
Posted: Wed May 22, 2013 9:58 am
by Sacohen
How would you increase that amount.
I'm going to be using a Tim's Aqua Lifer that puts in a very small amount of water thru airline tubing.
For example it take 10 minutes to fill my sump from the low level of 20 to the full setting of 26.
I have not incorporated the water Level extension into my code yet, because I was running some test to see how long it takes to fill from one point to another.
Re: Water level expansion coding
Posted: Wed May 22, 2013 10:02 am
by rimai
Just change it to the number of seconds you want...
10min = 600 seconds
Re: Water level expansion coding
Posted: Wed May 22, 2013 10:14 am
by Sacohen
OK. I just wasn't sure that it stayed as seconds all the way.
I work in video editing and I'm used to going from second to minutes to hours.
Thanks.
Re: Water level expansion coding
Posted: Sat Jun 01, 2013 12:59 pm
by Ciwyn
Well I've got the ATO function working well now. Next step is to code an automatic water change using the water level expansion. I would like to have the system turn on a pump plugged into port 5 turn on when I select water change mode. Then have it drain my sump down to a defined level. Once that is complete, turn on another pump on port 2 to pump new salt water from a reservoir back to the original water level.
It would be great to automate this even further and have it do this on a set schedule, however I think its best to do it manually for now.
I would also like to use the float switches now to monitor my ATO reservoir and my NSW reservoir. I found this code on another thread for using one of the switches.
ReefAngel.SingleATO(true,Port1,60,0);
if (ReefAngel.HighATO.IsActive()) ReefAngel.Relay.Off(Port1);
How would I modify this code for using both float switches in this manner? I also want to make sure the float switches do not interfere with my water level module for ATO functions.
This controller is great though!
Re: Water level expansion coding
Posted: Sat Jun 01, 2013 1:20 pm
by Ciwyn
ReefAngel.SingleATO(true,Port1,60,0);
if (ReefAngel.HighATO.IsActive()) ReefAngel.Relay.Off(Port1);
if (ReefAngel.LowATO.IsActive()) ReefAngel.Relay.Off(Port2,5);
Something like that for the float switches?
Re: Water level expansion coding
Posted: Sat Jun 01, 2013 2:06 pm
by rimai
Can you explain better how your logic would work?
Re: Water level expansion coding
Posted: Sat Jun 01, 2013 2:18 pm
by Ciwyn
Well the code I just posted there was my best guess at how to code the float switches to simply turn certain components off if the water level was low in the reservoirs.
The water change would be a completely different code. I would like to use the water level expansion for the water change.
When I select water change mode from the reef angel menu:
1. The ATO pump in port 1 would be deactivated (I already used the wizard to do this)
2. A pump in the sump (port 5) would be energized and pump water out of the sump until probably about 25% reading on the water level.
3. Once the water has been pumped out port 5 would be de-energized and a reef angel ATO pump would be energized on port 2. This pump would pump new salt water back into the sump back to the original level (currently 43% on my system)
Did that make a bit more sense than my first rambling? lol
Re: Water level expansion coding
Posted: Sun Jun 02, 2013 8:17 am
by rimai
I have not tested, but try this:
Code: Select all
static byte WC_status=0;
/*
0- No WC mode
1- WC started, so port5 is on
2- WC started and water has reached 25%, so port 5 is off and port2 is on
3- WC started and water has reached 43%, so port 2 is off
*/
if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE && WC_status==0)
{
ReefAngel.Relay.On(Port5);
WC_status=1;
}
if (ReefAngel.WaterLevel.GetLevel()<=25 && WC_status==1)
{
ReefAngel.Relay.Off(Port5);
ReefAngel.Relay.On(Port2);
WC_status=2;
}
if (ReefAngel.WaterLevel.GetLevel()>=43 && WC_status==2)
{
ReefAngel.Relay.Off(Port2);
WC_status=3;
}
if (ReefAngel.DisplayedMenu!=WATERCHANGE_MODE)
{
WC_status=0;
}
Re: Water level expansion coding
Posted: Sun Jun 02, 2013 5:50 pm
by Ciwyn
I can be the guinea pig on that one. It makes sense from reading it.
Is my coding correct in my post above for using the float switches as low water level indicators for my reservoirs? I just want to make sure that having the float switches plugged in doesn't try and override the water level module for the ATO function.
Thanks for you help. I'm really enjoying what I can do with this controller!
Re: Water level expansion coding
Posted: Sun Jun 16, 2013 2:14 pm
by Ciwyn
Just to let you know. I finally had a chance to test the water change coding and it works like a charm for anyone else who might be interested in using it! My ATO pump has to run for almost 20 minutes to get the water level back up but it works great.
Now I need to research a command that will automatically exit water change mode after its complete and find a way to display the water level on the water change screen.
Re: Water level expansion coding
Posted: Tue Jun 25, 2013 2:58 pm
by Ciwyn
So I am a bit stumped on how to add a timeout on the water change mode. I would like for it to do something similar to what happens when I push the feeding mode button. It just stays in that mode for the duration of the timer then exits after the timer expires.
Re: Water level expansion coding
Posted: Wed Jun 26, 2013 12:25 pm
by rimai
Do you do anything else after port 2 turns off?
Is it better to just terminated the wc mode at that time?
Re: Water level expansion coding
Posted: Thu Jun 27, 2013 2:16 pm
by Ciwyn
Nope, once port 2 turns off I'm done with my water change.
Re: Water level expansion coding
Posted: Thu Jun 27, 2013 2:18 pm
by rimai
Yeah, so if you are done, isn't it better to just quit wc mode instead of using a timer?
Re: Water level expansion coding
Posted: Sat Jul 20, 2013 7:44 am
by Ciwyn
Yes that is actually what I wanted it to do. Currently I have to quit water change mode manually and usually I have to reset my ATO timeout as well. I would like to find a way for it to quit WC mode automatically after the water change.
Re: Water level expansion coding
Posted: Sat Jul 20, 2013 8:33 am
by rimai
Change the 3rd stage to quit the mode to this:
Code: Select all
if (ReefAngel.WaterLevel.GetLevel()>=43 && WC_status==2)
{
ReefAngel.Relay.Off(Port2);
ButtonPress++;
WC_status=3;
}