DIY ESP32 Pool Controller

This post assumes that you already have basic knowledge on how to flash and program ESP32 board. Hence, I’ll concentrate on the nuts and bolts of getting the pool controller set up.

Parts:

I ran a standard CAT6 cable from the outside where the pool equipment is located to the central panel in my basement. I originally wanted to mount the controller in an outdoor watertight box, but discovered that the ESP32 board did not have a good wifi connection inside the box. I also wanted to keep it in a temperature controlled environment so inside the house it went.

I’m not an electrical engineer, but here is my attempt at making sense of the setup before starting to wire it all up:

ESP32 Code:

esphome:
  name: pool

esp32:
  board: wemos_d1_mini32
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
#Generate api key: head -c 32 /dev/urandom | base64
api:
  encryption:
    key: “CHANGEME”

ota:
  password: “CHANGEME”

wifi:
  ssid: “CHANGEME”
  password: “CHANGEME”
  use_address: CHANGEME

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Pool-Automation"
    password: “CHANGEME”

captive_portal:
    
dallas:
  - pin: GPIO27

sensor:
  - platform: dallas
    address: CHANGEME
    name: "Pool Temperature"

switch:
  - platform: gpio
    name: "Pool Heater"
    pin: GPIO25
    id: pool_heater
    inverted: true
    restore_mode: RESTORE_DEFAULT_OFF
  - platform: gpio
    name: "Pool Pump - S1"
    pin: GPIO16
    id: pool_pump_s1
    inverted: true
    interlock: &interlock_group [pool_pump_s1, pool_pump_s2, pool_pump_s3, pool_pump_quick_clean]
    restore_mode: RESTORE_DEFAULT_OFF
  - platform: gpio
    name: "Pool Pump - S2"
    pin: GPIO17
    id: pool_pump_s2
    inverted: true
    interlock: *interlock_group
    restore_mode: ALWAYS_OFF
  - platform: gpio
    name: "Pool Pump - S3"
    pin: GPIO21
    id: pool_pump_s3
    inverted: true
    interlock: *interlock_group
    restore_mode: ALWAYS_OFF
  - platform: gpio
    name: "Pool Pump - Quick Clean"
    pin: GPIO22
    id: pool_pump_quick_clean
    inverted: true
    interlock: *interlock_group
    restore_mode: ALWAYS_OFF
  - platform: gpio
    name: "Pool Salt Generator"
    pin: GPIO32
    id: pool_salt_generator
    inverted: true
    restore_mode: RESTORE_DEFAULT_OFF

Progress in pictures. I’ve modified the set up several times, until I arrived at the final product. It’s a bit messy but it works and at some point I’ll clean it all up.

Final Product:

Home Assistant



Leave a Reply

Your email address will not be published. Required fields are marked *

About Me

I’m really not all that interesting. But this is my corner of the world wide web. I’m a software engineer and I enjoy biking, photography, trap shooting and tinkering with home automation.