Auto-Water Change System

Cwalster

New member
Finally got my Robo-Tank setup and running - the Robo-tank software worked after the Reef-Pi software just kept having driver issues.
One of the primary tasks I wanted the controller for was to automate water changes. The sequence I am looking for is:
if saltwater tank is low, abort/send alert email.
Turn off the ATO port
Turn on the drain pump until either the low level sensor trips or a watchdog timer trips (so it doesn't drain the tank endlessly)
Turn on refill pump until high water level sensor trips or watchdog timer trips (so it doesn't flood)
turn the ATO port back on

From what I can tell, the rules system isn't able to do a sequence of events such as this, nor is it able to have an OR statement. If these exist, i'm all ears. At the same time, this is a raspberry pi running what looks to be C/C++, so I can make this thing do whatever I want given enough willpower/programming skill. Is there a way to trick it to run another script that I can write to make this work?
 
Finally got my Robo-Tank setup and running - the Robo-tank software worked after the Reef-Pi software just kept having driver issues.
One of the primary tasks I wanted the controller for was to automate water changes. The sequence I am looking for is:
if saltwater tank is low, abort/send alert email.
Turn off the ATO port
Turn on the drain pump until either the low level sensor trips or a watchdog timer trips (so it doesn't drain the tank endlessly)
Turn on refill pump until high water level sensor trips or watchdog timer trips (so it doesn't flood)
turn the ATO port back on

From what I can tell, the rules system isn't able to do a sequence of events such as this, nor is it able to have an OR statement. If these exist, i'm all ears. At the same time, this is a raspberry pi running what looks to be C/C++, so I can make this thing do whatever I want given enough willpower/programming skill. Is there a way to trick it to run another script that I can write to make this work?
Hi @Cwalster I think you should be able to do this with custom rules, you need a couple rules, here's how they should read.

If sensor 1 (saltwater tank) doesn't sense water turn off Outlet 1 (ATO), turn on Outlet 2 (drain pump), send alert.

If sensor 2 (saltwater tank) doesn't sense water turn on Outlet 3 (refill pump)

If sensor 3 (saltwater tank) senses water turn off Outlet 3 (refill pump), turn on Outlet 1 (ATO).

I think it's better to use sensors rather than a timer to turn the pumps on/off but you can use timers within the custom rules. When you select the outlet to switch, click it 3 times and the icon will turn red/green meaning it will turn it on for X number of seconds, then turn it off. You can also add delays between switching equipment. If you use multiple sensors you can use AND/OR statements as well.

The backend is c++, you can make changes to anything if you like. You can create a separate c++ program if you like and create a service on the Raspberry Pi so it runs in the background along with the app. If you search Google for "Create service on Raspberry Pi" you should get some instructions explaining how to do it. If I've misunderstood the water change or need more info let me know.
 
The goal of the timers is to act as a backup in the case of a sensor failure.

Let's say it takes 60 seconds to run the drain cycle.
Under normal circumstances, the minute elapses, the pump drains it to the low level sensor and shuts off. Everything is wonderful.
But let's say the sensor malfunctions and doesn't trip, but the water keeps going down. I just drained my sump to the point that no water circulates. If there is a backup timer, the water level is low, but I can pad things so there is still enough to keep everyone alive.
Or let's say I unplugged the drain pump. Ideally, the watchdog timer elapses and doesn't even attempt to run the fill pump, since something is amiss.

So having this as a built in function would be kind of nice, but I think I can work around it.

But if I'm understanding this right, a mix of schedules and rules might work:
Schedule:
ATO turns OFF at 1 am, then ON at 1:05 AM - this is an already automated solution, it just can't be running while the drain pump is running as well.
Custom rule of if saltwater TANK is LOW, ALERT, then drain pump OFF - and hopefully stay off.
schedule Drain pump ON 1 AM, drain pump OFF at 1:02 AM (watchdog) and custom rule of IF water LOW then drain pump OFF.
fill pump ON at 1:03 AM, fill pump OFF at 1:05 AM and (watchdog) custom rule of IF water HIGH then fill pump OFF.

This is operating under the assumption that rules and schedules layer on top of one another. IE - if the salt water tank is low, it wont ever let the drain pump turn on, even if something else is trying to turn it on. if the rules are one-shots, then we have a problem. The drain pump will go to low, the saltwater wont refill, but the ATO will try to replace all the missing water.
 
The goal of the timers is to act as a backup in the case of a sensor failure.

Let's say it takes 60 seconds to run the drain cycle.
Under normal circumstances, the minute elapses, the pump drains it to the low level sensor and shuts off. Everything is wonderful.
But let's say the sensor malfunctions and doesn't trip, but the water keeps going down. I just drained my sump to the point that no water circulates. If there is a backup timer, the water level is low, but I can pad things so there is still enough to keep everyone alive.
Or let's say I unplugged the drain pump. Ideally, the watchdog timer elapses and doesn't even attempt to run the fill pump, since something is amiss.

So having this as a built in function would be kind of nice, but I think I can work around it.

But if I'm understanding this right, a mix of schedules and rules might work:
Schedule:
ATO turns OFF at 1 am, then ON at 1:05 AM - this is an already automated solution, it just can't be running while the drain pump is running as well.
Custom rule of if saltwater TANK is LOW, ALERT, then drain pump OFF - and hopefully stay off.
schedule Drain pump ON 1 AM, drain pump OFF at 1:02 AM (watchdog) and custom rule of IF water LOW then drain pump OFF.
fill pump ON at 1:03 AM, fill pump OFF at 1:05 AM and (watchdog) custom rule of IF water HIGH then fill pump OFF.

This is operating under the assumption that rules and schedules layer on top of one another. IE - if the salt water tank is low, it wont ever let the drain pump turn on, even if something else is trying to turn it on. if the rules are one-shots, then we have a problem. The drain pump will go to low, the saltwater wont refill, but the ATO will try to replace all the missing water.
I hear you on the backup and there should be something in place for a critical pump. How about using a backup float switch port for the AC outlet or DC port you have the pumps connected to, it sounds like these are really want you need for safety. If these floats reset the pump will shut off no matter what the controller says to do as these are hardware based, the app doesn't know these ports exist.

I am planning to have schedules work with the custom rules but currently they don't.

ATO turns OFF at 1 am, then ON at 1:05 AM - this is an already automated solution, it just can't be running while the drain pump is running as well.

Adding a schedule isn't a bad idea but you could also include turning it on/off with the custom rules.

Custom rule of if saltwater TANK is LOW, ALERT, then drain pump OFF - and hopefully stay off.

For the drain pump you could use on of the backup float ports to ensure it stays off. If that float isn't making contact it's impossible for the pump to turn on. In case you were unaware, if you remove that round tab that holds the float on the body you can flip the float and it'll work backwards.

I'm a little unclear of the exact flow you are looking for, if you can list the actions needed in the order you want them we should be able to work out some rules.
 
Back
Top