Automatic Pool Fill Control (Moteino, Pi3, MySql/Python, Sprinkler Valve, eTape)

lovemyazpool

0
Gold Supporter
LifeTime Supporter
Nov 16, 2015
102
Phoenix, AZ
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.

Cheeers
 

Attachments

  • screen 2016-05-15 at 5.43.17 PM.jpg
    screen 2016-05-15 at 5.43.17 PM.jpg
    86.9 KB · Views: 124
  • pool_fill_control.zip
    13.4 KB · Views: 9
The eTape is pretty cool stuff and works like a charm. I needed a custom size and they made it for me and had it to me in less than a week. Neat stuff.

What pump are you running? I have the variable speed pentair and I would love to figure out how to control it myself as opposed to having to walk out to the little interface that is on it.




There is a system that currently does this by Konalabs called LevelSmart.... I have it in my pool and the thing works extremely well.....

LevelSmart Wireless Swimming Pool Auto-Fill by Kona Labs

Amazon.com : LevelSmart(tm) Wireless Level Control: Automatically Fills: Save Time - Save Water - Save $$$ : Patio, Lawn Garden


I saw this system (and a couple of others like it) but none of them really integrated things like pool pump monitoring, overfill alerting, sprinkler monitoring (since I use my sprinkler system) and manual fill control. Plus I think I have about $200.00 total tied up in my system...a lot cheaper than $600! Since I love to tinker, this was a great project for me!



=-=-=-=-=-=-=-


Version 2.4 of my software, schematics and code (and some pictures) are now up on github:

GitHub - rjsears/Pool_Fill_Control: Raspberry Pi / Arduino / Python Project to automate filling of swimming pool.


Added 5 system status LEDs, updated logging, added a bunch more debug logging (if needed).
 
I saw this system (and a couple of others like it) but none of them really integrated things like pool pump monitoring, overfill alerting, sprinkler monitoring (since I use my sprinkler system) and manual fill control. Plus I think I have about $200.00 total tied up in my system...a lot cheaper than $600!

One smart thing that the level smart does it make it impossible to overfill your pool by only opening the valve for 7 min at a time max for every hour. Even if the unit loses power while filling (via power outage, power failure of device, etc etc) the valve will still close so the pool doesn't overfill... I agree the price is steep. I guess not that many people want to pipe a system directly from their house into their pool plumbing so they can't exactly sell on quantity.....Neat project though....
 
The eTape is pretty cool stuff and works like a charm. I needed a custom size and they made it for me and had it to me in less than a week. Neat stuff.

What pump are you running? I have the variable speed pentair and I would love to figure out how to control it myself as opposed to having to walk out to the little interface that is on it.

I just have a single speed pump and a booster pump for the polaris, no variable speed yet. I'm just turning the power to the pumps on or off using solid state relays. I've considered a variable speed pump, but my energy cost is fairly low, so I'll probably just go with a two speed replacement when the one I have fails.

Russ
 
One smart thing that the level smart does it make it impossible to overfill your pool by only opening the valve for 7 min at a time max for every hour. Even if the unit loses power while filling (via power outage, power failure of device, etc etc) the valve will still close so the pool doesn't overfill... I agree the price is steep. I guess not that many people want to pipe a system directly from their house into their pool plumbing so they can't exactly sell on quantity.....Neat project though....

Yeah I really tried to design mine the same way. If I lose power, I have the UPS which will run the entire system for three hours before it shuts everything down automatically. The relay for the sprinkler requires power to stay closed, if we lose power to the Pi, the relay opens and no more water. In addition, if we lose power to the house, the 240v feed to my pool pump area will fail and regardless of the relay position, the sprinkler valve will close. I guess the program itself could fail, but I am running a watchdog on it every 90 seconds and if it fails then systemd restart the script.

I guess I could move the operation/management/monitoring of the relay to something like a Ruggeduino, a microcontroller is a lot less likely to have a software glitches....I'll have to look into that to see if I can make the system more robust!
 

Enjoying this content?

Support TFP with a donation.

Give Support
V2.9 uploaded to github today. Made a lot of changes to DEBUG output to STDOUT if set, also integrated alerting.py and pooldb.py together and added a temperature compensation function to the pH probe reading.

V2.9 (2016-06-18)
- Eliminated alerting.py file, added contents to pooldb.py file.
- Added a lot of DEBUG printing to STDOUT if DEBUG == 1 is set.
- Moved pool_level and pump_running_watts table defs to pooldb.py
so that you do not have to modify table definitions in main script.
- Added in temperature compensation function for pH readings if you
have a pool water temp probe. Configuration is done in pooldb.py


https://github.com/rjsears/Pool_Fill_Control
 
Got the pool fill valve installed yesterday! The meter is a smart meter and records all water usage so we can tract how
much water the pool is using as opposed to the rest of the house and irrigation.


pool_fill_valve_in_process.jpg



pool_fill_valve_in_process1.jpg


pool_fill_valve_complete.jpg
 
Thread Status
Hello , This thread has been inactive for over 60 days. New postings here are unlikely to be seen or responded to by other members. For better visibility, consider Starting A New Thread.