Smart controls for the swimming pool (1/4)

In the following four-part article series, we will describe step by step how to control a swimming pool using self-made IoT modules. The cost of the required electronic components is less than 100 euros.


  1. Control the pool and its temperature with open source and inexpensive electronic components via a solar system
  2. Access via WiFi and internet
  3. Flexible expandability

Starting position

We have a swimming pool that is cleaned using a sand filter system. This sand filter system has to filter the pool water every day for a certain time.

In addition, we have a thermal solar system, which is designed to support heating and hot water. Since this produces far too much heat in the summer, the idea was obvious to use this heat in the summer to heat the pool. This is easily possible via additional connections on the heat accumulator: a circulation pump directs the warm solar water through one Heat exchangerthat heats the pool water.




The pump for the water circulation is switched by a timer. The pump for heating is switched on manually behind the timer as required. This is of course stupid if you have integrated the solar system in the morning and the weather changes during the day: In the evening the water is cold for showering and cooking, since all the energy has flowed into the pool. That should change this year!


This situation gave rise to the desire to control the pool smartly. What is basically required for this?

  1. Sensors for heat storage and pool water
  2. Switching option for the pumps
  3. A control system

All of this is easy to implement with an ESP microcontroller and a Raspberry Pi. The individual solutions are also available here on the blog:

The trick is in the detail of the combination. We will see that in the following articles.

Hardware required

The following parts and components are required for the pool controller:

For the OpenHAB server:

Basis for the pool controller

We will start with the centerpiece, the pool controller. In order not to reinvent the wheel again and again, we decided to set up the project on a basis. We have this in the project ESPBASE  found. The project offers support as a template for setting up WLAN via an access point and some other functions that we no longer have to take care of ourselves. The developer has one in his project example  created for the use of ESPBASE. We will build the controller on this basis.

Smart home integration

Ultimately, the pool controller becomes open source home automation openHAB  integrated and thus also offers access via apps on the smartphone.

For the integration we need a protocol for the message exchange. We use MQTT for this. MQTT is a lightweight message protocol that is used very often in the IoT (Internet of Things) area. If you want to know more details about MQTT, you can find a good one at Heise Developer Overview.

We will need an MQTT broker to communicate with the pool controller. We have the broker on the Raspberry Pi Mosquitto  Installed.

Install and test the MQTT Server Mosquitto

We install the MQTT broker Mosquitto on the Raspberry Pi:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mosquitto mosquitto-clients

We open a subscriber on the topic "/ topic" who is waiting for messages:

mosquitto_sub -h localhost -v -t / topic

The topic is like a radio frequency that is being listened to. Different data such as e.g. the temperatures are sent.

We can test this directly on the Raspberry with the following command, which publishes a message in another console window:

mosquitto_pub -h localhost -t / topic -m "Hello smart pool"

There are also clients for the smartphone or the Windows PC to receive or send the MQTT messages. Such a client can be useful for testing if you don't always want to open a console on the Raspberry.

What's next?

Now the first prerequisites have been created. In the following article, we will introduce the pool controller based on the ESP32, which provides its data via the MQTT broker that has been set up.


We hope you enjoyed the first part of this series of articles.

We will publish the second part of the article shortly. Just drop by in the next few days.

We look forward to your feedback and comments, and say goodbye until the next post.

Your AZ delivery team

Further to:The pool controller (2/4)

Esp-32Projects for advancedRaspberry piSensorsSmart home

Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. Install ESP32 now from the board manager
  2. Lüftersteuerung Raspberry Pi
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1
  4. ESP32 - das Multitalent
  5. OTA - Over the Air - ESP programming via WLAN