Raspberry PI Swimming Pool Controller - poolBot

Raspberry PI Swimming Pool Controller - poolBot

projects raspberry pi pool automation relays

poolBot is a Raspberry Pi based pool controller. its responsibility is controlling and monitoring the swimming pool and spa, this is a DYI solution to overpriced pool automation platforms.

a little history. 2 years ago my main pump died, i found a good deal on woot.com for a pentair variable speed pump. however i didn't have a intelli touch system, or any other fancy pool automation. what i did have was a Jandy controller from i think the 90's. it had a huge cable that ran into our master bedroom with a simple 4 button control panel, and smaller panel for the spa. this had simple functions like turn on heater, light, and spa. it also displayed the wrong temp. eventually water go into this old controller and it no longer functioned as a simple timer. time to build my own.

i had read about a project called nodejs-Pentair, which eventually became nodejs-poolController. it was useful in that it could talk to my pump, but i didn't have a pentair intellitouch system for control of the rest. i have salt generator, 2 pumps, a heater, and a few valves. version 1 of the poolBot was in an old orbits sprinkler control box. it was way to small, and i had no way to switch the 220 of the spa pump or the salt. after going through an exhaustive internet search, i came across an a few different posts that helped me with v2. i continue to use nodejs-poolController for managing the pump, no sense in reinventing the wheel. it has an api with a JSON interface.

current version (v2)

version 2 has been running my pool for about 6 months, no failures, no breaks, just pure pool control goodness. instead of building a full blown UI to control the pool, i built an API that has basic controls over the system, with a few safety measures like turning off the salt and/or heater if the pump isn't running.

currently the poolBot has the following features.

  • pump control of speed, and output of watts
  • salt, heater, spa pump, and pool light power control
  • safety measure to turn off salt and/or heater if pump isn't running
  • env temperature monitoring
  • SDR to read a floating 433mhz themometer
  • battery backup
  • valve controls
  • generic API for interfacing
  • enclosure cooling fan
  • filter pressure gauge

you may be asking what the red board is. the point of this board was to better handle the gpio signals from the RPI, dump the excess voltage to ground to make sure they fired correctly. i also built in some button circuits so that i could expand it in the future.

API

the api was the first thing i really wrote once i had basic relay control. disclaimer i am by no means a developer by trade. please judge my uptime, not my code.

there are two programs that run, one is the nodejs poolcontroller i first mentioned. the second is a custom perl script that i wrote. it uses mojolicious to handle the web interface, but i've been meaning to move it to anyevent, just havn't had the time.

the api code is at github the only important script is the poolBot.pl code. it has the following functions

  • relay control mapped from a config file
  • monitor thread that watches for pump changes, and institutes the safety measures.
  • redis connection for storing health state
  • web server to act as the api endpoint for control of the above.

the script has no UI, no real interface other than just making get requests to control relays, and get statuses of those relays. i think in the next version i'll convert the entire code to use mqtt for control and stats. i like the api a little more though as it will give me local control if my node-red is offline.

speaking of, i use node-red to manage everything in my house. it keeps track of states, and feeds them into influxdb. i also use the dashboard plugin to build the dashboard for wall mounted touchscreen RPI's around the house for ease of control.

at first look its super complicated but really its not. the first section is for the scheduling of the pump, and turning on things. the second section is the pool water fill control. i have a rachio, and i just converted the manual fill valve to a solenoid valve. the drip effect works very well, has to be adjusted sometimes during the summer. the section after that is fetching state information to push into influxdb, and the last section is for the dashboard ui that allows control of these things.

required parts
optional parts

the system starts with its own 110v feed to a AC to 24v DC power supply. from there it goes to a terminal block and feeds through some standard relays to be the triggers for the larger 2 pole relays. it also breaks off and goes to a buck dc-dc converter to get me 5v. after that it goes into the powerboost for battery backup. lastly it feeds the red board that the pi, and the blue relay board, draw from.

on the far bottom left is an AC-AC power supply. this wasn't wired up when i took the picture but it supplies power to the valve motors to change water flow.

what you don't see in this post is there is another box that sits below this one, its not very large, but it serves as the junction box where everything comes together. the main pump is hardwired into the breaker as its controlled via serial, the heater, spa, salt, and pool lights are all fed through this junction box along with the feeds from the breaker panel to provide power.

i think overall i'm about $600 bucks in it. it was a great learning experience, its been runing very well for a while now. at some point i plan on adding an LED RF controlled pool light, i'm hoping to use SDR for that too.

stats

as i previously mentioned i use influxdb for storing the data of state information, and performance of various parts of the pool. i use grafana to display said data.

here you can see the system stats, some basic environmentals, and relay states. also is the pool temp history, pump rpms, and watts. i havn't had a chance to put in the pressure sensor yet, i'll update this blog when i get around to that.

version 1

this is only here for reference.

this was v1, back when i had someone taking care of my pool i knew i had to make a way to let him control it without having my wifi password. so in the first version it had an screen, and buttons on the side. i hacked/wrote a ui in python that navigated a tree menu and allowed someone to turn the pump on, or set it for cleaning that kind of thing. v1 was in place for about a month before it was ripped out. during that period i had to manually turn the salt on and off, and the entire enclosure got way to hot baking in the sun.

eventually i knew it had to go, and ended up rebuilding it again from the ground up, this time laid out a lot better.

this is the old jandy controller that was ripped out. farewell.

Add a comment

Comments

Awesome stuff. I have a number of disparate systems I was thinking i would like to bring together. One is pool control. I am going to study for methods. Thanks for sharing.
Written on Sun, 02 Jul 2023 19:50:11 by Adam Denter
Truly fabulous piece of information shared by you. https://www.astrolika.com/
Written on Thu, 07 Apr 2022 07:20:50 by Astrolika
Wow, great project. Can you tell me more about how you controlled your variable speed pump? Also, how did you power the salt water chlorinator and which model did you use? Any additional details you could provide would be appreciated!
Written on Tue, 28 Apr 2020 19:57:37 by SEAN KOHLER

Previous Post Next Post