Pool Light Controller (General Purpose Dual Relay Controller)

Pool Light Controller

Dual relay controlled via WiFi and MQTT. Uses ESP-07 module to allow external WiFi antenna. Although the original motivation was to control pool lighting, this project can easily be generalized to any situation where MQTT controlled relays are needed.

Motivation

My pool controller is a standalone system, and I wanted to control my pool lights from Home Assistant. To do that, I needed to put some WiFi controllable relay contacts into the outdoor NEMA enclosure where the pool lights were controlled. I first attempted to use a Sonoff module with a custom hacked firmware. This would have been successful except that the metallic enclosure for the pool control hardware acted as a Faraday cage, preventing the WiFi signal from reaching the Sonoff unit.

The solution I finally arrived at was to develop a custom PCB using an ESP-07 module, which has not only a WiFi antenna printed onto the PC board, it also has a connector allowing a coax to an external antenna, which can then be mounted outside the enclosure. The custom board works very much like a Sonoff module, and accepts arendst’s github Sonoff-Tasmota firmware (with some minor customization).

Early prototype in plastic case

Outdoor pool control box with external wifi antenna

Closer view of external wifi antenna

Pool light controller installed into outdoor NEMA box

Features

  • Built in power supply allows direct connection to AC mains (85 ~ 305VAC). No external adapter required. This was important as there was no place to plug in an adapter within the NEMA enclosure.
  • Two isolated, independently controlled, normally open relay contacts rated at 10 amps each.
  • Connector for external WiFi antenna allows unit to be mounted within a metal enclosure with the antenna mounted outside.
  • Over the air software updates.
  • Wifi control via MQTT subscription.
  • Compatible with 3rd party Sonoff firmware

Hardware and Firmware Docs

Hardware
Firmware

Home Assistant Configuration

light:
  - platform: mqtt
    name: "Spa Light"
    command_topic: "cmnd/pool-light/power2"
    state_topic: "stat/pool-light/POWER2"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true
  - platform: mqtt
    name: "Pool Light"
    command_topic: "cmnd/pool-light/power1"
    state_topic: "stat/pool-light/POWER1"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true

Availability

All the documentation is on GitHub, but if you’re not interested in building your own, I’ve built up a few of these and offered them on Amazon, ebay, and Tindie.

2 Likes

Great project! Thank you for sharing.

1 Like