cvonk / OPNpool

Integrates the functionality of a Pentair pool controller into the smart home using ESP32 SoC.
GNU General Public License v3.0
75 stars 5 forks source link
esp32 esp32-idf home-assistant home-automation mqtt-client pool

OPNpool

GitHub Discussions GitHub release (latest by date including pre-releases) GitHub package.json dependency version (prod) GitHub

The OPNpool integrates the functionality of a traditional Pool Controller into the modern smart home. It keeps tabs on the status of the connected controller, pool pump and chlorinator. This provides not only a more convenient solution than physically interacting with the pool equipment, but the ability to create automations that runs the pump for a duration depending on the temperature.

Features:

[^1]: Available with the full install as described in FULL_INSTALL.md

This device was tested with the Pentair SunTouch controller with firmware 2.080, connected to an IntelliFlo pump and IntelliChlor salt water chlorinator.

This open source and hardware project is intended to comply with the October 2016 exemption to the Digital Millennium Copyright Act allowing "good-faith" testing," in a controlled environment designed to avoid any harm to individuals or to the public.

The full fledged project installation method is described in the FULL_INSTALL.md. Before you go down that road, you may want to give it a quick spin to see what it can do. The remainder of this README will walk you through this.

Parts

At the core this project is an ESP32 module and a 3.3 Volt RS-485 adapter. You can breadboard this using:

Build

We proudly acknowledge the work of reverse engineering pioneers Joshua Bloch, Michael Russe, and George Saw. (Drop me a line if if I forgot you.)

Clone the repository and its submodules to a local directory. The --recursive flag automatically initializes and updates the submodules in the repository.

git clone --recursive https://github.com/cvonk/OPNpool.git

or using ssh

git clone --recursive git@github.com:cvonk/OPNpool.git

From within Microsoft Visual Code (VScode), add the Microsoft's C/C++ extension. Then add the Espressif IDF extension ≥4.4. ESP-IDF will automatically start its configuration. Answer according to the table below

Question Choice
Mode Advanced
ESP-IDF path C:/espressif
Tools C:/espressif/bin
Download yes

From VScode:

The device will appear on your network segment as opnpool.local. You can access its web interface through http://pool.local. If MQTT is configured, it will publish MQTT messages. If you also use the Home Assistant, entities will appear after a few minutes with .opnpool in their name.

Connect

:warning: THIS PROJECT IS OFFERED AS IS. IF YOU USE IT YOU ASSUME ALL RISKS. NO WARRENTIES. At the very least, turn off the power while you work on your pool equipment. Be careful, THERE IS ALWAYS A RISK OF BREAKING YOUR POOL EQUIPMENT.

Understanding the above warning .. the RS-485 header can be found on the back of the control board. There are probably already wires connected that go to the devices such as pump and chlorinator.

Inside of Pool controller

To minimize electromagnetic interference, use a twisted pairs from e.g. CAT-5 cable to connect the A/B pair to the RS-485 adapter as shown in the table below.

Controller RS-485 adapter idle state
-DATA (green) A negative
+DATA (yellow) B positive

Connect the RS-485 adapter to the ESP32 module. I also pulled GPIO#27 down with a 10 kΩ resistor, to keep it from transmiting while the ESP32 is booting.

RS-485 adapter ESP32 module
RO GPIO#25
DI GPIO#26
DE and RE GPIO#27
GND GND

The serial monitor will show decoded messages such as:

{
    "state":{"system":{"tod":{"time":"14:01","date":"2022-04-05"},"firmware":"v0.000"},"temps":{"air":69,"solar":80},
    "thermos":{"pool":{"temp":68,"src":"None","heating":false},"spa":{"temp":69,"src":"None","heating":false}},
    "scheds":{"pool":{"start":"08:00","stop":"10:00"}},
    "modes":{"service":false,"UNKOWN_01":false,"tempInc":false,"freezeProt":false,"timeout":false},
    "circuits":{"active":{"spa":false,"aux1":false,"aux2":false,"aux3":false,"ft1":false,"pool":true,"ft2":false,"ft3":false,"ft4":false},"delay":{"spa":false,"aux1":false,"aux2":false,"aux3":false,"ft1":false,"pool":false,"ft2":false,"ft3":false,"ft4":false}}}}
}

The web UI, will show the pool state and allow you to change the thermostat and circuits.

Web UI

If you are using Home Assistant, the *.opnpool* entities will update automatically. The hassio directory has some YAML code to use with the Lovelace dashboard.

If you go that route, also remember to install modcard, button-card, bar-card, simple-thermostat, template-entity-row and mini-graph-card available through the Home Assistant Community Store (HACS).

Hassio UI

Design documentation

The design documentation for this project is available at https://coertvonk.com/category/sw/embedded/opnpool-design. It includes the chapters