SmartThings Community

ESP8266 Smart Sprinkler System

smartapp_irrigation
dth_irrigation
requires_server
project_yard

(Aaron Nienhuis) #1

Do you want a Smart Sprinkler controller that is integrated with SmartThings but won’t break the bank? Are you looking for a DIY Smart Sprinkler that doesn’t require an Arduino and SmartThings Shield? If so, this may be what you’re looking for.

I’ve created an ESP8266 based Smart Sprinkler based on the Smart Sprinkler project written by Stan Dotson and Matthew Nichols. Rather than using an Arduino with a SmartThings Shield, the ESP8266 is WIFI capable and communicates directly to your SmartThings hub over the local LAN.

The entire project is on github and consists of two SmartApps, two Device Types, and the firmware source and binaries for the ESP8266 microprocessor. Additional details and high level instructions are in the Readme.

Project highlights include:

  • A SmartApp that discovers Smart Sprinkler controllers on your network using SSDP
  • SmartThings scheduler to run your sprinklers based on day of the week, time, and even current weather
  • Over-the-air (OTA) updates of controller firmware
  • Directly control your sprinklers from your phone or even Amazon Echo
  • Option to directly control a manual relay or pump

ESP8266 Hardware Options
There are a large variety of ESP8266 based options including prefabricated boards with relays that can be used for Sprinkler Controllers. I’m using the LinkNode R4 and LinkNode R8. They can both be found on Amazon for around $15USD. They even have files available for 3D printing enclosures.

Note
I am not a professional developer and haven’t coded in many years. The code I’ve come up with is a result of a lot of copy/paste and trial and error. It’s not pretty, but it’s been keeping my lawn green for a couple weeks now. Feel free to try out the project and send me your questions, comments, and suggestions.


Smart Sprinkler System
Raspberry Pi with PHP (or Arduino/ESP8266/NodeMCU) to GPIO to Relay to Gate/Garage Trigger
Irrigation Valve? (Not Zwave)
(Charles) #2

Aaron- This is great! I’m contentedly running the Arduino/Shield version but am wary of the day when the Shield goss belly-up. I’ll be ready to jump when that inevitable day comes. Thank you for doing this.


#3

This looks awesome. I ripped out my insteon which control my sprinkles. I don’t have the money to one of those off the self. This looks great


#4

Looks good! But both the links are broken, can update again?

May I know what is the actual sprinkler being used, need for reference

Thanks


(Aaron Nienhuis) #5

@CSC Links should be fixed now. I’m not sure I understand your question about which sprinkler is being used. This controller should work with any standard 24V sprinkler valve if wired properly.


#6

Thanks.

I never own a sprinkler so I’m looking for recommendation on the brand and model of sprinkler. I would like to try the project but not sure which sprinkler to get


(Aaron Nienhuis) #7

This project is typically used for underground sprinkling. Often these systems are professionally installed, but you can DIY also. Most of the parts are available at stores like Lowes or Home Depot (in the USA). The part that is actually actuated by the Smart Sprinkler Controller is the valve. (Example) These valves are usually connected by some sort of hose or pipe to your water supply and then connected to an inground sprinkler.


#8

Posting to confirm that I’ve successfully deployed your code to a R4 and an R8 board and am able to control the 4/8 relays with the SmartApp. Great work!


(TreborJM87) #9

Aaron,

This works great!!!

Thanks for the effort.

Rob


(Tom) #10

Hi Aaron, this project looks great, I’ve ordered a LinkNode R8! $14.85 on amazon is a great price!

I’ve done some work integrating an esp8266 with smartthings and initially ran into some stability issues with the esp8266 freezing and needing a physical power cycle. My biggest concern would be leaving a sprinkler turned on. It looks like last git commit was May 21st, has the sprinkler system been stable for you since then?


(Aaron Nienhuis) #11

The sprinkler system has been very stable since I set it up a month ago. The one exception is the weather integration. It seems that the SmartThings getWeatherFeature call doesn’t always work. Still more debugging on that…

There are quite a few safety features built into the setup to prevent leaving a sprinkler zone turned on (or turning multiple on at the same time). SmartThings will tell the sprinkler controller which zones to turn on and for how long. However, the timing for running the zone is done on the controller itself. That way, if the hub loses connectivity to the Internet or the sprinkler controller the sprinklers don’t just stay running. In the event of a power failure or a reboot of the controller during sprinkling the relays will automatically reset to their normally open state - thus closing the sprinkler valve.

One other really important note on using the LinkNode R8. You must flash the firmware the first time using DIO instead of QIO! Unfortunately, the R8 documentation is incorrect. If you flash using QIO, any IO call to the 8th relay will cause a reboot.


(Tom) #12

I received my LinkNode R8 on Saturday and it’s now running my 7 zone sprinklers! Install was easy once I found my FTDI cable. Seems nice and responsive through the smartthings app. Thanks for sharing!


#13

installed this in a nodemcu V3, i waited few days just to see if everything is working and it’s working great

thank you very much @anienhuis, amazing work :+1:


(Nick) #14

Hi thgood. I bought the linknode r8 and followed all the steps, but for some weird reason although ST can see the Linknode i cannot control the relays. It looks like the buttons are dead. When i boot the linknode the relays seem to be working through the boot but i cannot control them from ST. Any ideas?

Thanks!


(Mark Kaplan) #15

Aaron,

This app works great. Based on the work you did, is there an easy method to tie a virtual switch to the LinkNode relay so I can use it to control pool motor, etc…

Best


(Aaron Nienhuis) #16

@kakektypo Sorry I missed your question while I was taking some vacation. Were you able to get the linknode to work? If you can detect the Linknode and add it as a device I would expect it to work. If it is still not working, I can walk you through some additional troubleshooting steps.


(Aaron Nienhuis) #17

I have not added the functionality to create individual virtual switches that apply to the individual relays. It wouldn’t be too hard to add though. I’ve thought about doing it so I could control individual sprinkler zones using Alexa.

For my pool pump, I’m using a GoControl FS20Z-1. The relays on the LinkNode aren’t rated high enough to control my pool pump directly. However, I did create a custom device handler and smartapp based on the irrigation controller that allow me to schedule the pump, but also give me the overrides to run the pump continuously, skip a schedule, etc. I haven’t published those yet. Let me know if you’re interested.


#18

I wanted to see if the problems you mentioned with weather report integration have been resolved.


(Aaron Nienhuis) #19

I still see the issues occasionally. I don’t think the issue is with my SmartApp though. The issue is with the SmartThings getWeatherFeature function. It uses an API to Weather Underground and Weather Underground limits the number of API calls that can be made in a period of time without a subscription. Occasionally, the getWeatherFeature errors out saying it has exceeded the connection limit. I’ve worked around it most of the time by setting my timers to start at odd times like 10:07 rather than 10:00. There seems to be a lot more people calling the getWeatherFeature on the hour.


#20

Just ordered the LinkNode R8. I am hoping that things will work smoothly to get me up and sprinkling when it comes :slight_smile: