Skip to content

This project aims to help you creating a water tank level sensor with off the shelf components. It uses esphome for Home Assistant integration.

Notifications You must be signed in to change notification settings

tomsbasement/esp32-water-tank-sensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ESP32 Water Tank Level Sensor

This project aims to help you creating a water tank level sensor with off the shelf components. It uses esphome for Home Assistant integration. The idea is based on hardware from DFrobot :

You can find the full video guide here :

Make a Water tank level sensor

Wiring

Wiring information

Step 1 : Create OTA switch in HA

Go to HA > Parameters > Devices and services > Input. Create a new Switch sensor and call it "Prevent deep sleep". Then activate it.

Step 2 : Add your device to ESPhome

Plug your device to your computer with a USB cable while holding the "Boot" button. Once it is plugged in, you can release the button. Open your Esphome installation and add a new device, call it "Water tank sensor" or whatever you want. Add it as an ESP32 device but don't install it yet, skip all steps. Edit the config file and replace it by the one from this repository. Just keep OTA key and API key so you can replace "CHANGE_ME" placeholders from the config file of this repo. Save the configuration then close it

Step 3 : Install your device

Still in ESPhome, click on the three dots in the right corner of your newly created device and choose "Clean Build Files". Once done, click on "Install" in the same menu. Choose the option "Plug into this computer". Wait for a few minutes until you have a confirmation the installation was successful. Pull the USB plug from the device and put it back in to power cycle it.

Step 4 : Profit

Now, go to Home Assistant, you should be prompted to add your device to your installation. The device has deep sleep enabled to save energy, so if it becomes unavailable, you just have to plug the USB and put it back in. Once it is added to HA, go to Parameters > Devices and services > Input and disable the switch.

The ESP32 will poll the temperature, humidity and water height every 5 minutes and then will go to sleep after 30s. The battery will charge itself with the PV module so your sensor will be self sufficient.

Step 5 : Adjust calculation

In order to get a correct value for your percentage of remaining water, you will need to adjust some calculations :

Adapt this line in your configuration file :

    lambda: |-
      return ((900 - id(water_level).state) / 850 * 100.00);

And change the values (they are in mm !) according to this schema :

Calculation

About

This project aims to help you creating a water tank level sensor with off the shelf components. It uses esphome for Home Assistant integration.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published