Pool Control System – PoolServant DIY Edition

Hello Smart Home friends,

I’m planning to use the winter break to set up a control system for our pool, which will be integrated into our Home Assistant system for the next summer. For this, I’ve developed the PoolServant DIY Edition, which will be installed in the technical room and controlled via Home Assistant.

Functions of the PoolServant DIY Edition:

  • Control two 230V outlets (e.g., for the sand filter system)
  • Control a peristaltic pump for pH+ dosing
  • Control a motorized ball valve for opening/closing the bypass
  • Measure water flow
  • Monitor pool water level
  • Measure ambient temperature and humidity
  • Monitor power consumption

I’d love to hear from anyone who has experience with similar projects or who can offer suggestions for improvements.

Thanks in advance for your help!


Shopping List:

  • Protoboard
  • ESP32 Dev Kit (1 piece)
  • 12V 4-channel relay module
  • Voltage regulator (LM2596S DC-DC)
  • Terminal block or screw terminals
  • Resistors: 4.7 kΩ, 1 kΩ, 2 kΩ, 10 kΩ pull-up resistors
  • 12V peristaltic pump
  • Flow sensor (YF-DN40)
  • Motorized ball valve (12V DN40)
  • 2 ultrasonic sensors (JSN-SR04T)
  • Temperature and humidity sensor (DHT22)
  • 12V power supply
  • Waterproof enclosure (IP65)
  • Current sensor (ZMCT103C)

Build Instructions:

  1. Choose protoboard size: Ensure enough space for all components and clean wiring.
  2. Power supply: Connect the 12V input to the LM2596S VIN pin, connect GND, and set the output to 5V. Connect this to the ESP32 VCC.
  3. Solder the ESP32: Solder the ESP32 onto the board and ensure the 5V and GND pins are correctly connected.
  4. Relay modules: Connect the relay control lines to the GPIO pins of the ESP32. Power the relays with 12V.
  5. Flow sensor: Connect the signal output to GPIO13 via a 4.7 kΩ pull-up resistor.
  6. Ultrasonic sensors: Connect the trigger and echo pins to the ESP32 GPIO pins.
  7. DHT22: Connect the data pin via a 10 kΩ pull-up resistor to GPIO4.
  8. ZMCT103C (current sensor): Connect to A0 pin on ESP32.
  9. Safety shutdown and watchdog: Implement auto-restart and safety mechanisms.

GPIO Pin Assignment:

  • Peristaltic pump → GPIO12
  • Flow sensor → GPIO13
  • Pool heater → GPIO14
  • Sand filter → GPIO27
  • Ultrasonic sensor 1 (Trigger/Echo) → GPIO32/33
  • Ultrasonic sensor 2 (Trigger/Echo) → GPIO25/26
  • DHT22 → GPIO4
  • INTEG SWG → GPIO15
  • ZMCT103C → A0
substitutions:
  name: poolservant
  friendly_name: PoolServant

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  comment: Proof of concept

esp32:
  board: esp32dev
  framework:
    type: arduino

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    ssid: "Esp32-Developmentboard"
    password: "TBD"

sensor:
  - platform: dht
    pin: GPIO4
    temperature:
      name: "Temperature"
    humidity:
      name: "Humidity"
    model: DHT22

  - platform: pulse_counter
    pin: GPIO13
    name: "Flow Sensor"

  - platform: ultrasonic
    trigger_pin: GPIO32
    echo_pin: GPIO33
    name: "Water Level Sensor 1"

  - platform: adc
    pin: A0
    name: "Current Sensor"

Nice.

Are you going to do any measurements such as pH?

Hello Nick,
a Tuya 8in1 water quality detector should take over the monitoring of the values.

Tuya WiFi 8-in-1 Wasserqualitätsdetektor S.G/PH/EC/ORP/TDS/CF/SALT/TEMP Messanalysator Wassermonitor Wasserqualitätstester - AliExpress

Regards Joscha

Does that work in ha?

During my research, I came across this thread:
Best Swimming Pool monitoring solution: ORP, Ph, temp - ESPHome - Home Assistant Community (home-assistant.io)
It states that it works, and my device is still in transit.

Tuya. No thanks.