[OBSOLETE] Smart Sprinkler System

i will let you know on friday

@mckenph, @Dan999,

Ok, I learn something new everyday. Sure enough, my system is now linked to a specific weather station. Thanks for discovering and documenting this feature. I will add to the README with next update.
Cheers.

As usual work and life got in the way and im in trouble for not having the sprinklers done. Made quite a bit of progress today though.

I wrote the code for the Particle Photon from scratch because i plan to use as multiple devices. I have the link to the smarthings device working, the only thing i need is to implement the pump capability. I currently do not have the controller controlling any pins at the moment (just comments to remind me to add it), however those interfaces are trivial using an SPI IO expander with the relays.

The device handler is a modified version of v2.67 made to interface with the particle photon code i have. I renamed many of the tile names to use numbers in the name rather than words to easily use a quick and dirty python script to create any number of zones I want.

The device handler and the photon are talking to each other nicely. Only really modified how the device handler talks to the physical controller. I believe it should still work with the smartapp without issue (Have not tested it yet though).

Current Issue:
Updating the Start button to go to the ON state. Not sure whether this a delay in my updates from the photon or something else.

@aacordon,

Sounds like you are making good progress. With respect to the Start button, it requires a round trip before it updates. We coded it so that the device would have to receive and process the Start command before sending back a confirmation. Depending on the responsiveness of the hub, the can take a few secs. The advantage is you know the system actually started. Also, I am adding some code to the Smart App that will triple check that the system started and then warn you.

Edit: I did some browsing on the Photon and the SPI IO expander. Very cool. I canā€™t wait to see your first working version!!!

Woohoo solved the issue with the start. It was just a typo.

I am in the process of replacing as much of the device handler code that is hard coded to the individual zone with for loops to iterate through zone objects to hopefully define the number of zones with a single variable. Some examples of changes are as follows.

//Timer Entry
for (int i=1;i<nZones+1;i++)
{
 	input("Timer_${i}", "text", title: "Zone ${i}", description: "Zone ${i} Time", required: false)
}

---------------------------------------------------------------------------------------------------
//Create Zone Tiles and Apply Names (Change names to an input later)
def zoneNames = ["Front\nLawn","Front\nDrip","Rear\nLawn","Rear\nDrip1","Rear\nDrip2","Rear\nDrip3","Front\nVerge","None"]

for (int i=1;i<nZones+1;i++)
	standardTile("zone_${i}_Tile", "device.zone_${i}", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true)
	{
		state "off${i}", label: "${zoneNames[i-1]}", action: "RelayOn${i}", icon: "st.Outdoor.outdoor12", backgroundColor: "#ffffff",nextState: "sending${i}"
		state "sending${i}", label: "sending", action: "RelayOff${i}", icon: "st.Health & Wellness.health7", backgroundColor: "#cccccc"
		state "q${i}", label: "${zoneNames[i-1]}", action: "RelayOff${i}",icon: "st.Outdoor.outdoor12", backgroundColor: "#c0a353", nextState: "sending${i}"
		state "on${i}", label: "${zoneNames[i-1]}", action: "RelayOff${i}",icon: "st.Outdoor.outdoor12", backgroundColor: "#53a7c0", nextState: "sending${i}"
		state "sendingOff${i}", label: "sending", action: "RelayOff${i}", icon: "st.Health & Wellness.health7", backgroundColor: "#cccccc"
	}
---------------------------------------------------------------------------------------------------
def detailList = ["allZonesTile"]

for (int i=1;i<nZones+1;i++)
	detailList.push("zone_${i}_Tile")
	
detailList.addAll(["pumpTile","scheduleEffect","refreshTile","signalStrength"])
details(detailList)
---------------------------------------------------------------------------------------------------
//Check if any zones are on
int anyZoneOn() {
	int fl = 0;
	for (int i=1;i<nZones+1;i++)
	{
		if(device.currentValue("zone_${i}").contains('on')) fl=1;
		if(device.currentValue("zone_${i}").contains('q')) fl=1;
	}
	 return fl
}

I just need to figure out how to handle the parsing section, and the RelayOnX, RelayOffX, RelayOnForX, or just leave as is.

So far the changes have been working.

As for the IO expander, I plan on using an MCP23s17 to control the 8 relay modules and an 8 or 16 high side driver setup i made for my grad project to control my low voltage lighting with PWM (if pwm doesnt kill the lamps). Still need to do the math to see if the timing is feasible for that part.

Also the following are what it being used to talk to the Photon. Used examples from the blinds ST project as a starting point:

input("deviceId", "text", title: "Device ID")
input("token", "text", title: "Access Token")

----------------------------------------------------------------------------------------------------------------------------

//Command and Reponse Functions
private cmdRelay(msg) {
	//Spark Core API Call
	httpPost(
		uri: "https://api.spark.io/v1/devices/${deviceId}/setCmd",
		body: [access_token: token, command: msg],
	) {response -> log.debug (response.data)}
}

//Get status response and parse
private getResp(String sparkVar) {
	//Spark Core API Call
	def readingClosure = { response ->
		log.debug "Reading request was successful, $response.data.result"
		str_parse(response.data.result)
	}
	httpGet("https://api.spark.io/v1/devices/${deviceId}/${sparkVar}?access_token=${token}", readingClosure)  
}

