Garden Irrigation

Just wanted to share my hardware setup and where I am going with the software. Thanks to all in this thread for the inspirations. Most of the parts for mine I had lying around so this hasn’t cost me that much. By the sound of it many other people have done something similar.
The brains is an ESP32 (labelled F). I initially started with an ESP8266 until I saw that the ESP32 had a bunch of analogue inputs available that I want to use for moisture sensors. So the row of connectors marked C are connected to one ground and nine analogue pins. I plan to use one or a couple for powering the sensors and the rest to take the readings. I am going to power them on only as necessary. After doing some research I am going to use capacitive sensors and waterproof them as per here: https://www.instructables.com/id/Waterproofing-a-Capacitance-Soil-Moisture-Sensor/

For power I am using a 24VAC 1A brick that I found in my box of bits. I then built my own rectifier (marked D) with 4x 1N4004 diodes and the capacitor you can see. I could have gone with a smaller cap but that is one I had in my box. I 3D printed the little box it is in to insulate it from other parts.

The ~40VDC is brought down to 5V by one of these: https://www.ebay.com.au/itm/DC-DC-Buck-Converter-Voltage-Regulator-Step-Down-Module-10A-24V-60V-to-3V-19V-AU/163606467487 It is under the cover marked E which again I 3D printed to insulate it from the other components.

I had the small voltmeter also lying around so I added that in just to monitor the output of the converter. The 5V DC is connected directly to the relay bank and the ESP32. The relays are connected to the terminals marked B. The terminals marked A are the common AC line.

All of this is in a waterproof enclosure with any holes silicon-ed up.

From a software perspective I am planning on using elements from @sparkydave specifically the ideas of inhibiting the sprinklers if the chance of rain is high or there has been recent rainfall. I have a weather station at home so I use my own rainfall data. As I previously mentioned I do plan on using moisture sensors so depending on the success of that I hope to move to that primarily. I was concerned about scaling up @sparkydave 's programming mechanism from 2 zones to 8 so instead I am going to use the google calendar integration as @oscill8ory did.

Whilst everything is still sitting on my desk being tested I plan to install this week. My frontend for the sprinklers currently looks like this:

Hopefully this slightly different approach is useful to others.

1 Like

Hello, i wanted to do a second menu like the on below with week day switch to select wich day did the irrigation work.


As i undestand this work with groups so i made one in group.yaml:

Programmation:
  view: no
  control: hidden
  name: "Programmation"
  icon: mdi:setting
  entities: 
    - input_boolean.aspi_monday
    - input_boolean.aspi_tuesday
    - input_boolean.aspi_wednesday
    - input_boolean.aspi_thuersday
    - input_boolean.aspi_friday
    - input_boolean.aspi_saturday
    - input_boolean.aspi_sunday

I try to ad this as a buton in frontend but it doesn’t work:
can anyone help me please?

Firstly WELCOME!

The view: and control: lines are no longer supported so you can remove those. https://www.home-assistant.io/integrations/group/

Groups, before Lovelace UI, were used to organise the cards in the display as well as organise multiple entities into one. Since Lovelace UI groups are not used for display purposes.

I am not sure how to do what you are after with a popup menu but you can just add all those entities to a lovelace entities card and it will appear in your UI. https://www.home-assistant.io/lovelace/entities/

hi,
i try to follow your code but at begin when i create the sensor i’ve this error:

Invalid config for [sensor.template]: [next_run_front_shrubs_time] is an invalid option for [sensor.template]. Check: sensor.template->next_run_front_shrubs_time. (See ?, line ?)

you have suggestions

thanks

@sparkydave
I could not get the possible_rainfall_today sensor to work, so with some help we came up with this and it is working.

The BoM sensor returns something like 3 to 8 mm. The code below takes the average of the two values, so for 3 to 8mm it would be 5.5 mm

- platform: template
   sensors:
     chance_of_rain_today:
       entity_id: sensor.bom_perth_chance_of_rain_0
       friendly_name: "Chance Of Rain Today"
       value_template:  >
         {{ states('sensor.bom_perth_chance_of_rain_0') | replace("%", "") | int }}
     possible_rainfall_today:
       entity_id: sensor.bom_perth_possible_rainfall_0
       friendly_name: "Possible Rainfall Today"
       value_template:  >
         {% set rainfall = states('sensor.bom_perth_possible_rainfall_0') %}
         {% if ' to ' in rainfall %}
         {% set values = rainfall.split(' to ') | map('float')|list %}
         {{ values | sum / values | length }}
         {% else %}
         {{ rainfall | float }}
         {% endif %}
1 Like

Nice, that’s the code I needed to sort out my “it might rain” sensor. Between that and a D1-Mini connected to a soil capacitance senor, I’m hoping I can do away with schedules altogether.

Wish I had found this thread earlier in my sprinkler project research. It’s full of great info. So far I’ve got a Tasmotized Sonoff 4CH Pro r2 controlling three Gardena 24vac valves and the above-mentioned soil moisture sensor I built. Hardware is 99% sorted, just a lot of testing and refining to dial it all in.

Hi @jokkydee,

By any chance, are you able to post your code for the 11 zones. I have 10 zones and just have not managed to come back to this package to amend it for my zones (running an automation at the moment, but would like to include BOM data, so want to use this excellent package from sparkydave.

thanks

Just wanted to post my irrigation control for some feedback. It’s a simple 3-zone (lawn sprinklers, flower beds soaker pipe, and garage roof veggie garden soakers) with a capacitance soil sensor. Currently testing the sensor so it’s actually sitting in the kitchen monitoring a basil plant instead of outside.

Basically, I have manual control for the 3 zones, forecasted rain data and a 5-day history of the soil sensor, actual rainfall and the history of the control valve actuation. I need to change the manual control to a script with a fixed time so I can’t accidentally leave it running and I need to finalize my control logic. My plan is to check the soil sensor each morning at 6AM. If the soil is above X%, skip watering that day, if it’s below X% but more than Y mm of rain is predicted, skip watering that day, if it’s below X% and less than Y mm of rain predicted, then water for Z minutes. Repeat for all three zones.

What soil moisture sensor did you use? I initially tested out the cheap ones you can get on Aliexpress / Banggood but found they don’t last long despite me running code to only switch them on briefly when wanting to take a reading. I now use the Xiaomi wireless ‘Flower’ sensors which seem pretty good.

image
I didn’t know any better, so I have the cheap ones from Aliexpress connected to a Wemos D1-Mini and a 24v-5v converter (I have 24 VDC available from the patio lights). What happens when they’re powered constantly, they eventually fail completely, or just give erroneous readings?

I looked at the Xiaomi sensor, I thought it wasn’t Zigbee though, BT?

Edit: Looks like it’s BT but the MiFlora integration looks pretty simple to use. My only issue is figuring out a way to extend the BT range as my RPi is not in BT range of where I’d be using these sensors.

Edit #2: Seems like I can use an ESP32 to handle the BLE devices :slight_smile:

BR
Tony

I did this to maximise life https://www.instructables.com/Waterproofing-a-Capacitance-Soil-Moisture-Sensor/

1 Like

I use esphome with the Xiaomi soil sensors (miflora). https://esphome.io/components/sensor/xiaomi_ble.html

Then you just need an esp32 within BLE range of the sensor, and Wifi range of your access point.

1 Like

correct. they corrode badly. Energise them only when you want to take a reading for max lifespan but look to swap them with the Xiaomi MiFlora that Nick listed as they are much better plus give you additional data

2 Likes

Cheers for the BLE/ESP32/Xiaomi solution. I’ve got a couple of sensors on order and a NodeMCU to set up. I’ve only ever used Tasmota, so this will be a good project to learn ESPHome.

I have developed an integration that may be useful to people reading this thread. It’s an alternative to lengthy and complex automation scripts designed specifically for managing irrigation valves.

Good luck and thanks to all for the information on this site.

8 Likes

I’ve just had a quick read through this and it it looks brilliant.

I’m going to have a detailed look at it but I can feel the possibility of a version 3 of my irrigation system coming…

1 Like

Reviving an old one here. I built my own today with an ESP8266. Has a capacitive sensor and DHT22 Temp and Humidity sensor attached. I’ve built one for outside and one for inside for now… Plan is to slowly build an irrigation system using solenoid valves that will maintain certain moisture levels in the soil, hopefully resulting in some decent tomatos.

I had accidentally ordered the resistive type sensor and yes, after a day, they were already showing corrosion on about 30% of the contacts.

As this topic is quite advanved, can anyone recommend a valve that is ready for outdoor use and has good compatibility with Home Assistant?

As I see it the setups are really sophisticated, all I need is one or two valves that I can hook up to an automation and go on/off.

Thank you

Search for solenoid valves (or solenoid ball valves). Any that open when a voltage is applied will work.

Are you wanting an off-the-shelf solution or happy to DIY something together?