Smart Sprinkler System

@d8adrvn

Great job on the writeup. I started to play with Arduino for the first time thanks to this project and this has been an eye opener.

I have modified your code to modulate the daily time of irrigation according to the Southern California water wise index. The index is updated daily according to the season and the amount of evo-transpiration. I have pasted the code below to get the index below if somebody is interested or feel free to add it as an option.

One thing I had to change to have a more precise control is to change the time command to second from minutes. When doing that, I encountered a strange problem.

When the message sent to the shield was above a certain length (which happened since I was using time in second and 9 zones), the entire thing was hanging. I could still receive message from the shield but I was not able to send any message any more. In addition, some other connected items where not receiving their signal so I suspect that there was something stuck in the hub. The only way to fix it was to restart the hub. Took me a while to figure out what was happening :wink:

For example, sending 'allOn,47,18,47,18,18,18,18,18,12’ using zigbee.smartShield(text: zigbeetext).format() works but sending 'allOn,470,180,470,180,180,180,180,180,120’ breaks the entire thing.

Is this a know issue? Is there a max length of text that can be sent using zigbee.smartShield?

Thanks again for the great project writeup. I am now going to arduino out my house!

def get_daily_watering_index(){
def url = “http://www.mwdh2o.com/RSS/rsswi.xml

def rss = new XmlSlurper().parse(url) 

def watering_index = 100
log.debug rss.channel.title
rss.channel.item.each {
	if (it.title == "Daily Watering Index"){
    	watering_index = it.description.toDouble()
        }
}
log.debug("The daily watering index is ${watering_index}")
return watering_index

}

@mo310,

Thanks for the comments about the project. Great to hear the project went smooth and you are now hooked as a SmartThings Maker Developer!

During the development of this project, I also found there is a maximum message payload size. As you found out, our message length is close to the limit. During development, I initially used a loop to send the commands between the Arduino and the Hub. This resulted in multiple dropped commands. The Arduino is unable to listen if its executing code and the hub does not seem to capture rapid fire commands from the Arduino. Inserting delays between messages created new complications. Concatenating the commands provided the solution to reliably transfer multiple commands at once. However, as you found out, there is a limit to the message length. Mabye @Ben or @urman can comment on the official answer for payload size. There are other recent posts with the same question.

I found your service and code to include water replacement percentage interesting. To add this feature for everyone, we could code the evapotranspiration algorithm and use the weather information from Weather Underground. In essence, build the service in the SmartApp.

@d8adrvn, that sounds like a much bigger project than just using the official published one. Might be overkill for areas that are not as water sensitive as SoCal… Short of this, I would suggest having some type of automatic modulation based on the month of the year. That would already capture most of the benefit of the waterwise index anyway.

On the zigbee message, I am glad that I am not the only one with the issue. Seems to me that there should be some error message when the payload is too long instead of crashing the hub…

the Arduino library caps the message off at 255 characters, but the actual zigbee tx may be lower. I will try to get clearer on this, but unfortunately @doug-st is out for the week. When he gets back he can shed some light.

@rno310
I just setup a test to tx both of those strings and didn’t see any lockups. I tested with fw: 0.11.603 and 1.5.4 for zigbee. I am seeing the 'Received message: ’ printouts in the arduino serial terminal for both of those strings. I have noticed some of them get dropped.

How often do you send those strings? Do you see them printed when connected to the Arduino serial terminal?

@d8adrvn How do we control how often the Arduino reports back to ST (or ST polls the Arduino)?
I have Arduino-ST messages posted every minute in my activity page, not able to see anything else LOL …

@kmugh,

I believe its the poll capability that is the culprit. It initiates the update and then as the device type unpacks the message string, a whole series of event logs are triggered. The simple fix is to go into the device type and comment out (or delete) the line: capability “poll” and the line: capability “refresh”. In reality, neither of these is used or needed. You can still use the refresh tile which triggers the command “update”. Also, the arduino is programmed with a timer method to “check in” with the SmartThings hub every 10 min.

Thanks very much for the info @d8adrvn, will try it out soon.
Edit: The polling/refresh changes did not help. But it looks like it is my mistake, most likely I accidentally changed the Arduino code to report back to ST hub every 1 minute.

Stan,

I have installed this app using relay 8 as my pump controller. I have it testing on my bench and it is running without any issues, Great Project,

Thanks.

