SmartThings Community

ESP8266 Smart Sprinkler System


(Xm381) #105

I didn’t change the ino file and mines been running happily for weeks!

I’ve used the Adafruit Feather HUZZAH ESP8266 on a number of projects and they’ve been trouble free (Adafruit makes good stuff), but that doesn’t mean that you couldn’t have received a bad one.


Sounds like you’re getting it programmed ok and SmartThings can find it, but looses it every 48 hours or so, right?

Once the SmartThings hub finds the ESP8266, via it’s IP address, the IP address of the ESP8266 can’t change or the hub will loose track of it.

My first guess is that the IP address for your ESP8266 is changing because it’s “DHCP reservation” is expiring.

Have you programmed the ESP8266 with a static IP (have to change the ino), or better yet, reserved it’s IP address on your router (which most likely acts as the DHCP server that assigns dynamic IP addresses on your local network)?

(Ghassanjankeel) #106

Yes, all works good until the hub loses the connection with the board, and the board is still accessible using the IP address on a browser. every now and then and I need to keep checking on it every day, and that’s defeating the purpose of the automation.
my board is linknode R8, and the router is reserving the IPs for the hub and the board.
I have other devices that are based on esp8266 like the sonoffs im using all around the house and they don’t have the same problem.

Since the board is not losing the connection to the router, then it shouldn’t be the board right?
And since the hub doesn’t show the same problem with other WiFi connected devices, then it shouldn’t be the hub either.
And finally since nobody else has this problem, then it shouldn’t be the ino or device handler as well.

I also tried different router and tried adding WiFi repeater close to the board with dedicated SSID, still the same problem.

My best bet would be probably to program the board with static IP even though its reserved in the router. what part of the ino I need to change in order to make it always ask and report the same IP?

(Marcus Hamaker) #107

Sorry I didn’t get back to this sooner! Work travel, weekend plans, family obligations and POOF! 14 days go by!
I have been running this version for about 2 weeks and it’s working great. The odd/even is working very well which makes be feel safer with the watering schedule police (neighbours).

(Ghassanjankeel) #108

Ok, I feel that I’m getting close to the real bug thats causing the ip
having the router assign IP and/or changing the ino sketch so the linknode R8 would have static IP both didn’t help.
Next I added a line in the device handler that sends a notification every time it receives update from the board, which is suppose to happen every 10 min. according to this line in the sketch:
t.every(10 * 60L * 1000L, timeToUpdate); //send update to smartThings hub every 10 min

After rebooting the board, I started getting these notifications every 10 min as scheduled, and when the irrigation schedule kicks in I get status update every time a zones starts and ends, and once the irrigation schedule ends, I started getting these notifications every 32 min instead of 10 min and eventually they stop, and then after few hours the ip changes to even though the board still connected to the same IP and can be accessed via web interface.

I don’t know whats causing the update schedule to stop updating every 10 min, can anybody shine some light here on whats going on?

(Ghassanjankeel) #109

In case someone else is having the same issue with the IP changing to it was simply because I was compiling the sketch with 2.4.0 version of the esp8266 in arduino ide
The problem disappeared when changed the version to 2.3.0

(Javier Perez) #110

I was wondering if possible to add more zones (e.g., 10 or 12 zones)?

(Dan) #111

The ESP8266 does not have that many GPIO pins.

(Ghassanjankeel) #112

It depends on what ESP8266 you are using, if its a linknode R8, then no it has max of 8, otherwise if you are using something like Nodemcu as an example then yeah you can use all the GPIOs available, you will need to make some changes in the sketch (change relays=8 to 12, map the GPIO pins to relay[9] … all the way to relay[12], etc.) and then edit your device handler.

(Dan) #113

That’s my point… A NodeMCU ESP8266 board is hard pressed to use more than 8 or 9 GPIO pins as digital outputs… At least I have never been able to use more than that reliably.

Here is what I found during my testing. Granted, I was not willing to give up the use of Serial Rx and Tx…

(Ghassanjankeel) #114

Thanks Dan, thats good to know, as I used every PIN that has the word GPIO in front of it in this pin layout:

I’ve been having problems and I thought its because the additions I made to the code. I’ll change the pins around and see if it will work better

(Javier Perez) #115

Noob question, I need to install a relay board between my sprinklers TRIACS and the ESP8266 or I can connect directly.

(Ghassanjankeel) #116

Sprinklers valves are typically 24V ac, ESP8266 would provide 3.3 - 5 volts, so yes you need relay(s) board and the 24 volt AC transformer. the easiest way will be using Linknode R4 (4 relays) or linknode R8 (8 relays) as the relays are attached to the ESP8266.

I know this is not the place to mention this, but if smart sprinklers is all what you need, and you live in SoCal, then take a look at this: (You can get $80 rebate from your water district and it becomes free)

( #117

I have a problem that where i live we have frequent power interruptions.
This seem to cause my linknodeR4 to go into initial startup mode.
And i have to manually reset the the device

My linknode IP is static should it not be possible to modify code so if
it does not respond send a reset command before giving up

Any ideas how this can be done ?

(yagoa) #118

awesome, how did you solve this error?
‘StaticJsonBuffer’ was not declared in this scope


To be honest I don’t remember exactly what I did to get rid of the error. I want to say that I change to Audrino 1.8.4 but that is a guestimate at best

(Ocelotl) #120

Hello, I flashed the bin file to a NodeMCU 1.3 but the relays don’t activate. at least 5 seem to be active when I plug the NodeMCU.

I tried looking in the .ino file to change the relays to LOW but I can’t get it to compile. I already went looking for missing libraries but each time some new library error pops up. I also can’t find where to change the pins, I looked everywhere in the ino file but couldn’t find it.

Does anyone have a compiled 8 zone bin for NodeMCU to share? and if you do which pins are you using for the relays?


edit: I found where the pins for the relays are defined in the 8 channel. They are at line 283. I still can’t compile it, something about the WiFiManager

edit: I finally got it to compile. I had to install a lower version of WifiManager. The Arduino Json also needed to be a lower version for the JSON compiling issues.

(phil) #121

I just want to say that I have used this tool since it was release and although there have been a few MINOR issues it has worked perfectly

(Ghassanjankeel) #122

I combined the code from this project and some other projects and added my own code to make Nodemcu control 8 relays for my Pool equipment (not using it for irrigation) , but as far as for the pins this is what I used:

 //set up relays
  if (!isActiveHigh) {

  int i=1;
  while (i<relays+1) {
//relay[i]= 13-i;
pinMode(relay[i], OUTPUT); 
digitalWrite(relay[i], relayOff);
if (isDebugEnabled) {
  Serial.print("Turning off Relay ");

I didn’t use pin 5 for the relays, as I’m using it as input button to turn Pool light ON manually.

(Toddly148) #123

I don’t know if anyone is still looking for the LinkNode R8, I got mine from Mouser Electronics (
FYI: it does not come with a power supply and you also need to get a TTL UART to USB cable. Me being a noob, did not know this. So I got the board, then had to wait for the power supply that I then had to order, then I had to wait again for the TTL UART to USB cable. But, it was all worth the wait, works like a charm!

(Ricky) #124

I’m having trouble with the github integration for this project. using Owner: anienhuis, Name: smart_sprinkler, Branch: master but whenever I click update from Repo nothing shows up under New (only in Github)

Can someone please help? Am I using the wrong credentials?