ESPHome Automated Drip Irrigation System


Every spring, we plant flowers in a dozen or more flower pots and hanging baskets around the pool. For several years, we dragged the water hose around to water the plants 1-2 times per day. This, of course, got old really quickly. So, naturally, in true Home Hack Lab style, I came up with a system to automate the process using ESPHome and Home Assistant. I leveraged some rain barrels, an ESP8266, various electrical components, a 12V battery and water pump, as well as drip irrigation lines and nozzles. This is how I put it all together. I'll break this into several parts, and links to all components will be at the end of the post.

Providing a Water Source for the ESPHome Automated Drip Irrigation System

To build a watering solution, you need a water source, right? Exactly! For this project, I purchased four blue 55-gallon rain barrels from a local internet listing and built an elevated platform out of cinder blocks and decking material.

Platform Build

Barrels on platform


Unfortunately, I had to install the barrels behind the fence to appease the subdivision czars, which meant I couldn't capture rainwater. For now, I'm filling the barrels about once every 7-10 days. I'm noodling some ideas to capture rainwater in the future.

Here is the messy, final build.


Rain Barrels on Platform

To plumb the barrels, I used 3/4" bulkhead adapters (one per barrel) to thread spigots on. Learn from my mistake and drill the holes for the bulkhead adapters as low as possible on the barrels. As you can see from the picture above, I could have gone much lower, which would have probably given the system an additional 30 gallons of water. When installing the bulkhead adapters, I learned that the concave shape of the barrels doesn’t allow the adapters to make a watertight seal. I overcame this by applying a bead of silicone to the inside piece of the bulkhead adapter before threading it onto the outside piece. No leaks as of the time I’m writing this blog. Make sure you let the silicone dry before proceeding. Next, I applied a liberal amount of PTFE thread tape to the spigot adapter threads before threading them into the bulkhead adapters and tightening them down. I installed garden hose Y-adapters on three of the four spigots and daisy-chained them all together with short sections of garden hose. Savvy readers will notice there are two spigots on the closest barrel. This additional spigot is where the irrigation lines pull from. It was installed just like the others.

The next part of the plumbing involved getting water to the barrels to fill them up. This may or may not be necessary if you can collect rainwater. In this case, I used a four-way garden hose splitter and four sections of hose connected to a replacement bung cap with 3/4" threaded knockouts. Then, I ran a segment of hose from the inlet of the four-way splitter back to the other side of my fence, where I connect my hose from the house spigot to fill up the barrels.

Plumbing done!

Wiring the ESPhome Automated Drip Irrigation System

Now for the fun part. For this project, I chose a waterproof project box and mounted it to the fence behind the barrels. Since the location is far from the house and lacks electricity, I opted to use a 12V lawnmower battery and solar charging system to power everything. Looking at my wiring, you might wonder why there are so many wires and think it could be simpler. You’re right. When I built this project, I was pressed for time before leaving for vacation and used a lot of what I had lying around. For instance, I used an ESP8266 instead of an ESP32, which meant I had to step the 12V voltage down to 3.3V but needed a 5V trigger for the relay. This created more connections than necessary. Had I just used an ESP32 that runs on 5V, it would have been simpler. All that being said, wiring something like this is pretty easy: wire the battery and solar panel to the solar charger controller and then to a set of power terminal blocks. Run a set of wires from those blocks to the relay and then the 12V pump. Done with the 12V side. Now, assuming you’ll use an ESP32, you’ll need a voltage regulator to step the 12V down to 5V. Take this 5V source to power the ESP32. Done with power... now onto ESP stuff.

Wiring

Configuring ESPHome

Since this will be an ESPHome project, flash your ESP with ESPHome. I won’t go into details on how to do that since there are plenty of tutorials available. Below is my YAML config.

ESPHome YAML File

A couple of things to point out in the YAML:

  • Lines 27-28 define a web server, which I’ll mention later.
  • Line 32 is where the GPIO pin for the relay is defined. Make sure this is the GPIO port the relay data is connected to.
  • Lines 36-50 define the WiFi signal sensor. Since this will be deployed at a considerable distance from the house, I was concerned about the WiFi signal. Adding these lines provides a signal reading on the ESP’s web server page.

Here’s what the web server looks like:

ESPHome Web Server

Having the WiFi signal is helpful, but this is also a way to ensure the relay is working by toggling the On Action.

Wrapping up Connections and Home Assistant Automation

This was actually the easiest part.  I found a drip irrigation kit on Amazon that had all of the parts I needed.  The kit came with all of the hose, emitters, adapters etc and was pretty straight forward.  I used a different kind of waterproof project box to house the pump. When connecting the pump to the water lines be mindful of the direction of flow on the pump.  Usually there is an indicator on top of the pump to tell you which direction it flows.

Project box with water pump

Once all the emitters and water lines are in place, it’s just a matter of creating your Home Assistant automation to trigger the relay at your predetermined times.

In my case, I created two automations to water once in the AM and once in the PM. Here’s the AM automation. The PM automation is identical except for the time it starts under "When."


HomeAssistant Automation

That's it!

Final Thoughts

There are certainly areas where improvements could be made. Some thoughts for future expansion include:

  • Rain/soil moisture sensors to avoid watering when not needed.
  • Covering the barrels with a roof of some kind and funneling rainwater into them.
  • Replacing the ESP8266 with an ESP32 to simplify the wiring.

All in all, this was a fun project, and it has saved us a lot of time by automating the watering process. As you can see, it works well because the plants are full and vibrant, despite record-breaking high temperatures this summer.



Flower pots
Flower potsFlower pots

Products used in this build can be found here: https://tr.ee/8GIf96.

This blog is reader-supported. When you purchase through links posted here, I earn a commission at no additional cost to you. These commissions help fund future projects, product reviews, etc.






Comments

Popular posts from this blog

How to Get on the Air With WSJT-X and FT8