WiFi Lawn/Garden Sprinkler Controller (ESP8266)

An eight zone Wifi accessible, sprinkler valve controller based on an esp8266.

Similar projects worth following
This project uses Arduino/ESP8266 to create a web based lawn/garden
sprinkler controller. It works in AP or STA modes. If you use the RTC option no internet is needed. Or you can set the time manually. You can control each relay manually, or through a schedule. Everything is configured through web pages served directly from the esp8266. It will require an ESP8266 with 4Mbyte of flash. I'm using an ESP12. A NodeMCU-devkit will work too

- Web server based (ESP8266WebServer)
- Responsive UI (desktop/mobile/tablet) written around Jquery,
Foundation5, and jsoneditor
- 8 Zones (relays)
- Up to 30 Schedules
- NTP Time (or set from browser)
- RTC Option pcf8563 or ds1307
- OLED Display Option
- ArduinoOTA update (code and spiffs)
- HTTP Server Update (code and spiffs)

The code resides on GitHub

This project uses an ESP8266 to control 8 relays to provide 24vac to operate a sprinkler control valves. It is a self contained web server, serving all the pages needed for configuration, status, and scheduling of up to 8 sprinkler zones for up to 30 schedules.

This project has been newly updated.. an OLED and a RTC added since the original project.

The code is held on GitHub and that is my preferred method for taking bug reports and feature requests (through the Issue system).

  • 1 × ESP8266 4MByte (I'm using an WeMos D1-MINI)
  • 1 × 74HC595 Electronic Components / Misc. Electronic Components
  • 8 × 2n3904 or 2n2222 NPN transisitors Drive the relays
  • 8 × 10k Resistor
  • 8 × Relays

View all 9 components

View project log

  • 1
    Step 1
    This project requires DIY assembly and soldering skills. At this time there

    is no pre-made board. I've made two of these systems so far, and both of them
    are done with proto boards and point to point wiring and assembled in a
    water resistant project box.

  • 2
    Step 2

    General Hardware Description

    An ESP8266 with 4MB (32Mb) of flash is required. The software makes extensive

    use of the flash storage for both OTA updates and spiffs. Generally this is
    an ESP-12x, but other models may be used. In my case I used a WeMos D1 Mini
    as the ESP8266 board. I had some in the junk box and it has the 3.3v
    regulator, and the usb to serial interface built on board. It also includes
    a nodemcu type reset and programming circuit.

    The 8 relays are controlled through a 74HC595 8 bit shift register. This is
    simply wired to the SPI interface of the ESP8266 (CS (GPIO15), CLK (GPIO14),
    MOSI (GPIO13) connected to Latch, Clock and Data In of the 74HC595).

    The shift register outputs are then connected via resistors (10k or so) to the
    8 NPN transistors acting as relay drivers. In my particular case I had some
    quad transistors in a 14 pin dip package in my junk box.

    These transistors then drive 8 mini 5v relays. The relay contacts connect
    24vac to the corresponding output, and therefore energize a sprinkler solenoid.

    A 24vac center tapped transformer powers it all. One leg of the transformer
    output is ground for the circuit, the other side is routed to the relays to
    control the solenoids. The center tap is rectified through a single diode
    to feed the input of a buck type dc-dc switch mode converter. The output
    of the convert is set to 5v and is routed to the relays and to the D1 Mini.

    The ST1306 OLED is an I2C device and therefore connected to SCL (GPIO5)
    and SDA (GPIO4) of the ESP8266.

    For the optional real time clock (pcf8563 or ds1307), I rigged that up on a
    proto board stacked on the D1 Mini using stacking pins.

    The following schematic can be used as a guide. A Fritzing file is also
    included. It is also just a guide. Again DIY assembly and soldering skills
    are required to complete this project.

View all 5 instructions

Enjoy this project?



Sander wrote 08/29/2018 at 06:54 point

Hello, i have a problem the Wemos is not connecting to the existing SSID. It stops at Try: SSID and then reboots and try again.

Part of the logging:

FS File: /sched-schema.json.gz, size: 600B

config file: /config.json not found
sched file: /sched.json not found
set relays=00
going to STA mode Bundy
HTTP server started
nP⸮M%⸮⸮w⸮@⸮~⸮Q* ⸮G⸮
⸮5⸮⸮⸮⸮A*% )D⸮@⸮⸮@ ⸮Nz ⸮غNP9⸮)I⸮A⸮D⸮Ԛ⸮⸮

  Are you sure? yes | no

luma wrote 07/27/2017 at 23:07 point

Have you taken a look at the LinkNode R8 board?  They're available in the US for under $15 and have an ESP8266 + 8 relays all mounted and ready-to-go.  There's no RTC or OLED, but it also requires no soldering and they have 3D printed case plans available for download.  It looks like it'd be an easy and inexpensive platform for this project.

  Are you sure? yes | no

pubdc wrote 03/11/2016 at 14:30 point

Looks very promising, especially the screenshot of the scheduler is impressive. But I am fairly new to ESP8266 (done some basic hello world blinks and webserver to control led/relay from my smartphone), and daunted by all the files in the github. Could you provide some guidance on how I should set this up ?

Also, is the 74HC595 shift register a requirement ? I was planning on just using my ESP12E pins directly controlling solid-state-relays. They are 5V logic but seem to respond just fine to the 3.3V digital out from the ESP8266.

Many kind greetings, Peter

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates