Ports on Based on Water Level

Do you have a question on how to do something.
Ask in here.
Post Reply
Dadof2boys
Posts: 11
Joined: Sat Oct 10, 2015 7:46 am

Ports on Based on Water Level

Post by Dadof2boys »

I have the Multi-Channel Water Level module and what I want to do is determine the water level for channels 1 and 3 and then turn on or off ports based on the two levels.

Water level channel 1 is my sump level and water level channel 3 is my skimmer sump level. Water flows from my main sump (channel 1) into the skimmer sump (channel 3) then returns to the main sump after the skimmer from the skimmer outlet.

What I'm looking for is if the channel 3 level gets to high then to turn off the pump that takes water from the main sump into the skimmers sump. In this case that pump runs on port 7. Now, if the skimmer sump gets too low then I want to turn off the skimmer's return pump (port 8). Same on the main sump -- if the water level gets to high then turn off port 8 in the skimmer so it will stop pumping water from the skimmer sump into the main sump and if it gets too low shut off port 7 so it will stop pumping water to the skimmer sump.

Now, for the million dollar question -- how in the world do I code for this?

Thanks!
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Ports on Based on Water Level

Post by rimai »

Try this code:

Code: Select all

ReefAngel.Relay.Set(Port7, ReefAngel.WaterLevel.GetLevel(1)<65);
ReefAngel.Relay.Set(Port8, ReefAngel.WaterLevel.GetLevel(3)>37);
Roberto.
Dadof2boys
Posts: 11
Joined: Sat Oct 10, 2015 7:46 am

Re: Ports on Based on Water Level

Post by Dadof2boys »

Now the problem I'm running into is when one of the water levels hits just under the minimum it turns off and then as soon as it hits the right number it flips back on... It's flipping on, off, on, off and so forth. I'm afraid that it will eventually burn up the pumps.

Is there a way to specify a range? For example, if the water level 3 is at 90 or above turn on but don't turn off until it reaches 85?

I tried writing an If Then statement but I could not get the code to compile. I was trying to create an if then statement on based on the 90/85 levels.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Ports on Based on Water Level

Post by rimai »

Something like this?

Code: Select all

if (ReefAngel.WaterLevel.GetLevel(1)<65) ReefAngel.Relay.On (Port7);
if (ReefAngel.WaterLevel.GetLevel(1)>70) ReefAngel.Relay.Off (Port7);
Roberto.
Dadof2boys
Posts: 11
Joined: Sat Oct 10, 2015 7:46 am

Re: Ports on Based on Water Level

Post by Dadof2boys »

Thanks... My issue with the If Then statement was that I was capitalizing the I in if. As soon as I made that change and uploaded the new code, all was well.
Post Reply