I have been mentally thinking about this design until tonight I finally got the pump section running and just need to tie in the valve. Lets start with a picture.
Design
So the design is centered around as little room for error as possible. With the design simply flooding the low point in the sump maintained consistent by the RO/DI Top Off, too much will simply change more water and destroy pumps in fresh saltwater container. Not enough and the water simply does not get changed.
The worst possible scenario is the electric goes out in the middle of a water change. This is why a normally closed solenoid is used. If the electric goes out the valve closes and stops the water from draining out of the sump. The program restarts a 24 hour timer thus extending the period between water changes, but removing the risk of opening the valve while the sump has not stabilized after a power outage.
Controller
The circuit board uses an arduino with two analog relays and two modified extension cords to turning the pumps/valve on and off. The circuit is set to follow the following commands every 24 hours: opens the valve, waits x amount of seconds, turns on the pumps, waits x amount of seconds, turns off the pump, waits x amount of seconds, then turns off the valve. If the electric goes out at any point the 24 hour counter starts over and the valves all close automatically due to being normally closed.
There is also a manual button that manually fires the water change function for adding additional water changes.
What is the benefit?
This will allow me to break up water changes to every day or even a couple times a day and increase/decrease based on water quality. This not only makes the tank more stable, it also reduces the maintenance to mixing fresh saltwater once per month depending on reservoir capacity.
Now increasing water changes simply means making more saltwater and changing a couple settings or hitting a manual button a couple times.
Design
So the design is centered around as little room for error as possible. With the design simply flooding the low point in the sump maintained consistent by the RO/DI Top Off, too much will simply change more water and destroy pumps in fresh saltwater container. Not enough and the water simply does not get changed.
The worst possible scenario is the electric goes out in the middle of a water change. This is why a normally closed solenoid is used. If the electric goes out the valve closes and stops the water from draining out of the sump. The program restarts a 24 hour timer thus extending the period between water changes, but removing the risk of opening the valve while the sump has not stabilized after a power outage.
Controller
The circuit board uses an arduino with two analog relays and two modified extension cords to turning the pumps/valve on and off. The circuit is set to follow the following commands every 24 hours: opens the valve, waits x amount of seconds, turns on the pumps, waits x amount of seconds, turns off the pump, waits x amount of seconds, then turns off the valve. If the electric goes out at any point the 24 hour counter starts over and the valves all close automatically due to being normally closed.
There is also a manual button that manually fires the water change function for adding additional water changes.
What is the benefit?
This will allow me to break up water changes to every day or even a couple times a day and increase/decrease based on water quality. This not only makes the tank more stable, it also reduces the maintenance to mixing fresh saltwater once per month depending on reservoir capacity.
Now increasing water changes simply means making more saltwater and changing a couple settings or hitting a manual button a couple times.
Code:
#include "Time.h"
#include "TimeAlarms.h"
#define SECONDS_IN_DAY 86400
#define VALVE 22
#define PUMP 26
#define BUTTON 40
void setup()
{
pinMode(BUTTON, INPUT);
pinMode(VALVE, OUTPUT);
pinMode(PUMP, OUTPUT);
digitalWrite(VALVE, LOW);
digitalWrite(PUMP, LOW);
//repeat cycle every 60 seconds * 60 minutes * 24 Hours = 24 Hours in seconds
Alarm.timerRepeat( SECONDS_IN_DAY , WaterChange);
}
int state = 0;
void loop(){
//allow button to force waterchange
state = digitalRead(BUTTON);
if( state == HIGH)
{
WaterChange();
}
Alarm.delay(100);
}
void WaterChange(){
//open valve
digitalWrite(VALVE, HIGH);
//wait 15 seconds
Alarm.delay(15000);
//turn on pump
digitalWrite(PUMP, HIGH);
//allow pump to remain on for 30 seconds
Alarm.delay(30000);
//turn off pump
digitalWrite(PUMP, LOW);
//wait 60 seconds to drain
Alarm.delay(60000);
//close valve
digitalWrite(VALVE,LOW);
}