Water level expansion coding

Do you have a question on how to do something.
Ask in here.
Post Reply
Ciwyn
Posts: 24
Joined: Tue May 21, 2013 6:18 pm

Water level expansion coding

Post 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.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Water level expansion coding

Post by rimai »

You can use this:

Code: Select all

  ReefAngel.WaterLevelATO(Port1,30,65,68);
http://www.easte.net/RA/html/class_reef ... f160f6a39c
Roberto.
Ciwyn
Posts: 24
Joined: Tue May 21, 2013 6:18 pm

Re: Water level expansion coding

Post 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.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Water level expansion coding

Post by rimai »

Yes, in the custom section of your loop() function.
Roberto.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Water level expansion coding

Post by Sacohen »

rimai wrote:You can use this:

Code: Select all

  ReefAngel.WaterLevelATO(Port1,30,65,68);
http://www.easte.net/RA/html/class_reef ... f160f6a39c

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?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Water level expansion coding

Post 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.
Roberto.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Water level expansion coding

Post 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.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Water level expansion coding

Post by rimai »

Just change it to the number of seconds you want...
10min = 600 seconds
Roberto.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Water level expansion coding

Post 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.
Ciwyn
Posts: 24
Joined: Tue May 21, 2013 6:18 pm

Re: Water level expansion coding

Post 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!
Ciwyn
Posts: 24
Joined: Tue May 21, 2013 6:18 pm

Re: Water level expansion coding

Post 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?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Water level expansion coding

Post by rimai »

Can you explain better how your logic would work?
Roberto.
Ciwyn
Posts: 24
Joined: Tue May 21, 2013 6:18 pm

Re: Water level expansion coding

Post 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
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Water level expansion coding

Post 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;
  }
Roberto.
Ciwyn
Posts: 24
Joined: Tue May 21, 2013 6:18 pm

Re: Water level expansion coding

Post 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!
Ciwyn
Posts: 24
Joined: Tue May 21, 2013 6:18 pm

Re: Water level expansion coding

Post 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.
Ciwyn
Posts: 24
Joined: Tue May 21, 2013 6:18 pm

Re: Water level expansion coding

Post 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.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Water level expansion coding

Post by rimai »

Do you do anything else after port 2 turns off?
Is it better to just terminated the wc mode at that time?
Roberto.
Ciwyn
Posts: 24
Joined: Tue May 21, 2013 6:18 pm

Re: Water level expansion coding

Post by Ciwyn »

Nope, once port 2 turns off I'm done with my water change.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Water level expansion coding

Post by rimai »

Yeah, so if you are done, isn't it better to just quit wc mode instead of using a timer?
Roberto.
Ciwyn
Posts: 24
Joined: Tue May 21, 2013 6:18 pm

Re: Water level expansion coding

Post 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.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Water level expansion coding

Post 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;
  }
Roberto.
Post Reply