The automation for a swimming-pool is something reserved to top-of-the-range systems. Here you can find a cost-effective, simple but powerful automation-system that you can build by yourself with a little time and effort.
Not only home things can be automated. Indeed, a swimming-pool is something where automation reports incomparable benefits in time, money and ecology.
The main objective is to build a super-modular system that allows controlling the peripherals as simple (and cheap) as possible, transferring all intelligence to a raspberry pi controling all what happens in the pool.
We often see lots of equipment that is responsible for two or more tasks, more or less autonomously (saline chlorinators that control pH, intellegent pumps that control filtering and other equipment, smart peristaltic pumps with time control or probe connection, etc.). This equipment only partial resolve main automation tasks and dont allow any type of expansion or improvement. This project propose that the peripheral be as stupid (and cheap) as possible, dedicating himself ONLY to his main task. A pump: only filter when told, a saline chlorinator: create chlorine when told, a peristaltic pump, inject when told, ...
There are also very modular (and usually quite expensive) professional systems that share this same perspective, but they often have the problem of forcing all components of the same brand to be purchased. If you have already made a strong investment in equipment of this type, this project is probably not for you.
A quick diagram of what would involve the raspipool project in a pool without automation... Before and after... Basically, you need a bypass PVC tube with the sensors, a peristaltic pumps to inject liquids to regulate chemical parameters, and a box with a raspberry pi, that runs all the code of the project (based on Home Assistant), responsible of all automation, monitoring and control. This wiki will contains all instructions to build all this parts (specially all inside the little box).
In the last step, you can see a videoshow of the final web fronted in the last step...
Please follow the project in github
(and in wiki)
This is the BUM (Build of Materials):
1. Raspberry pi:
A raspberry pi with wifi Even raspberry pi zero w can be enough, its better minimum "raspberry pi 3 B": hats are bigger, and USB ports can be very useful (microphones, webcams...)
1) a SD Card. Minimum 8GB, recomended 32 GB. Is very important quallity good A1 speed. I allways use SanDisk Ultra and zero problems in lots of rpis and more than 5 years.
2) a very good 5V micro-usb power adaptor. Those from oficial RPI foundation are good. Its really important because your quality meassurements can depend on this.
1) EZO pH Circuit from Atlas Scientific
2) EZO ORP Circuit from Atlas Scientific
3) one or two carrier board from Atlas Scientific (I need a new post to explain this).
4) one one-wire DS18B20 waterprof digital temperature probe and a 4.7Kohms resistance. Directly connected to the GPIO. A stereo jack conectors (male and female) can be useful.
- pump on/off and pump speed (high/low)
- muriatic injection (to reduce pH) and bleach injection / SWG control.
With this solution do not have to weld (but only 5A max current).
There are hats with 6 and 8 relays, and even can be stackable (2x6, 3x6 ...).
Take into account that pump can`t be controlled directly with this relays (max 5A for resistive loads, but 2 or less for inductive loads like motors).
2) One or two Contactors or power relays ,with 2 poles, 230AC controlled, and rated with 'AC-7b' or 'AC-3' (kind of electrical equipment) more than your pump requirements (amperes or watts).
- For dual speed pump: first contactor with 2 NO (Normally Open), and second contactor wit 1 NO and 1 NC (normally closed), to select speed
- For one speed pump: only one contactor with 2 NO (Normally Open)
- a power-measurement relay (sonoff POW R2), to monitorice power consumtion of pump and serve as safe-motor. - a manual switch to manage pump without rpi (for maintenance issues), or get contactors with manual switch integraded (like proposed).
Please see conection of all this here
4. Others (non core system):
1) Pipes: PVC bypass in returning flow between output filter and input to pump, with 3 probe inputs. and two injection valves (80 cm after the bypass), in main return flow pipes. See [how to build a bypass pipe in recirculation](https://github.com/segalion/raspipool/wiki/Bypass-for-sensors)
2) Two Peristaltic pumps for muriatic acid injection (pH control) and bleach injection (sanitization depending on ORP). Remenber one (or two if you want simultaneous injection) 12V power supply.
3) A standard pH probe (with BNC connector)
4) A standard ORP probe (BNC connector)
5) two BNC cable extensor (2-3 meter male-female)
6) A IP65 box to get all inside (rpi + carrier boards + relays).
Total cost of the project can be about 350$-500$ with low-rated price equipments (take into account, for example, that only ORP probe can cost from chinnese <20$ to more than 300$ for profesionals).
NOTE: Links proposed are just to take a quick look and/or minimum price reference. Please dont take it as recomendation.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Create a Bypass for Probes
First of all, you need to create a recirculation by-pass over your actual plumb system, in order to place the probes (pH, ORP and temperature), like the diagram.
It will be placed between the out of the filter and the in of the pump. It is really much easier than you think (for me it was the first time I did it).
You only need the material (very cheap, less than 40€), a saw and glue (especially for PVC).
- Connect the bypass with the collars from the filter outlet until before the pump. Build the bypass without glue, to see how it looks and adjust the perfect cutting measures.
- The thick tube (50mm = D50, where the probes are) is horizontal and as low as possible, to ensure that it never runs out of water. And recomended less than 3 meters from where the raspberrypi box will be placed (for not cables too long).
- Chop the pipes with a dremmel with a rounded fat sander head. Test first on an unused pipe (with the collar on). Finally, when you have practice and the holes are perfect, make them on the main pipes (what you need most guts).
Step 2: Prepare Raspberry Pi and Base Software
In order to get the software running on your RPI you need to install:
1. Install hassbian in a raspberry pi (3 or 4), and give wifi connection. (If advanced user, you can instead install raspbian + Home Assistant with this prefered method)
After this, you could have web access to control your Home Assistant. You can experiment with this, and probably you could see things that will be autodiscovered (Sonos, Kodi, Alexa, google home, xiaomis, printers, etc...). You can play with all of this and create your own automations (i.e. when something happens do that...).
If you dont know HA, probably will be overwhelmed by the huge ammount of integrations available in Home Assistant.
When you are familiarize with all this big project, you can begin with the code of this porject...
2. Go to github project and copy 'custom_components', 'packages' folders (with all paths and contents) and 'ui-lovelace.yaml' frontend file in homeassistant conf_dir ( i.e. /home/homeassistant/.homeassistant/ ).
3. Modify your 'configuration.yaml' (including ' packages: !include_dir_named packages', disabling automations, scripts and groups, discovery and lovelace in yaml mode) as example in codeCreate/modify proper 'secrets.yaml' for apis (latitude/longitude, pushbullet api, openweathermap api, etc).
Step 3: Connect Sensors to the Raspberry Pi
Here the schema to connect DS18B20 (cheap waterproof temperature sensor) and EZO circuits to the Raspberry pi GPIOs.
You can see what is the EZO circuit, what the carrier board, and what the probe...
The comunication between EZO circuits (pH and ORP) will be with UART, so you need to prepare the RPI to use it:
Edit rpi config file with:
sudo nano /boot/config.txt
force_turbo=1 enable_uart=1 dtoverlay=pi3-disable-bt # sencond UART1 /dev/ttyS0 dtoverlay=uart1,txd1_pin=32,rxd1_pin=33
Step 4: Connect Relays for Pumps Control
This is a improved release of the connections, more simple and clear but more powerfull.
It includes contactors with manual switchs (mutch better than external switchs). It includes too a sonoff pow R2 (optional for pumps upto 1,5 HP)
Step 5: Onboarding: Configure Your Pool in Raspipool
Simply navigating on the web frontend (from desktop or mobile), you have to inform things like:
- your pool size
- pump filtering cycle
- the speed injection of your peristaltic pumps
- the concentration of your chemical (bleach and muriatic acid)
- the proper notifications you want
- your chemical targets (pH and Free Chlorine)
Step 6: See a Video and Motivations
If you where here to only see the video, please take a moment to read the intro and motivation behind this project...
Home Assisttant is a great automation tool for domotic. There are lot of examples around about home automations, but almost none about swimming pool automation.
Although you can surely say that not everyone has a pool in their house, only in my country there are 1.2 million pools, most of them are small private pools.
And there are one more thing: maintenance of a swimming pool is a very laborious and constant task, where automation can save, not only a lot of time (and money) for the maintainers, but a lot of water for the planet.
Unfortunately, in the residential environment, the annual complete water renewal for each summer period is habitual, so I estimate that more than 30 million m3 of purified!!! water are wasted annually (only in my country) due to the complete filling of swimming pools for the season of bathroom.
There are many causes that justify this behavior, but surely one of the most important is the high cost of an automation system for a pool. This project try to change this.
This is surely the most important reason that has driven me to create and share this project: Create a cost-effective, easy-to-install, easy-to-build, Swimmig Pool Automation System for all people with the minimum and simple filter and satinization system
This is the first part of the project (only lot of yaml config files in github), to control a minimal and carefully selected hardware after many surveys, to has basic but powerful automation system.
But there are a lot of work for the future. Mainly to document lots of instructions for people outside of all these technologies (surely all here know the importance but workload of documentation…)
There are some similar projects around (mainly based on node-red and node-js systems), but, in my opinion, all of them are projects to control systems of specific (and usually closed) manufacturers, or they are projects very specifically oriented to the needs of their creators.
My intention is create a system where the “the peripherals” (motor pumps, peristaltic pumps for injection of chemicals, chlorinators and dispensers), are as dumb (and cheap) as possible, and all intelligence is centralized in a mini-box with a raspberry pi and cost-efective-but-reliable hardware “easy to install, easy to obtain, update and mantain”.
I am aware that in a control system of a swimming pool there are always a lot of things that can fail (and really fail), and that is why I have put a lot of intelligence in notifying any anomaly that goes out of the “expected” thing, before wanting to regulate it all without any human intervention (It is better to notify that the alleged injection of chlorine does not seem to work, to find that the system has emptied the bleach tank in the pool overnight)
Now, I just hope there are more people to try and help improve this project.