Author Topic: Automatic Pool Fill (MightyHat, Pi3, MySql/Python, Sprinkler Valve, eTape)  (Read 6105 times)

TomWS

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1873
What I want to know is when is the pool party and who's supplying the beer?   8)
In lieu of that, I wouldn't mind a ride on a G550!   ;D

Tom
« Last Edit: May 15, 2016, 09:18:18 PM by TomWS »

ssmall

  • Full Member
  • ***
  • Posts: 129
  • Country: us
I get the copilot seat!  Very nice project congrats.

G550_Pilot

  • Full Member
  • ***
  • Posts: 143
  • Country: us
Yea, the 550 is a nice ride for sure, but I would rather be flying the helicopter truth be told. Not much to do at 51,000' but drink coffee and watch the gauges!

G550_Pilot

  • Full Member
  • ***
  • Posts: 143
  • Country: us
OK, another big update to my pool_fill_control.py script.

V2.1
        # - Added logging
        # - Reworked notifications to remove requirement to write a file
        #   and see if the file was present. Used global variables instead.
 
        # - Reworked overfill tracking and notification

        # - Reworked manual fill to prevent manual fill while automated
        #   fill is in progress. Before, requesting a manual fill while a
        #   fill was in progress caused the relay to kick out and back in
        #   and notifications for manual fill to go out. Now, before we do
        #   a manual fill we check to see if an auto fill is in progress.
        #   If there is one in progress, we just blink the button LED a
        #   bunch of times and log the event.

        # - Cleaned up the database check to prevent checking the pool level
        #   while we are manually filling the pool.   
        # - Added support for Rachio smart sprinklers via their API to
        #   automatically detect if the sprinklers are running or not.

You will need to get yoru Bearer and Device IDs from your rachio account and put them in pooldb.py


« Last Edit: May 17, 2016, 02:16:09 AM by G550_Pilot »

G550_Pilot

  • Full Member
  • ***
  • Posts: 143
  • Country: us
Added some more changed to pool_fill_control.py:

V2.2 (2016-05-29)
         - Added checking to see if our pool pump is running. Since (in
           our case) we fill the pool through the same piping that we
           filter with, we do not want the pool trying to fill while our
           pump is running. We have a backflow valve installed to prevent
           pressure from the pump from pushing pool water into our sprinkler
           system (although it would have to get past a closed sprinkler
           valve). We just don't want to try and fill the pool against the
           pressure of the pool pump.
               
           We have a CT on our pool panel that measures our power
           power consumption in real time and we log that data to our emoncms
           database (same database we log our pool level) and we are just
           reading the power utilization (in watts) and setting a max
           wattage that would indicate that our pump is running.
       
           If the pump is running, automatic and manual filling is disabled
           and we log and INFO message in the logfile. 
         
         - Added some additional debug messages. Set logger.setLevel(logging.INFO)
           to logger.setLevel(logging.DEBUG) to see the additional messages in your
           logfile. 
« Last Edit: May 30, 2016, 12:13:23 AM by G550_Pilot »

G550_Pilot

  • Full Member
  • ***
  • Posts: 143
  • Country: us
OK, made another big change to my project that I completed (finally) today. I have stopped using the MightyBoost and replaced it with the MightyHat and integrated the lcd screen into my project to output information form my script onto the screen so you don't need to log into the Pi anymore to see what is going on with the system.

I also reworked some of the debug logging (added a lot more) and rearranged the pushbullet notifications.

G550_Pilot

  • Full Member
  • ***
  • Posts: 143
  • Country: us
More pics

G550_Pilot

  • Full Member
  • ***
  • Posts: 143
  • Country: us
More Pics

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5779
  • Country: us
    • LowPowerLab
Nice work  ;D

G550_Pilot

  • Full Member
  • ***
  • Posts: 143
  • Country: us
Thanks. Adding even more changes now!

G550_Pilot

  • Full Member
  • ***
  • Posts: 143
  • Country: us
V2.4 is available as of today.

- Added 5 system status LEDs (Sprinklers Running, Pool Pump Running, System OK, System ERROR, Pool Filling)
- Updated Manual fill function to check for sprinklers running before allowing a manual fill
- Added external power button to MightyHat and update MightyHat.ino to have only green LED which is what my external power button has on it.

Added wiring schematic.

All files are now on github:

https://github.com/rjsears/Pool_Fill_Control

« Last Edit: June 03, 2016, 09:54:41 PM by G550_Pilot »

G550_Pilot

  • Full Member
  • ***
  • Posts: 143
  • Country: us
V2.5 is available today:

https://github.com/rjsears/Pool_Fill_Control


Big change was adding a manual interrupt switch that physically opens circuit between relay and sprinkler valve. This is a DPDT switch that allows me to interact with the script when the switch is pushed. This is a 'last resort' switch in the event something happens and the sprinkler fill valve will not respond to the program. This resets the relay and sends notifications as well as logs the event.

Added another LED connected to the above switch to indicate that we have manually interrupted the circuit.

Centralized all pushbullet notifications.

Cleaned up a bug that would not reset our run time even after pool was full.



For version 2.6 I am working on integration with our smart water meter so that once the pool has been filled I will get a notification how many gallons of water were needed to fill the pool.

Looking for any suggestions or feedback!!


G550_Pilot

  • Full Member
  • ***
  • Posts: 143
  • Country: us
Version 2.6 was put on GitHub today. Didn't integrate with the smart meter (yet) but I did a bunch of code rearrangements, optimization, a couple of small bug fixes and most important rewrote the code to support watchdog support.

Since I am checking the pool_level every 60 seconds, I set the watchdog timer to 70 seconds. If after 70 seconds we do not get a ping to the watchdog, systemd will restart the script.

https://github.com/rjsears/Pool_Fill_Control

G550_Pilot

  • Full Member
  • ***
  • Posts: 143
  • Country: us
I am now up to V2.8 on my code. I added in support for the Atlas Scientific pH and ORP probes along with the ability to log the information from the probes to one or more local or remote emoncms (openenergymonitor.org) servers. Since I use a different system (called an AutoPilot) to control my Acid and SWG, I do not do anything with this probe information other than log it.

More code and import optimizations and some other cleanup.

I will be adding a filter pressure sensor and water meter to the R5 I have running alongside the Pi.

 
https://github.com/rjsears/Pool_Fill_Control

G550_Pilot

  • Full Member
  • ***
  • Posts: 143
  • Country: us
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