How difficult would it be to modify your code to run a timer for a water heater. I envision this to have two or three events scheduled per day for weekdays, and possibly have a second schedule for two to three events per day for weekends…

Jim

Hi Jim,

That’s great to hear you have now added your sprinkler system to your SmartThings platform. Your the first to report back on the pump capability and am glad to hear it works as envisioned.

With respect to using this for a water heater, the code is pretty generic and will work for any device that can be switched by a relay. The relay switches used in the project have limits on the amount of load they can handle and a water heater probably exceeds those limits. So unless you are using some sort of low voltage relay to flip the water heater, you will need to get a more heavy duty switch to handle the current. If you do have a low voltage relay that trips the power on the water heater, you could use the code as is (only use one zone). Create one instance for weekdays and second for weekends.

I think most people are just using an Intermatic Zwave module that can handle the current and directly pair into SmartThings. In this case, you need a multi-timer to turn on and off a switch multiple times a day and either allow different schedules per day or run different instances, one for weekday and one for weekends. I am not aware of a multi-timer smart app but maybe one exists. My sense is that parts of our code would be useful but it would be easier to start from scratch.

Hey everyone. first off thanks for this project, my first stab at something like this. So i got everything setup and all works great. Have one issue, for some reason zone 5 does not click on relay. the smarting shield light goes on but no light on relay. how do i find out what the problem is? if its the relay, things shield, or the aurdino causing the issue? any help or insight would be great. Thanks

To understand what is going on, you will need to use a multimeter and confirm the pin is being activated on the Arduino. You might first start with replacing the jumper wire for that pin.

Thanks replaced the jumper wire and no good. Going to get a multimeter to test it out.

Hey figured it out. It was something wrong with the Aurdrio. So I got a new one and now works awesome!!

On a side note is there any way to hook both the audrino and the relay on the same power cable? Reason why I ask is I have a finished gargage with the 24v cable running in walls. So was hoping I can tie it to the same line somehow so I don’t have the have the 9v cable running on outside of the wall. No problem if I can’t. It’s more for clean look. Thanks.

Glad to hear the project is working! To use the same power supply, I think you would need to add a DC to DC Step Down Converter and have enough current from your sprinkler power supply to run the valve, the arduino and the relay board.

Hi Stan,

I purchased the Intermatic CA3750, which is a Z wave controlled relay capable of 220/240 volts at 30 amps. I am looking for some code that would allow me to run the controller as you mentioned multiple times per day with two instances one for weekdays and one for week ends. I am currently just using the default z-wave switch with multiple on off times, This method works but makes the switch short cut and things area of the mobile app very busy. Plus they all report on when one is active. I am still very green with the code side of things, but I’m learning… My background is on the RF side of electronics…

As for the Sprinkler, I have had it running on my bench for several weeks, I have been changing the run times and the rain hold offs just to see how they are working. Since I am changing my system from an old mechanical pump valve system, it has taken me a while to collect all the hardware needed. We should be installing it this weekend. All has run well with the app, I have had all the valves wired and operating on the bench over the past week. I believe that you have a solid platform. Are you planning to take it commercial?

Jim

hi, i have this situation. i dont know if this is working for me at his moment, nothings is moving or change, i connect all stuff in the area and nothing happend. how do i know is something is wrong with the arduino or the 8 relay module? only have one light on in the 8 relay. thanks

tanahiro, its difficult to help without more information. I would suggest going back through everything step by step. Be sure to “publish” your device type and your smart app, after saving. You should have lit the green led on the arduino and the ThingShield led should be lit blue. I am not sure what relay you are using, however, mine does not normally have a lit led, only when its activated.

now is working. the only thing that i missed was to load the ArduinoSmartShieldIrrigationController.ino in the arduino. after i did that the blue lights comes on. And now im happy.

@d8adrvn-

Thanks for the tip on this thread and impressive work by you and @mattn.
I’m a fairly recent SmartThings convert and am pumped to set this up. I’m staging my Amazon cart to order parts but question - I have 12 zones. I’m looking at getting the SainSmart 16 channel relay (my wife also wants me to put misters on the back patio, so I could totally use the extra channels and hook up some more valves for a misting system to use on those hot summer nights!). Have you guys experimented with >8 zones? Any watch outs, and will the Arduino Uno still suffice for a 16 channel relay? (sorry - new to the arduino).

Thanks and look forward to bugging you with more questions! :smile: