Pond and Pool Water Level and Temperature Monitor
A waterproof ultrasonic sensor measures the water level and a probe reads its temperature, reported to Home Assistant.
Evaporation, leaks and heavy rain change your water level. Mount a JSN-SR04T above the surface pointing down and an ESP32 turns the echo time into centimetres, while a DS18B20 probe tells you if the water is warm enough to swim.
Keep all electronics in a sealed box well away from the water and never put mains-powered equipment near a pool. Use the solar panel and battery so nothing plugs into an outlet at the poolside.
Mission steps
Mount the sensor
Fix the ultrasonic head at least 25 cm above the highest water level, pointing straight down, away from walls.
Wire it safely
The JSN-SR04T runs on 5 V; use a voltage divider (for example 1 kΩ and 2 kΩ) on its echo line before GPIO6. Probe data to GPIO4 with a 4.7 kΩ pull-up.
Flash ESPHome
Use the YAML: the ultrasonic platform measures distance, and a template sensor converts it to water depth.
Set the mount height
Measure from the sensor to the pool or pond floor and put that value in the template.
Add alerts
Notify when the level drops a few centimetres in a day — that often means a leak.
Code
one_wire:
- platform: gpio
pin: GPIO4
sensor:
- platform: dallas_temp
name: "Water Temperature"
update_interval: 60s
- platform: ultrasonic
id: dist
name: "Distance to Water"
trigger_pin: GPIO5
echo_pin: GPIO6
update_interval: 60s
filters:
- median:
window_size: 5
- platform: template
name: "Water Depth"
unit_of_measurement: "cm"
update_interval: 60s
lambda: |-
const float MOUNT_M = 1.50; // sensor height above the floor, in metres
return (MOUNT_M - id(dist).state) * 100.0;Tip: test every script on the bench before installing it in a moving machine.
Questions
Why do I get random jumps?
Waves, rain and nearby walls cause stray echoes. The median filter helps; also check the sensor is not closer than its minimum range.