- Joined
- Nov 22, 2016
- Messages
- 261
- Reaction score
- 185
I wanted to share my controller. This started off as an auto top off system after I left my RO on all night and flooded the kitchen. From there I just kept adding stuff. It’s not perfect in many ways but it works well for me and I really enjoy working on it. I just wanted to share with like minded people!
It runs on a Raspberry Pi and is designed to require as few services and libraries as possible. It can function under a default install of Apache and PHP. A crontab is required too. It does the following.
The ATO is controlled by solenoid valves.
Two float valves sit in the sump to measure the water level and trigger the ATO. I have been meaning to install a 3rd optical for...2 years now
.
The ATO is designed with the following principles:
Number 1 Rule
Pretty straight forward, set a min temp, a max temp, and that's all. The Pi will read a heater and turn it on and off accordingly. If the temp gets too high or too low an alert will be generated. I use a DS18B20 Waterproof Temp Sensor (the plastic one).
Smart Power Strip
I used a network-based smart power strip (Digital Loggers Web Power) and wrote a class to access it via the Pi. I plan to migrate to a custom power strip when this thing fails (and it will eventually), but I am too happy with it to replace it prior to that. It works great and controls most of the tank. This is where most of the cost of the system is. A custom strip can bring the cost down significantly.
Dosing Pump
I got the coralbox wifi dosing pump and wrote another class to access it via the Pi. This is relatively new, but so far it has worked great and allows me to dose calcium, alkalinity, and magnesium, and remove water from the tank via the Pi.
Water Change Prep
One of the solenoids connects water to a 30 gallon brute bucket with a few floats on it. I can schedule the bucket be filled to a certain percentage and heated.
Camera Feeds
The controller picks up still images from a few RTSP feeds and uses the Pi camera. They show pictures of the ATO system, the sump, and the tank. Nothing else fancy going on here, just for my own piece of mind.
Data Trends and Alerting
The controller graphs temperature, ATO durations, and time between ATOs. I also used to monitor PH, but I found that the probe was unreliable and didn’t provide much value aside from overdose protection. I have plans to implement a salinity probe soon. If the salinity is too high, the system would remove water from the tank replace it with fresh ATO water.
Miscellaneous Features
Leak detection - There are three leak sensors where water completes the circuit. If water is detected there is an out-of-band shut off. I do plan to install a manual leak sensor (the one with the pad). I don't have a great spot for it yet.
Flow - A cron script randomly turns a wavemaker on and off during the day.
User Interface
Here are some screenshots of the UI. I suck at making things look nice, but this layout works with my brain.
Home Page
Shows historical ATO and bucket jobs as well as anything running or scheduled. It also shows the status of each solenoid connected to the system. The colors of the squares change depending on their status. The numbers next to the status (for example Master Valve 23 on) indicate the GPIOs they are on.
The very top of the page displays the global status of the ATO and bucket systems. You can click on them to turn them on and off. For example, if you were doing a water change and you didn't want the ATO to trigger, you would just turn it off for the duration of the change. The top of the page also displays any alerts generated for the day and the real time temperature.
Lastly, my favorite part, the icon changes to one of 5 random cartoons every time you load the page
.
Variables Page (Wrench Icon)
This page allows you to update what I call the master variables associated with the program. For example, what GPIO a device is on, how long an ATO job can run, who email alerts should get sent to, etc. There are a lot of them, this is just one section.
Thermostat Page (Flame Icon)
Allows you to view actions associated with the thermostat script as well as turn it on and off globally. Pretty straight forward.
Camera Feeds (Camera Icon)
Again, pretty straight forward. A still shot of the latest feed. Here is one.
ATO
The ATO runs on its own from a cronjob. However, this page allows you to view, create, or delete ATO jobs. You would create a job if you just wanted to pump water into the tank for some reason. You would delete a job if you wanted to free up runtime from the day for some error that occured. Otherwise it displays historical jobs, statistics, and logs. The system has produced about 7000 ATO jobs….allegedly. A lot of those were during development but it’s still in the magnitude of thousands. It’s been running for over 2 years now, very cool.
Bucket
This is the exact same as ATO, except you can schedule a date and time to fill the bucket. You can activate a heater and powerhead when the bucket is 50% full.
Control
This page interacts with the powerstrip to turn things on and off. It has an emergency shutoff button to turn off all valves as well as a maintenance mode button for water change (turns pumps off, ATO off, etc). Just click on the icon to turn it on or off. Clicking on “Pi” triggers a power cycle vs. hard on/off.
Doser
This interacts with the coralbox wifi doser to dose whatever head and amount you input.
Data
Historical look at statistics. You can adjust the ranges as you see fit. The ATO graph shows time between topoffs and the duration of each topoff.
And here is a picture of the Pi and the tank.
The end, thanks for reading!
It runs on a Raspberry Pi and is designed to require as few services and libraries as possible. It can function under a default install of Apache and PHP. A crontab is required too. It does the following.
- ATO
- Thermostat
- Smart Power Strip w/ 8 outlets
- Dosing
- Water change prep (fills a bucket and heats water)
- Camera feeds
- Data, trends, and alerting/actions
The ATO is controlled by solenoid valves.
- The master valve, which sits in front of the RO machine
- A bucket valve, which is piped to a 30 gallon brute bucket with a float valve
- An ATO valve, which is piped to my sump with a float valve
Two float valves sit in the sump to measure the water level and trigger the ATO. I have been meaning to install a 3rd optical for...2 years now
.The ATO is designed with the following principles:
Number 1 Rule
- Protection of the home and safety take priority over protection of the aquarium.
- All sensors “detect water” when their circuit is broken (read a 0 vs 1). This protects against physical disconnects.
- There must be more than one water sensor. This adds sensor redundancy.
- There must be a way to detect leaks. When a leak is detected, there must be a way to auto shut off the ATO external to the primary system (redundant system, manual leak valve, etc.).
- There must be a float valve that terminates the ATO path in the tank. When triggered water must go down a drain.
- If no water is detected on all sensors, top off for minimum X, maximum Y or until floats detect water after X.
- X ensures that jobs run for a minimum amount of time. This way your ATO tops off slightly above your sensors to prevent the ATO from constantly triggering. My X is two minutes, but it only needs to top off for about one to trigger the sensors. It turns on every ~2 hours in the winter, ~4 hours in the summer (when the air more humid). And yes, this does wear my RO out faster!
- Y indicates the maximum time a job can run, in case a sensor is stuck as not detecting water or there is another issue (return pump, etc). If a job reaches its max time an email alert is sent. My Y is six minutes.
- There must be a minimum interval Z between ATO jobs. This ensures jobs don't kick off successively if there is an imbalance or issue. Too many jobs occurring on or close to exactly Z should generate an alert or action. If there is an error, like a job reaching its max run time, the interval should be larger. My Z is 15 minutes with an error back off of 30 minutes. This has saved me a number of times after water changes and/or return pump issues.
- There must be a total maximum amount of runtime allowed for a 24 hour (or less) period. This prevents the system from topping off too much, if there is an issue. The ATO will not trigger if the maximum topoff time is reached for the day. My max runtime is 30 minutes. The max runtime has triggered on my system, but only when there were known issues or I intentionally let it run.
- There must be a way to override all ATO logic and manually turn on a job (regardless of sensor input) or shut off the system should an issue occur while you are away. This has come in handy, for many reasons.
- There must be more than one solenoid in the ATO path for redundancy.
- Solenoids must fail “off”. I.e., they only open when power is applied.
- Solenoids must not get too hot. Constant hot/cold can crack plastic. If your solenoid must be on for so long it gets too hot to touch, you either should get a faster ATO or not do ATO. Basically, it is important that your RO machine be reasonably fast or slow if applied specifically for ATO. If your ATO is too fast, a disaster could be way worse. If your ATO is too slow, your valves could get too hot. It needs to be just right. What is “just right?” I don’t know. But if it gets too hot for me to hold then I don’t like it. I have had other plastic crack from heat stress.
- Relays must also not get too hot. They should also be easily inspectable.
- Relays and solenoids should be proactively replaced and periodically inspected.
Pretty straight forward, set a min temp, a max temp, and that's all. The Pi will read a heater and turn it on and off accordingly. If the temp gets too high or too low an alert will be generated. I use a DS18B20 Waterproof Temp Sensor (the plastic one).
Smart Power Strip
I used a network-based smart power strip (Digital Loggers Web Power) and wrote a class to access it via the Pi. I plan to migrate to a custom power strip when this thing fails (and it will eventually), but I am too happy with it to replace it prior to that. It works great and controls most of the tank. This is where most of the cost of the system is. A custom strip can bring the cost down significantly.
Dosing Pump
I got the coralbox wifi dosing pump and wrote another class to access it via the Pi. This is relatively new, but so far it has worked great and allows me to dose calcium, alkalinity, and magnesium, and remove water from the tank via the Pi.
Water Change Prep
One of the solenoids connects water to a 30 gallon brute bucket with a few floats on it. I can schedule the bucket be filled to a certain percentage and heated.
Camera Feeds
The controller picks up still images from a few RTSP feeds and uses the Pi camera. They show pictures of the ATO system, the sump, and the tank. Nothing else fancy going on here, just for my own piece of mind.
Data Trends and Alerting
The controller graphs temperature, ATO durations, and time between ATOs. I also used to monitor PH, but I found that the probe was unreliable and didn’t provide much value aside from overdose protection. I have plans to implement a salinity probe soon. If the salinity is too high, the system would remove water from the tank replace it with fresh ATO water.
Miscellaneous Features
Leak detection - There are three leak sensors where water completes the circuit. If water is detected there is an out-of-band shut off. I do plan to install a manual leak sensor (the one with the pad). I don't have a great spot for it yet.
Flow - A cron script randomly turns a wavemaker on and off during the day.
User Interface
Here are some screenshots of the UI. I suck at making things look nice, but this layout works with my brain.
Home Page
Shows historical ATO and bucket jobs as well as anything running or scheduled. It also shows the status of each solenoid connected to the system. The colors of the squares change depending on their status. The numbers next to the status (for example Master Valve 23 on) indicate the GPIOs they are on.
The very top of the page displays the global status of the ATO and bucket systems. You can click on them to turn them on and off. For example, if you were doing a water change and you didn't want the ATO to trigger, you would just turn it off for the duration of the change. The top of the page also displays any alerts generated for the day and the real time temperature.
Lastly, my favorite part, the icon changes to one of 5 random cartoons every time you load the page
.Variables Page (Wrench Icon)
This page allows you to update what I call the master variables associated with the program. For example, what GPIO a device is on, how long an ATO job can run, who email alerts should get sent to, etc. There are a lot of them, this is just one section.
Thermostat Page (Flame Icon)
Allows you to view actions associated with the thermostat script as well as turn it on and off globally. Pretty straight forward.
Camera Feeds (Camera Icon)
Again, pretty straight forward. A still shot of the latest feed. Here is one.
ATO
The ATO runs on its own from a cronjob. However, this page allows you to view, create, or delete ATO jobs. You would create a job if you just wanted to pump water into the tank for some reason. You would delete a job if you wanted to free up runtime from the day for some error that occured. Otherwise it displays historical jobs, statistics, and logs. The system has produced about 7000 ATO jobs….allegedly. A lot of those were during development but it’s still in the magnitude of thousands. It’s been running for over 2 years now, very cool.
Bucket
This is the exact same as ATO, except you can schedule a date and time to fill the bucket. You can activate a heater and powerhead when the bucket is 50% full.
Control
This page interacts with the powerstrip to turn things on and off. It has an emergency shutoff button to turn off all valves as well as a maintenance mode button for water change (turns pumps off, ATO off, etc). Just click on the icon to turn it on or off. Clicking on “Pi” triggers a power cycle vs. hard on/off.
Doser
This interacts with the coralbox wifi doser to dose whatever head and amount you input.
Data
Historical look at statistics. You can adjust the ranges as you see fit. The ATO graph shows time between topoffs and the duration of each topoff.
And here is a picture of the Pi and the tank.
The end, thanks for reading!