// Generic to get variable value
private getVar(String device_name,String sparkVar) {
	//Spark Core API Call
	def readingClosure = { response ->
		log.debug "Reading request was successful, $response.data.result"
		sendEvent(name: device_name, value: response.data.result)
	}
	httpGet("https://api.spark.io/v1/devices/${deviceId}/${sparkVar}?access_token=${token}", readingClosure)

Although system is running fine, just all the logging is killing me, I cant wait for the updates.

Anyone have time to help out? Iā€™ve been reading through all of this and have managed to get to the point of trying to fire the sprinklers, but I think the master valve is stopping meā€¦hereā€™s what Iā€™ve got:

7 zone system with a rainbird SST hooked to it. they were wired as follows:

1 Common
1 Master Valve
Zones 1-7

Problem is, I canā€™t tell if the common is coming from the master valve or if itā€™s just tied up in the system somewhere, I took a power supply from an old sprinkler controller, have one end going to the first relay that is daisy chained in the instructions, and then the other is hooked in with the ā€œcommonā€ wire. Finally I have master valve in the 8 relay as mentioned with other posts. For some reason I canā€™t get the pump/valve to open up when all is powered up.

Is there something I need to do on the IDE programming to tell it zone 8 is holding the master valve?

Thanks guys

@Billb1981 Do you have a multimeter at home? IF yes set it to 0-100 V AC or 200 V AC setting. Please do the following:

Step-1 : one lead of the multimeter at common where all the wires are tied together and one at the side of the relay that are daisy chained together, Do you read a AC voltage? If yes what is it?

Step-2: Proceed if you see AC voltage in the step above that is in between 24-36 VAC.

  • next you fire a zone (master or a valve) using the app? Please check the AC voltage between the common and the other side of the relay, you need to know what relay is being triggered. Do you see the AC voltage? If yes what is it?

Please respond and I will try to help you through rest.

Thanks for the responseā€¦actually in the middle of working with Stan, I had to add times to the zones, but as of now only the master valve opens and the first zone worksā€¦canā€™t get 2-7 to go yet

oh great !!! so your power supply is fine ā€¦ Did you try to measure voltages at relays 2-7 and see if there is voltage at second side of the relay when you toggle these relays. One of the things you might want to check that the wires that are terminating at common are tightly secured with the common terminalā€¦ Also check the daisy chain on the terminals 2-7 is connected with the relay 1 or master valve.

1 Like

Iā€™ll give that a whirlā€¦I know the power has to be going from 1-8 if 8 is acting as the master valve wouldnā€™t it be getting power as it is opening first allowing zone 1 to work

Let us elimate that possibility. You should double check all wires are connected to common and that you can measure AC ~ 24V at all points of the relay with respect to common

Checked this out, was able to get current on all of them, just zone 1 and zone 8 that fire, zone 8 will fire with the others, but the valves donā€™t open, I moved another wire over from zone 3 and tried it on zone 1 relay and it fired.

OK, Iā€™m not really sure what I am doing wrong. I have installed the device handler and the app and I have changed the device type of the shield but when I go into the thingshield device I see all the zones but when I press on any zone it just says sending then turns back to white. I have written a relay testing app and the relays work fine. The thingshield is blue and I see it sending commands to the board thought the serial monitor. I just can not figure out why it is not tripping the relay or changing colors when I press the zoneā€¦

@WestOCGreg,
Have you entered time for each of the zones you wish to activate? If not, go to the sprocket in the top right of the device handler screen on your smart phone. Usually thatā€™s the issue. Let me know.

Thank You, that was it. Been working on this for 3 days. Thanks again !!!

Help. So on Wednesday my controller stopped working. The little blue icon is stuck on Starting programming and I am not getting the many logging messages that I use to get. I get nothing in the logging except for when it is time to start it states that it is starting and nothing happens. I tried to running a zone manually and nothing. I hear no clicking on the relay when I pick a zone. I did notice that this morning that when i looked in the new devices the Arduino card was there. Not ure what happen but it has been running flawlessly until I think Wednesdayā€¦

i figured it out. Not sure why my Ardunio card just disappeared and need to be rediscovered. Wondering if it had to do with all the other things that have been going on with ST. Basically reset up everything again. Also wondering if you are going to come up with any updates. I know you were talking about stopping the many logging entries.

@mckenph,

thanks for sharing your experience. I have had a similar experience with some of my zigbee LED bulbs but not yet with any of my maker projects. Glad you have it back up and working.

I am glad you asked about updates. I have working code for updates to both the Smart App and the Device Handler for the 8 Zone system. Iā€™ll save the details for the release notes, however, the update greatly improves the handling and logging of events, checks to be sure a watering event actually triggers (it would have alerted you that your Arduino was not responsive!) and enables schedules to trigger based on temperature.

Now that its working, I just need to clean up the code, transfer to the 16 and 24 zone code bases, and update the README files to reflect the changes. I also want to include the 3D printing solution from @BD0G into the README. And finally, I plan to update the screen shots since the SmartThings environment has changed quite a bit. My plan is to have it all posted to github by this weekend.

1 Like

I canā€™t wait! This is already my favorite St appā€¦ And you are going to make it better? Great