Hey Everyone -
I thought I would share some information about a project that I have been working on with our pool here. Basically I have designed an automatic pool fill system that monitors the level of our pool and then fills it automatically when needed, but based on some very specific criteria.
I know what you are thinking...why not just by a little float thing and have it fill that way...well we had one of those and it broke in such a way that we would have to tear up the existing system where it was mounted (in cement) in order to replace the part that had broke. Since we have a bunch of monitoring and automation within our home already, I decided to automate this process as well.
The project is broken into two parts: monitoring the level, and filling the pool.
The first part uses a product called eTape from milonetech.com. It is a resistive based liquid level sensor. This is connected to a little Moteino (lowpowerlab.com) microcontroller (~$20) and two AA batteries. The Moteino is an Arduino clone. The Moteino gets the level of the pool and transmits it via 433Mhz to a database once per minute. At this rate, the batteries will last about two years.
The second part utilizes a Raspberry Pi 3 ($35), a microUPS and battery backup unit called MightyBoost (~$20) (lowpowerlab.com) which provides the Pi with another microcontroller, a 4400mAh battery for power backup (about ~3 hours) and another 433Mhz radio (~$7) for transmitting sensor data. I have two weatherproof buttons on the Pi, one to boot/reboot and powerup the Pi and the other to handle manual filling of the pool if needed.
I have written the control software for the Moteino using the Arduino IDE and the control software for the Pi in Python.
The basic premise of the system was if the pool falls below a certain level, the Pi will open a sprinkler valve to fill the pool. Since in AZ we are required to have vacuum breakers on all irrigation connections, I choose to add an additional sprinkler valve to my irrigation system. This valve is connected to a relay on the Pi and when the software tells the valve to open, the relay fires and operates a 24VAC sprinkler valve. This valve is connected to my pool plumbing on the output side and so includes a backfill valve to prevent pressure from the pool pump heading back to the irrigation system.
Because I am running this from my irrigation system, I wanted to make sure that the pool would not attempt to fill while my sprinklers were running. Within the python script, I check for this in one of two ways. First, I have a generic "blackout' period where you simply set the times your sprinklers are running and we won't fill the pool during that time. The second was is via an API call to my Rachio sprinkler system. This call tells me if the sprinklers are currently running or not.
Second, I wanted to make sure that the pool would not attempt to fill if my pool pump were running as I do not want to try and fill against the pressure form my pool pump. I manage this by monitoring the power utilization on the circuit going to my pool panel. If I am using more than 30 watts, I know my pool pump is running as my monitoring and autopilot system consume only 12 watts of power. Anything over that means my pump is running and we should not fill the pool. If I want to prevent the system from running for any other reason, I have a toggle switch that shuts off connectivity from the relay to the sprinkler valve, or I can ssh into my Pi and shut down the software. I wanted at least one hardwired interrupt to the process in case the software went bonkers!
In the event that I want to manually fill my pool, I have another momentary push button with a nice LED that allows me to fill my pool by just pushing the button. It checks to see if the pool is already filling or if the pool pump is running before it will allow a manual fill.
In order to prevent an overfill, I have a timer built into the script that monitors the fill time and will force shutoff the valve if you go over whatever you set your max runtime to in the settings. For example, I know my pool will take about 1.5 hours to go from low to where I like it, but it would take about 6 hours to overfill, so I set my timeout to 180 minutes. It will be more full than normal, but not overfull.
Due to the nature of the manual fill button, this will run until you shut it off regardless of the pool level or pool fill timer!!!
I use pushbullet (free) for all of my notifications (which can be toggled on or off in the settings) and use Python's builtin logging for tracking what the system is doing.
I have attached a screen shot of everything that I am using, I am just waiting for my NEMA3R enclosure to arrive to get it all mounted.
If anyone is interested in the actual code I have attached everything to this post including the Arduino sketch and the full python code. Both are documented pretty well.
I will post more pictures once I have it fully mounted.