logo elektroda
logo elektroda
X
logo elektroda

Garden irrigation controller integrated into the HomeAutomation network via the mySensors protocol.

jroger 3243 6

TL;DR

  • ESP8266-based garden irrigation controller on a Wemos D1 clone, integrated with HomeAutomation through the mySensors protocol as a replacement for a Hunter controller.
  • It drives three 24V AC valves with Panasonic AQY212 optoMOS relays, uses a rain-sensor reed switch to cut power, and measures valve current with an ACS711 Hall sensor.
  • The power stage converts 24V AC to 3.3V DC with an LM2675M-3.3 module and uses two 1A fuses for input and valve protection.
  • The controller exposes eight logical devices over TCP/IP, so the home automation system handles schedules and can skip watering when rain is forecast or detected.
  • Reading the ACS711 through the ESP8266 A0 pin must be done in intervals of about 50 ms; continuous analog reads can drop WiFi and prevent recovery.
Generated by the language model.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
📢 Listen (AI):
  • Welcome,

    I wanted to show you my irrigation controller that I built based on ESP8266 has a clone of the WemosD1 board. It is interfaced with the home automation using the MySensors library [ref 3].

    In a nutshell, the idea is to have all devices managed from one application (doesn't matter if it's air conditioning, ventilation, heat pump, blinds, curtains, light, water, cameras, ...) and I'm sticking to it. The controller was intended to be, and is, a replacement for the Hunter controller, which had no integration with home automation (a WiFi module needs to be purchased and then the question of integration with my current system and requirements remained).

    The irrigation controller can be packaged in two Kradex enclosure models, Z101 and ZD1006 - pre-drilled plates for both enclosures.

    This controller is such a slightly poorer clone of user @tmf's controller (https://www.elektroda.pl/rtvforum/topic3667909.html), nevertheless its "poorness" in my case its a super advantage.

    .
    Irrigation controller based on ESP8266 with three illuminated buttons.



    .
    I've added reference links to the entries at the end of the post. I have used them myself, if anyone is interested in the topic it will save time.

    Features.
    Functions.
    Functions the device has:

    1. powering the entire device via 24V AC (with the LM2675 inverter to 3.3V DC, which is required for the ESP8266 WiFi module)
    2. control of 3 24V AC valves (with optoMOS, which gives galvanic separation)
    3. shutting off watering via rain sensor (cutting off one pole of the valves' power supply via a reed switch in the rain sensor)
    4. detection of whether current is actually flowing through the valves (via ACS711)
    5. user interface in the form of (3 illuminated buttons and 2 indicator lights).
    6. MySensors interface for the exchange of information and commands with the controller via WiFi.

    Details of the solution and individual functions.
    .
    .
    Electrical schematic for an irrigation controller with ESP8266. Wiring diagrams of an irrigation controller on two colorful PCBs.
    .

    Power supply. .

    I based the power supply module on the LM2675M-3.3 chip, which is popularly used. I had picked it up on the forum for several projects.
    The purpose of the module was to convert 24V AC to 3.3V DC, which is needed to power the ESP8266. The device is powered by 24V AC because this is the rated current to be supplied to the solenoid valves.

    I made the module as a cross between information from DS and archived threads where user @-RoMan- and advice given to me by user @ArturAVS.

    The power module has two protections. The first protection is a 1A polymer fuse on the path that goes to the rectifier bridge, the idea is to not let too much current into the inverter.
    The second protection is a 1A fusible (cylindrical) fuse that protects the solenoid valves. I don't expect to use more than one valve at a time, so this protection is more than OK (the coil current of my solenoid valve at start-up should not exceed 0.5A, and 0.2A during operation). Possible additional protection is software prohibiting the actuation of more than one valve.

    . Control of 3 24V AC valves
    Controlled by optoMOS relays (Panasonic AQY212).
    The control is done with SSR optoMOS relays (Panasonic AQY212). I used them because the technology in which they are made guarantees galvanic separation between the board circuit and the valve circuit.
    They are controlled from three pins of the ESP8266 chip. These pins are also used to illuminate the buttons, so a high state of a pin illuminates the diode in the relay (and closes it, consequently activating the valve) and illuminates the diode in the button on the case. Cool effect.

    Disabling watering by rainfall sensor.
    .
    This is a function I copied from the Hunter controller. The rainfall sensor contains a reed switch (NC) that disconnects the circuit when it rains. Without going into detail why, but I have left this function as it is. One 24V AC pole of the valve supply flows through the wire with the reed switch in the rainfall sensor. If the washers are on and there is rainfall at the same time, the circuit is disconnected by the reed switch and the washers switch off. Generally the function works, but I wouldn't do it today - my integration with the weather takes care of that (if rainfall is predicted, watering on a particular day won't happen).

    Detecting if current is actually flowing through the valves (using ACS711)
    .
    As stated above, there may be a situation where there is an order to splash water and at the same time there is a disconnection of the solenoid valve circuit by the rainfall sensor. I detect this situation with a Hall sensor (ACS711 chip). It is plugged into the solenoid valve circuit and it measures the current in this circuit, the analogue measurement from this sensor is passed to the ESP8266, and this pin it with the ADC (pin A0). .

    With this function I detect a "RAIN STOP" situation, i.e. stopping watering due to rainfall (logically: IF the solenoid valve is open AND no current is flowing through it THEN signal RAIN STOP).

    VERY IMPORTANT NOTE : when using the WiFi libraries on the ESP8266 you need to know that the A0 pin (or more precisely the ADC) is used by the ESP in the WiFi signal quality monitoring process. Reading the current value from the ACS should be done in intervals - I use 50ms and it is OK. A non-stop reading with no interval will result in signal loss (and the module will no longer recover the connection). For the inquisitive, I refer to the references (ref 4., ref 5.).

    Below I paste the short code for the Arduino Framework for inspiration.
    Code: C / C++
    Log in, to see the code
    .

    User interface. .
    The interface is implemented by 3 illuminated buttons and 2 indicator lights.

    The 3 illuminated buttons are used to manually activate/deactivate the valves, and the fact that they are illuminated indicates that the electro-valve in question is open (i.e.: the section is irrigated). A section can be switched off with a button if it is currently working. Generally, I have left the buttons in case, for some reason, there is no connection with the automatic control panel (the controller itself is not very "intelligent", it does not know the schedules).

    From a device point of view, The buttons are shorted to the input pins of the ESP8266, each input pin is pulled up to 3V3 with a 10k resistor (PULL UP). Pressing the button short circuits the input pin to ground and this signal is interpreted by the ESP.

    As the buttons are connected to the board via wires, there is a risk of them generating interference (they can act as antennas). For this reason, I additionally used 100nF capacitors on the input pins of the ESP8266.

    It takes the controller as many minutes to start watering a section as it is told to by the controller. Information about the section watering time is stored in the ESP8266's EEPROM, so this information is not lost when there is no connection to the controller. The idea is to protect against the situation where the controller orders the watering, the connection to the controller is lost and the water pours endlessly - and this is part of the fine intelligence of the device itself.

    There are 2 indicator lights. One (RX CMD) indicates that a command has been received from the button or from the automation management device, and the other indicates that watering has stopped due to information from the rain sensor ('RAIN STOP', I wrote about this above).

    MySensors interface
    The device communicates with the outside world over the TCP/IP protocol on a programmed port (e.g. 5003). The communication interface is based on the mySensors library.
    At the moment, the device 'exposes' the interface for 8 logical devices (section switch, watering length of each section - x3 sections equals 6 devices), the 'RAIN STOP' flag and the current flowing through the ACS711 chip. Communication is, of course, two-way.

    Thanks to very efficient and reliable communication, the entire watering logic resides in the home automation system controller. The integration part itself is very interesting, but also quite extensive and deviates from the design of the device itself.
    As an illustrative example, I am uploading below a screen shot of how irrigation looks from my controller (domoticz). Thanks to the fact that everything is in one place, interesting effects can be achieved quickly (e.g. preventing watering in the event of rainfall forecast for the day, etc.).

    .
    Screenshot of a terminal interface displaying irrigation controller data. .



    .

    References:
    1. LM2675 power supply: https://www.elektroda.pl/rtvforum/topic2311352.html
    2. user irrigation controller @tmf: https://www.elektroda.pl/rtvforum/topic3667909.html
    3. mySensors: https://www.mysensors.org/
    4. analogRead() problem in WiFi library for ESP8266 ("analogRead forces WiFi to disconnect #1634") https://github.com/esp8266/Arduino/issues/1634
    5. a thorough investment of the analog read() problem, great stuff
    https://github.com/krzychb/EspScopeA0/tree/master/Bravo#results

    Cool? Ranking DIY
    About Author
    jroger
    Level 9  
    Offline 
    jroger wrote 19 posts with rating 12. Been with us since 2011 year.
  • ADVERTISEMENT
  • #2 21276826
    gulson
    System Administrator
    Posts: 29231
    Help: 148
    Rate: 5984
    Thank you for sharing the solution!
    I see that it would also be possible to integrate with Home Assistant, since you have a connection to MySensors.
    I'm getting the combination right? https://www.home-assistant.io/integrations/mysensors/
    Because for some it is Home Assistant that is the hub of everything.
    Well done, if you allow later I will translate the topic into English for all the world to see!
    Please drop me a PM on PW and I will send a small gift.
  • ADVERTISEMENT
  • #3 21276838
    jroger
    Level 9  
    Posts: 19
    Rate: 12
    Hey @gulson,

    Yes, mySensors integrates with HomeAssistant without a problem, although I have not used Home Assistant, so I am not in a position to discuss the details (I only use Domoticz).

    J

    Added after 2 [minutes]:

    gulson wrote:
    Thanks for sharing the solution!
    I see that it would also be possible to integrate with Home Assistant, since you have a connection to MySensors.
    I'm getting the combination right? https://www.home-assistant.io/integrations/mysensors/
    Because for some, Home Assistant is the hub of it all.
    Well done, if you allow later I will translate the topic into English for all the world to see!
    .

    Sure, no problem with the translation, go ahead.
  • #4 21279072
    Oddawajsanki
    Level 8  
    Posts: 84
    Rate: 5
    interesting project :D
  • ADVERTISEMENT
  • #5 21279684
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #6 21284298
    Kuniarz
    Moderator of Designing
    Posts: 4520
    Help: 371
    Rate: 825
    Great design and execution !

    jroger wrote:
    User interface as (3 illuminated buttons and 2 indicator LEDs).
    .
    It would be useful to have descriptions next to these buttons and LEDs.
    You know what they are for, maybe someone in the family does too, but if a complete stranger looks at the controller, they won't know what is for what ;-)
    You printed that grass in the background, you could add the descriptions as a cherry on the cake ;-)
    Helpful post? Buy me a coffee.
  • #7 21285032
    jroger
    Level 9  
    Posts: 19
    Rate: 12
    Hey @Kuniarz,

    Thanks.

    I have several sticker designs, also with descriptions, etc. I chose one because it suited me best - a matter of taste.

    The family knows what to press to pour. I know from experience that children use the buttons to play tricks on someone - and this is what prompts them to remove the buttons ;-) .

    As far as strangers are concerned, I would like them to play with the "critical infrastructure" of the garden, so in this case the lack of descriptions is an advantage :-) the controller itself is hidden, so that it is not conspicuous and there is no temptation to play with coloured buttons.

    J
📢 Listen (AI):

Topic summary

✨ The discussion revolves around a user-developed irrigation controller based on the ESP8266, specifically a Wemos D1 clone, which integrates with home automation systems using the MySensors library. The controller serves as a replacement for the Hunter irrigation controller, which lacks home automation capabilities. The user highlights the potential for integration with Home Assistant and shares that the controller can be housed in Kradex enclosures Z101 and ZD1006. Feedback from other users includes suggestions for labeling buttons and LEDs for clarity, as well as comments on the design and execution of the project.
Generated by the language model.

FAQ

TL;DR: A DIY ESP8266 controller switches 3 zones and replaces a Hunter unit for users who want one automation app for watering. “Everything is in one place,” so mySensors can expose valves, runtimes, rain stop, and current feedback to Domoticz or Home Assistant without the original vendor Wi‑Fi module. [#21276821]

Why it matters: This design shows how to unify irrigation, weather logic, manual override, and fault feedback inside one home-automation workflow.

Option Integration path Where logic lives Notes from the thread
DIY ESP8266 + mySensors TCP/IP on a programmed port, e.g. 5003 Home automation controller Exposes 8 logical devices plus RAIN STOP and current feedback
Domoticz Confirmed in use Central controller Used for the full watering logic and forecast-based blocking
Home Assistant Possible through mySensors Central controller Mentioned as compatible, but not tested in detail by the builder
Original Hunter + Wi‑Fi add-on Vendor module purchase required Hunter ecosystem Raised integration doubts with the existing system

Key insight: The most important design choice is keeping irrigation intelligence in the automation hub while the ESP8266 enforces local safety, such as stored run times and rain-stop detection. This prevents endless watering if the network link drops.

Quick Facts

  • The controller runs from 24 V AC because the solenoid valves use that supply, then converts it to 3.3 V DC for the ESP8266 with an LM2675M-3.3 module. [#21276821]
  • Hardware outputs control 3 separate 24 V AC valves through Panasonic AQY212 optoMOS SSRs, and the buttons illuminate when the same ESP8266 output goes high. [#21276821]
  • Protection uses two 1 A fuses: a 1 A polymer fuse before the rectifier/inverter path and a 1 A cylindrical fuse for the valve circuit. [#21276821]
  • Current sensing uses an ACS711 on the valve circuit and reads it through A0/ADC; the builder reports 50 ms sampling intervals work, while nonstop reads cause Wi‑Fi loss. [#21276821]
  • The automation interface exposes 8 logical devices: 6 for section switching and watering lengths across 3 sections, plus RAIN STOP and measured current. [#21276821]

How do I build a 24V AC garden irrigation controller on ESP8266 Wemos D1 that integrates with home automation through mySensors?

Build it around an ESP8266 Wemos D1 clone powered from 24 V AC, then switch 3 valve outputs and expose them through mySensors. Use an LM2675M-3.3 supply, AQY212 optoMOS relays, an ACS711 current sensor, 3 illuminated buttons, and 2 status LEDs. 1. Convert 24 V AC to 3.3 V DC. 2. Wire three 24 V AC valves through SSR outputs and the rain-sensor path. 3. Publish section switches, runtimes, RAIN STOP, and current over mySensors to the automation controller. [#21276821]

What is the mySensors protocol, and how does it let an ESP8266 irrigation controller talk to Domoticz or Home Assistant?

mySensors is the link layer that lets the ESP8266 present irrigation functions as logical devices to a home-automation hub. "mySensors" is a home-automation communication library that exchanges commands and states between devices and a controller, using a structured device model. In this build, the ESP8266 communicates over TCP/IP on a programmed port such as 5003 and exposes 8 logical devices, plus a RAIN STOP flag and measured current. The thread confirms Domoticz use and states Home Assistant also integrates through mySensors. [#21276821]

Why does frequent analogRead(A0) on ESP8266 cause WiFi dropouts, and how should ACS711 current measurements be timed to avoid disconnects?

Frequent analogRead(A0) can break Wi‑Fi stability because the ESP8266 uses the ADC during Wi‑Fi signal-quality handling. The builder reports that nonstop reading causes signal loss and the module does not recover the connection. Time ACS711 measurements in intervals instead of reading continuously. A 50 ms interval worked reliably in this controller, and the code exits early until the probe timer expires. That gives current feedback without sacrificing the wireless link. [#21276821]

What is an optoMOS relay like the Panasonic AQY212, and why is it used to switch 24V AC irrigation valves with galvanic isolation?

An optoMOS relay like the Panasonic AQY212 is used here to switch 24 V AC valve loads while separating them from the ESP8266 logic. "OptoMOS" is a solid-state relay category that switches loads through an optically isolated input stage, providing galvanic separation and no mechanical contacts. The builder chose AQY212 parts specifically because they isolate the board circuit from the valve circuit. Each relay input also shares the output state with an illuminated front-panel button. [#21276821]

How can I detect a RAIN STOP condition in an irrigation controller using a rain sensor reed switch and an ACS711 current sensor?

Detect RAIN STOP by checking for a valve-open command without matching valve current. The rain sensor uses an NC reed switch that opens the 24 V AC valve circuit during rainfall. The ACS711 measures current in that same valve path and feeds its analog signal to A0. The thread defines the logic clearly: if the solenoid valve is commanded open and no current flows, signal RAIN STOP. That catches the case where automation requests watering but rain hardware blocks power. [#21276821]

Which is better for a DIY irrigation controller: integrating through mySensors into Domoticz or into Home Assistant?

Domoticz is the better-documented choice in this thread, while Home Assistant is only confirmed as compatible through mySensors. The builder actually runs the system in Domoticz and keeps the full watering logic there, including weather-based blocking. Another participant points out that Home Assistant should also work through the mySensors integration, but no detailed setup or validation appears in the discussion. Choose Domoticz if you want the proven path from this project, and Home Assistant if mySensors compatibility is enough. [#21276838]

How should I design the power supply to convert 24V AC for sprinkler valves into 3.3V DC for an ESP8266 using LM2675M-3.3?

Design it as a 24 V AC input stage feeding rectification and an LM2675M-3.3 converter for the ESP8266. The builder used 24 V AC because that is the solenoid-valve supply, then derived the required 3.3 V DC locally. Add a 1 A polymer fuse on the path to the rectifier bridge so excessive current does not reach the converter. Keep the valve circuit separately protected and sized for one active valve at a time. This keeps the low-voltage logic powered from the same irrigation transformer without a second supply. [#21276821]

What fuse values and protection methods make sense in a 24V AC irrigation controller with solenoid valves and an ESP8266?

A practical scheme here uses two 1 A protections and a software limit on simultaneous loads. The first is a 1 A polymer fuse before the rectifier bridge to protect the converter path. The second is a 1 A cylindrical fuse for the solenoid-valve circuit. The builder expects startup current below 0.5 A and operating current around 0.2 A for the valve coil, so 1 A leaves margin for one valve but not for careless multi-valve operation. Software can add a hard block against opening more than one valve. [#21276821]

How do I wire three illuminated manual buttons and status LEDs to an ESP8266 so they can control and indicate active watering zones?

Wire each manual button to an ESP8266 input with a 10 k pull-up to 3.3 V, then short that input to ground when pressed. The builder also adds 100 nF capacitors on the input pins because the button wires can act like antennas and pick up interference. The three illuminated buttons indicate the active zone because the same ESP8266 output that drives each valve relay also lights the matching button LED. Two extra indicators show received commands and RAIN STOP status. [#21276821]

Why store section watering times in the ESP8266 EEPROM, and how does that prevent endless watering when the automation controller connection is lost?

Store watering times in EEPROM so the controller can stop a zone locally even after a network failure. The thread states that section run times are saved inside the ESP8266 and are not lost when the connection to the controller disappears. That protects against a specific failure: the automation hub starts watering, then the link drops, and water could otherwise run endlessly. Local runtime persistence gives the device a minimum safety layer even though the main schedules stay in the home-automation system. [#21276821]

What PCB layout rules should I follow to preserve real galvanic isolation around SSR or optoMOS outputs, including creepage gaps and copper pours?

Keep the isolation gap continuous and avoid copper or tracks under the isolated section. A forum reply warns that apparent separation can become practically nonexistent if you pour ground or route traces beneath the SSR barrier. The comment specifically says no ground should be poured and the insulation gap should run along the entire length of the circuit. That is the thread’s main PCB safety correction to the galvanic-isolation claim around the optoMOS outputs. [#21279684]

How can I safely switch only one 24V AC irrigation valve at a time in software, and why does that matter for fuse sizing and power supply limits?

Enforce a software rule that rejects commands for a second valve while one valve is already active. That matters because the valve circuit is protected by a 1 A fuse, and the builder sized it assuming no more than one valve runs at once. The same post estimates startup current below 0.5 A and operating current around 0.2 A for the solenoid. Limiting outputs in firmware keeps those assumptions true, protects the fuse margin, and reduces overload risk on the 24 V AC supply. [#21276821]

What is the ACS711 Hall-effect current sensor, and how is it used to confirm that an irrigation solenoid valve is actually drawing current?

The ACS711 is the current-feedback device that verifies whether the commanded valve circuit actually carries load current. "ACS711" is a Hall-effect current sensor that measures current flowing through a conductor, while keeping the sensed circuit electrically separate from the analog output stage. In this project, it sits in the solenoid-valve path and sends an analog value to the ESP8266 A0 pin. That reading confirms real valve current and supports RAIN STOP detection when a commanded valve shows no flow. [#21276821]

How does a traditional rain sensor with an NC reed switch interrupt irrigation power, and why might weather-forecast-based automation be a better alternative today?

A traditional rain sensor interrupts watering by opening an NC reed-switch path placed in series with one pole of the 24 V AC valve supply. When rain occurs, the reed switch disconnects the circuit and all active sprinkling stops. The builder says the function still works but would not be chosen again today because home automation already blocks watering when rain is forecast for that day. Forecast-based logic is more flexible because it can prevent a cycle before power is ever applied. [#21276821]

What are the practical differences between replacing a Hunter irrigation controller with a DIY ESP8266 controller versus adding the original Hunter WiFi module?

Replacing the Hunter controller gives tighter integration with the existing home-automation system than adding Hunter’s Wi‑Fi module. The builder says the original controller lacked integration, and buying the vendor Wi‑Fi add-on still left open whether it would meet current system requirements. The DIY unit instead places watering inside the same application used for air conditioning, ventilation, heat pump, blinds, curtains, lighting, water, and cameras. It also adds current sensing, manual illuminated buttons, and a custom mySensors interface. [#21276821]
Generated by the language model.
ADVERTISEMENT