We’ve had this sort of makeshift garden fountain for several years. My wife put it together from several crockery pieces and I added a Lil Giant pump to the lower bowl to deliver water to the upper bowl nozzle.
For the first years, it was located close to our garden hose outlet, so topping off the level every couple of days was easy. Eventually, though, she wanted to move it to a different location, where refilling would be more of a chore.
First, I added a nozzle mounted on the ground nearby. I fed the nozzle from a garden hose outlet with a 120 VAC solenoid valve controlled by a smart plug. I controlled the smart plug from a Home Assistant dashboard. When the solenoid is on, a stream of water from the nozzle arcs and lands in the lower bowl. It’s a fun demo we like to show to visitors, and it continues to delight the child in me to this day! See cover photo and photo 1.
While this made it easier to maintain the fountain level, it was still a chore to remember to top it off. I wanted to trigger refilling automatically, but the timing of refills varied with temperature, rainfall, wind and with which of several nozzles we were using in the upper bowl. For closed loop control I needed to measure the fountain level, but, how to do that? I considered ultrasonic and laser sensors mounted above the unit, but I didn't want any visible wiring or sensor supports. Also, they didn't work very well with the choppy water surface.
I came upon the ABP2 series of pressure sensors from Honeywell. These have a small barbed nozzle to measure pressure and are available in ranges suitable for measuring liquid level. The pressure from the lower bowl is transferred via a length of ¼” polyethylene tubing that passes through a silicone caulk seal to the sensor in the fountain base (see photo 2). The pressure (in inches of water column) directly corresponds to the height of water above the sensor. The sensor I used was Honeywell model ABP2DANT001PG2A3XX purchased from DigiKey (about $24). That sensor has a single barbed port (“AN” in the model number), is good for liquid media (the “T” in the model number), has a pressure range of 0 – 1 PSIG (the “001PG”) and has an I2C output at address 0x28 (the “2”). The 1 PSIG maximum range is equivalent to 27.7 inches of water, which covers the fountain application nicely. Other ranges are available. Other models offer I2C at other addresses, or an SPI interface.
My fountain has a base in which I could locate the sensor, making it easy to deliver the liquid pressure to the sensor nozzle. The extra height for the connecting tube to the sensor can be subtracted so that the bowl level can be displayed (see below). Fountain configurations differ, but if you can deliver the liquid to the sensor via tubing, the sensor will reliably measure the height of liquid above it.
I mated the pressure sensor to a clone ESP32dev board on a piece of 4” x 3” perfboard (see photo 4). Wiring is as shown in the schematic. Mains AC power was already being delivered to the fountain to run the pump. I power the ESP32 via it’s micro USB connector from a USB cube in the fountain base. The sensor is powered from the 3.3V pin of the ESP32. The 10K pull-up resistors and 0.1 uF capacitor are per the sensor datasheet recommendations. The ESP32 connects to Home Assistant via its WiFi interface. Integration is easy as the ABP2 sensors are integrated into the ESPHome Builder HA add-on.
I housed the finished perf board assembly in a polyethylene food storage bag (see photo 5). I originally thought this would be temporary for testing, but as it looked fine after one season I left it in place for season 2. I used a short piece of 3/32” ID x 3/16” OD fuel line to connect directly to the sensor. The fuel line pushes snugly into the 1/4” poly tubing from the fountain bowl. This allows the sensor board to be removed if necessary. Silicone caulk is used at all interfaces: bag to sensor, tubing to sensor, and smaller tubing to larger. The sensor assembly hangs below the fountain bowl with the nozzle facing up. The USB power cable enters through the bottom of the bag, which is left open.
The ESP32 firmware was generated using ESPHome Builder from the YAML shown. The min_pressure and max_pressure parameters are by default in units of Pascals. The 6895 max_pressure corresponds to the sensor full scale value of 1 PSIG. Most of the YAML will be generated by ESPHome Builder. You will need to add the i2c and sensor sections and adjust the wifi section per your situation.
The Home Automation level entity originating from the sensor, sensor.fountainlevel_fountain_level, has user selectable units, but I wanted the display in of Inches of Water column, which was not available. I selected PSI for the units and created an HA helper entity (sensor. fountain_level_inches) for use in displays and in refilling automations. The configuration code for the Fountain Level Inches helper is listed.
After some trial and error, I took the following approach to automating the refill. First, I have an automation that closes the solenoid valve 20 seconds after it opens, no exceptions. This is a foolproof step in case I forget to turn it off (I found out this was needed the hard way!). For refilling, I run a refill automation every 5 minutes (time patter trigger /5 minutes). The level in the bowl changes very slowly and the five minute interval ensures there’s a new level reading before another refill is considered. The automation opens the solenoid if the bowl level is below a fixed value (4.5 inches in my case) and is above zero (this prevents refilling if the level sensor has failed). I added an ‘input_boolean.disable_fountain_autofill’ helper. This gives me a dashboard switch to disable auto filling. The solenoid opening is not triggered if the disable helper is true. If all conditions are right, the automation simply opens the solenoid valve. I leave it to the “close after 20 seconds” automation to close the solenoid.
The dashboard entities card is shown below.
With the automation in place, the fountain goes weeks without any attention. It occasionally needs cleaning -- I haven't automated that yet. At the next interim between seasons I plan to add a relay to control the fountain pump. While we normally let the pump run all summer to prevent mosquito breeding, the relay would allow the pump to be shut down to protect it if the bowl level was low.






Comments