I have been working on a smart sustainable garden project for a while now. In my mind a smart sustainable garden will need to overcome several draw backs to a traditional garden (Watch this space for the link to the main project coming soon).
In this blog we will be focusing on the water level in a Jojo tank that harvests rainwater. This is a pretty important aspect to the sustainability of the garden and answers a very simple question, “Do I have enough water to irrigate the garden?”
While we have plenty rain here in KwaZulu Natal there will be times when the water supply might be questionable, especially during winter. So how do we monitor the water level?
Equipment Needed.
- 1 x Non-contact Digital Water / Liquid Level Sensor XKC-Y25-T12V
- 1 x D1 Mini
- 1 x 3 Flat Ribbon Cables
Optional
- 1 x Battery Pack
It goes without saying you need Home Assistant running but just in case you didn’t know, now you do.
Step 1
Install and configure ESPHome in Home Assistant.
This is the guide I used to install the ESPHome add-on Getting Started with ESPHome and Home Assistant — ESPHome
Step 2
Build your sensor.
I soldered the D1 Mini and used the Flat Ribbon Cables to connect the GND, 5V, GPIO14 to the DFRobot chip.
I like to keep it challenging so I connected the yellow to GPIO14 (D5) on the board, Blue to GND and Green to 5V.
I then plugged this into my PC with a USB cable and made sure the power came on.
Step 3
Update the D1 Mini with the ESPHome firmware from Home Assistant.
Simply create a new configuration with a name and your SSID details.
To complete the configuration, add the following to the script.
binary_sensor:
– platform: gpio
name: “Tank Water Level”
pin: GPIO14
Click Save and then Install.
Select the USB port that your D1 Mini is plugged into.
Step 4
Home Assistant configuration.
Head over to Home Assistant and click Configuration –> Integrations and search for ESPHome.
Add the new device you just created in the Host
Now you should be able to see the device.
Simply add the Entity to Lovelace or start using it in Automations to make things happen.
Finally, you will need to attach your sensor to your JoJo tank, which is pretty straight forward if you have power available. If you don’t there are some solar/battery options available, but I wont cover that now.
To test this product, I have a temporary setup which I will need to enclose in a waterproof casing eventually, but here you can see the sensor installed and working. I did have issues with it not sensing water level if placed too close to them bottom of the tank, I only started getting readings above about 20cm from the bottom. I assume one could add additional sensors to other GPIO’s on the D1 Mini to detect multiple water levels of the tank.