Skip to content
My Account

HomeKit

ESP8266 HomeKit Fountain Light

A HomeKit controller for a stone water feature: a ring of 16 colour LEDs cast in resin and a 230 V pond pump switch, on a custom KiCad board that was designed, produced and tested from scratch.

  • ESP8266
  • HomeKit
  • Safety notes
  • 4 min read
No ratings yet, be the first.

A HomeKit controller for a garden water feature: it lights the fountain with a ring of colour-changing LEDs and switches the pond pump, both from the Home app. It runs on a printed circuit board that was designed for the job.

The project started when an old stone water feature was given to the author. It looked like the chance to put everything learned into practice in one build: the software, the hardware design in KiCad, making a printed circuit board, having it produced, testing it, and then using it for real. It worked.

High voltage and water

The controller board is connected to 230 V, protected by a 1 A fuse, and it switches a 230 V pond pump. Mains voltage and water are a dangerous combination. Only build this if you know how to work safely on mains wiring, disconnect the power before you touch anything, and keep the electronics in a closed enclosure away from the water. The board itself carries a high voltage warning.

What it does

FeatureDetails
Lamp, “NEOPIXEL RING”On and off, brightness, hue and saturation, from the Home app
Switch, “WATER PUMP”Switches the pond pump through a relay
ButtonA single press toggles the pump. A long press of 4 seconds is set up in the firmware but has no function
IdentifyThe ring flashes pink in three groups of three, together with the on-board LED
On-board LEDFollows the on and off state of the ring, handy for testing
UpdatesOver the air, through Life Cycle Manager 2
No cloudControl stays on your own network

The accessory shows up as WATER FOUNTAIN with the chip ID added to its name, and it has an OTA trigger characteristic for the updates.

Hardware

ComponentNotes
ESP8266 moduleAn ESP-12 type module on the custom board. See the ESP8266 pinout
NeoPixel ring16 WS2812B LEDs on a round board. See the NeoPixels WS2812B guide
RelaySwitches the pump. The KiCad project includes footprints for the G3MB-202P relay
Power moduleA Hi-Link HLK-PM01, 100 to 240 V AC in and 5 V DC out at 3 W
Fuse1 A, in a fuse holder on the board
Screw terminalsMains in and relay out
EnclosureA grey plastic junction box, with the board fitted inside
Pond pump230 V

The LED ring

The light is a ring of 16 NeoPixel LEDs on a round white board. To make it survive outdoors, the ring is cast in a waterproof synthetic resin, and it is mounted in the stone water feature, in the clear dish on top, where it lights the water.

A white circular circuit board with sixteen NeoPixel LEDs and a thin cable, lying on a wooden table
The LED ring lying in the clear plastic dish of the water feature

Designing the board in KiCad

The controller is a custom board, drawn in KiCad. The repository has the whole KiCad project, called ESP Base, with the schematic, the board layout, and the parts it needed: a relay footprint and 3D models of the HLK-PM power modules. The gerber files, which is what a board maker needs, are in the repository too, in a folder and as a gerber.rar.

The KiCad schematic of the fountain controller board
The KiCad board layout of the fountain controller board

Building it

The boards were produced, and here is a stack of the bare boards. The board has a warning triangle at the high voltage part.

A stack of bare black printed circuit boards next to one board turned over

Assembly started with the ESP-12 module and its small parts.

The assembled controller board with the ESP-12 module

On the mains side sit the HLK-PM01 power module, the fuse holder with its fuse and the blue screw terminals.

The Hi-Link HLK-PM01 power module, a fuse holder with a fuse and blue screw terminals on the controller board

The finished board fits in a plastic junction box.

The assembled controller board fitted in the grey enclosure

Testing and using it

The board was tested on the bench with the ring connected. The project checklist in the repository shows every stage as done: a new NeoPixel ring, beta testing the software, making and ordering the printed circuit board, beta testing the board, hardware installation, a proof-of-concept film and an end result film, and releasing the KiCad and gerber files.

The assembled controller board powered on during testing
A granite column water feature with a clear dish on top

The films of this project, and of many others, are on the StudioPieters YouTube channel.

Pins

FunctionESP8266 pin
ButtonGPIO4, active low
Relay (pump)GPIO12
On-board LEDGPIO2
NeoPixel ringThe I²S output, through the ws2812_i2s driver

These come from the firmware source in the fountain folder of the repository. The relay is switched active-high.

Flash and install

The installation is the same as for the other ESP8266 HomeKit accessories on this site. The firmware runs on ESP-Open-RTOS with Life Cycle Manager 2, which sets up the WiFi and installs updates over the air. The full steps, from installing esptool to flashing, joining the LCM- WiFi network and pairing, are in ESP8266 HomeKit Blinds.

In the portal, use these values:

FieldValue
OTA repositoryAchimPieters/ESP8266-HomeKit-Fountain-light
OTA binary filemain.bin

When the installation is done, scan the QR code the device generates in the Home app to add it.

Firmware releases

VersionDateNotes
1.0.010 March 2022The current version, the one used in the finished water feature
0.1.015 September 2019OTA update added
0.0.228 August 2019
0.0.127 August 2019Some bug fixes

Each release has a main.bin and a signature file, main.bin.sig.

Good to know

  • The HomeKit Accessory Protocol specification the firmware follows is the non-commercial version, for accessories you build yourself and do not distribute or sell.
  • The repository is under the MIT licence. The HomeKit setup code is set in the firmware source, so change it to your own.

Everything is in the ESP8266-HomeKit-Fountain-light repository on GitHub.

Advertisement
All HomeKit

More HomeKit

Keep building.

Switches, sensors, plugs and blinds: more accessories that you build yourself and add to the Home app.

All HomeKit