My Garden Irrigation

Btw, @klogg is it possible to edit your code to insert a second start time (in schedule) without pain?
For example morning cycle schedule has 2 start times: start at 08:00 and 12:00 also.

I think that would be a big job.
It might be possible and a lot easier to add a third cycle but I’m not sure.

It’s been a while :slight_smile: but that was a good question and the answer was that I really didn’t know any better. However…

Since then I have learnt a fair bit and now use a few ESP8266 boards for some simple stuff using ESPHome. The irrigation system has been running so well we have decided to expand it to possibly eight zones and rather than duplicating all the sonoff/transformer side I am considering something along the lines of what you suggested.

The valve box I use is 24vAC. Is that still a possibility?

Yes, sorry there was a mistake in my previous post. I am using 24Vac switched through the relays. I also used a bridge rectifier and step-down power supply to derive 5Vdc from the 24Vac power supply to run the ESP.

Nice.
Is your setup documented anywhere?
(Pictures, circuit diagram etc.)

Only my code is documented on this forum (here) however I will try to create something regarding the hardware this weekend

1 Like

Hello everyone, I have adapted the code originally written by @klogg (thanks !!!) and customized to my own settings (ESP32 using ESPHome, up to 8 zones, removed the weather related watering adjustments). The ESP is powered with a 5v power supply, the relays are connected to a separate 24v power supply. All works great with one issue : if the relays are powered before the ESP is plugged in then all the valves are opened and water flows until the ESP32 is plugged in. If the house power goes off it should not be an issue since both would be off but i am worried that if the ESP goes bad then all the valves open…I hope someone can spot if there is a problem with my install or wiring ? Thanks in advance everyone !

The code for the ESP is as follows :

esphome:
  name: esp32_1
  platform: ESP32
  board: nodemcu-32s

wifi:
  ssid: "XXXX"
  password: "XXXXXXX"

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "XXXX"

switch:
  - platform: gpio
    name: "Zone1"
    pin: GPIO4
  - platform: gpio
    name: "Zone2"
    pin: GPIO16
  - platform: gpio
    name: "Zone3"
    pin: GPIO17
  - platform: gpio
    name: "Zone4"
    pin: GPIO18
  - platform: gpio
    name: "Zone5"
    pin: GPIO19
  - platform: gpio
    name: "Zone6"
    pin: GPIO21
  - platform: gpio
    name: "Zone7"
    pin: GPIO22
  - platform: gpio
    name: "Zone8"
    pin: GPIO23

Pictures of my wiring as well as my configs are located here.

This is exactly what I am considering doing, inspired by @sparkydave.

Over the last couple of days I have been reading up a bit but I am still at least several levels below expert in the field of ESP32s and electronics so forgive me if this is obvious, but the relay board can be wired so that the relays are either normally open or normally closed. Have you got them wired normally closed?

I have them wired in the normally open port. I tried and switch the wire to the NC port, same behavior, as soon as I plug in the 24v supply the valves all open. I also tried to switch the Plus and the Minus on the 24v power supply, no change…I am a total beginner and have no clue here :slight_smile: btw, congrats on your code again ! Very well documented and so easy to adapt. Thank you !

1 Like

I have mine normally open.

Yes sorry, that is what I meant. I should have been clearer, my question was probably misleading. I was meaning to ask if @mviamin had them wired the ‘wrong’ way rather than checking if he had them the right way…
:upside_down_face:

Did you manage to do anything on this?

Not yet unfortunately. I’ll see how I go for time this weekend… Part of the problem is that I accidentally fried the ESP running it so am waiting on the replacement to arrive, but I can still create a post about it I guess, it just doesn’t work right now :grimacing:

1 Like

Hi. During holidays I finally installed my sonoff 4ch in place of the classic irrigation timer. Everything is working perfectly! Thank you klogg!
PS: I’m not using weather adjustments.

1 Like

Hi klogg,
Are your transformers 24V AC? If so, can you tell me where you got them?
Cheers,
Sean

You can use this https://www.amazon.it/dp/B00K1CWEUG/ref=cm_sw_r_em_apa_i_esrzDb5RQ4YZ2

Yes they are 24V AC.
Are you in the UK? I think I got them from ScrewFix but I will try and find out for sure later.

I am in the Netherlands, but am in the UK often and can have items shipped to an address there.

And just saw ita’s link: I hadn’t realized doorbell transformers are 24V AC. That does simplify things.

thanks both

Did you ever fix this? I have just seen a thread that might be connected Relays change state on boot and restart - how to fix?

or then again it might not. I am by no means an expert.

In thread You linked I’m connecting relays directly to Raspberry PI, but @mviamin is using ESP to control relays - that’s different hardware :slight_smile: