[OBSOLETE] Smart Sprinkler System

I am new to Arduino but pretty good with ST. Been trying to set this Irrigation controller for some time now.

My question is what does this mean in the readme file instructions.

“SoftwareSerial library was default library provided with Arduino IDE”

Do I need to do something with this? is it automatic? I am confused

Any help would be appreciated

Looking forward to the update!

@billcat Essentially from my understanding of what this statement means “SoftwareSerial library was default library provided with Arduino IDE”

When the code (project) that is provided via the GitHub resources was developed by Stan @d8adrvn and Matt the part of the code that is used to communicate on the serial port was the one that is available right from the Arduino Developer resources and is installed by default on the various Arduino boards.

I think it was a way of saying that no changes were made to the standard code that is tried and true for communicating data to and fro on the Hardware Serial port of the Arduino boards. This generic default serial port code is included in the code that is upon the GitHub resource. So when one downloads that code they “get” the Serial Port Standard / Generic code as well cause it works as intended with this project.

If this is incorrect I am sure someone will pipe in for additional clarification.

You do not have to do anything special to obtain and use.

Thanks for the upcoming mention in the README file for the SmartSprinklers @d8adrvn.

My SmartSprinklers are working stellar! Now that the warmer weather is upon us I have been able to really exercise the run times and cycles of the sprinklers.

My 3 D printed enclosure for the Smart Sprinklers and Sain Smart 8 channel relays really cleaned up and simplified my install.

Its so useful to be driving on the road hundreds of miles away from home and be able to just fire off a cycle of sprinkler station irrigation!

Its all I need in an automated sprinkler system Simple is BEST!
Different Soil type settings - BAH!
Hills / Incline settings - Snake Oil !
Soil Sensors to determine how wet the ground is - Come ON!

Next they will have animated My Little Pony graphics on the LED screen of the “New and Improved” Ranchio that show little pee drops spraying everywhere from the Ponies undercarriage when the sprinklers are running.

Some things that I discovered along the way.

No the project sketch (code) will not fit on the Arduino Diecimila. I had a few of this variant of Arduino laying around looking for a great project and tried to load the code. Nope! Too large for the Arduino Diecimila’s small 16 KB of Flash memory.

Perhaps add that to the README ? (shrugs)

I also discovered that if one does not click on the gear icon in the upper right ? and add some time entries then the system thinks you would like to water for zero minutes and does nothing. This had me stumped when I first tested out the system. This point should be OVER emphasized in all documentation - READ ME , etc.

I look forward to many seasons of trouble free operation.

Bonus for me is that I was able to wire one of the stations to a valve that is within the same sprinkler box in my yard and then plumb hardline 1 inch PVC pipe under my eaves from that sprinkler valve all the way over to my outdoor deck. I stepped it down from 1 inch PVC to mister lines and ran a series of misters for the deck that are hidden from view tacked up to the underside of the upper deck / pergola boards. Now I can set a temperature variable within the RULEMACHINE SmartApp that is compared to my Personal Weather Station Temperature and fire off my misters based on the actual ambient air temperature being reported . Then turn them off when the ambient air reduces to a setpoint.

@BD0G

Bruce

Thanks for the reply, I was totally confused being new to Arduino. I will continue with the read-me file exactly as it reads. I had one attempt of setting the irrigation controller and cannot figure out why it faulted on me, I figured it had something to do with a missing step regarding the softwareserials. It must be something else. I purchased two Arduino Unos so I will attempt one more time with a new virgin Arduino board. Thanks again

Update to using Particle Photon in place of arduino/smartshield:

I currently have the controller working as a device with feedback from the particle photon. Have yet to test the device handler with the scheduling app.

I personally have 7 valves, and left the final relay for the pump for testing purposes.

An mcp23s17 IO expander is being used to drive the relays in order to minimize io usage on the photon, increase io potential and eventually reduce the amount of wiring.

The Smart Sprinkler device handler was extensively modified to reduce the amount of code, and to support a comms schema with the particle photon. Also added a tile to show the wifi signal strength of the photon.


I eventually plan to use the photon as multiple devices in one. Adding support to control the landscaping lights.

1 Like

First of all thanks to @d8adrvn, It is amazing that someone would go thru all this trouble and share their awesome work with all of us. I will start by saying that I am a long time ST user but a newbie when it comes to the Arduino. That said I had a horrible time getting this smart irrigation system up and running partly because the readme file specified actions that are different, perhaps newer because of newer versions of the Arduino software and also because it mentions things in general terms and being the first time on Arduino anything made it a little confusing to me. So I don’t even know if I am out of place or not but I figured I post some of my experience and hopefully it help another newbie like me.

This is not a step by step, just a list of things that confused me and how I dealt with them.

FYI- I setup the 8 zone version - based on the Readme.md file.

Steps 1 – 4, are perfect no issues with the hardware. Note: In “power supplies” I ended up using a 12v power supply for the Arduino Uno my understanding is that it works fine with 9-12v and even up to 20v but that is not recommended. Someone correct if wrong.

Step 5 – “Arduino Code”

From the developers link https://github.com/d8adrvn/smart_sprinkler.git I just downloaded the zip file by clicking on the Download Zip link near the top right. Once downloaded extract the file if it did not do it automatically. Now this file contains the code for all versions 8,16 and 24 zones. You will just go to the corresponding folder to get the correct code for your project.

Note that the readme file states that the ino file is called (ArduinoSmartShieldIrrigationController.ino) it is not, when you download the zip file it is named differently, In my case it was (Arduino_8_Zone_Irrigation_Contoller.ino).
This is the file that you will load onto the Arduino using the Arduino IDE.

The zip file also contained the file Device_Type_8_Zone_Irrigation_Controller.groovy this file is used to assign the device type using the ST IDE, and in the root of the zip file is IrrigationSchedulerApp.groovy this file is used to setup the scheduler app on your Smartphone via the ST IDE.

The Arduino IDE Software

Ok now head on over to http://www.arduino.cc/en/main/software and download the Arduino IDE Software. My version was 1.6.8 and install it. Open the software. You will notice that it automatically names your sketch, mine was “sketch_apr27a” that is fine it’s just an automatic name based on your computer date.

Erase any code that automatically comes up on the window, you do not need it for this.

The Libraries

Here is where I got confused because the Arduino IDE software says it can load libraries from zip files and in addition the readme file does not Specify to extract the library zip files or leave them zipped. Maybe because some computers automatically do this. I ended up extracting all my files. It turns out that the Arduino IDE Software will accept a folder or a zip file when loading libraries.

Ok back to libraries, you need to get this https://github.com/JChristensen/Timer, just click on download zip as before. Now the readme file says “Timer library release downloads with the name: “Timer-master-2”. Before loading into the Arduino IDE, change the name to: “Timer” This is incorrect the file downloads as “Timer-Master.zip” , just go ahead and rename the zip file to “Timer.zip” and extract it. Now go into the extracted folder and rename the folder ”Timer-Master” to “Timer”. It is this folder that you will use to upload the Timer.cpp to the Arduino Libraries, you must upload the entire folder as it also uses Event.cpp.

Now go to http://cl.ly/ZMHh and download The St Shield library. Extract it , this will give you a folder structure of
Shield Library/Shield Library/SmartThings it is this SmartThings folder you will be using to upload the libraries
to the Arduino.

Note the readme says “SoftwareSerial library was default library provided with Arduino IDE” - Here you do nothing, this is automatic. Nothing to do here, just skip over this step.

Let me explain the two libraries you just downloaded need to be added to the Arduino IDE because they do not come with it by default. The SoftwareSerial library comes with the Arduino IDE, to verify goto Sketch | Include Library and you will see it listed there, but notice that the Timer and SmartThings libraries are missing?

Installing the libraries

The readme file might be outdated so the instructions to install the libraries are different from the current version of the Arduino IDE my was version 1.6.8.

Go to Sketch | Include Library | Add .ZIP library… it will open a select library dialogue box, find your “Timer” folder (Select the folder not individual files) you downloaded select it and click open. It will install it see status bar.

Go to Sketch | Include Library | Add .ZIP library… it will open a select library dialogue box, find your “SmartThings” folder (Select the folder not individual files) you downloaded the one you extracted from the Shield library zip select it and click open. It will install it see status bar.

Verify Library uploads, Go to sketch | Include Library and you will now see the Timer and SmartThings libraries in the list.

Now all your Libraries are loaded and ready to be compiled along with the Arduino code (Arduino_8_Zone_Irrigation_Controller.ino). This is done automatically because the Arduino code has includes statements that will load the libraries.

For example as coded in the Arduino code using the includes statements lines 214 -217.
SoftwareSerial.h
SmartThings.h
Event.h
Timer.h

Load the Arduino Code

Connect your Arduino to the computer via the USB cut and paste all the code from “Arduino_8_Zone_Irrigation_Controller.ino” you downloaded.

Make sure you got to Tools | Board and select the correct Arduino Board mine was “Arduino/Genuino Uno”

Make sure the COM port is set correctly , you can got to Tools | serial Monitor and see where your Board is (what COM is it on)

Go to To sketch | Upload, once uploaded you are done.

Disconnect the Uno and proceed with the readme instructions:

I will quickly mention the next steps, they were pretty straight forward, but if you need help just post a reply.

Next you will install the Device Handler type using the “Device_Type_8_Zone_Irrigation_Controller.groovy” you downloaded, go to SmartThings IDE under My devices.

Next you will install the Scheduler Smart App using the “IrrigationSchedulerApp.groovy” you downloaded , go to SmartThings IDE under My Smart Apps.

Next go to My Devices in ST IDE , select the “Arduino” or whatever it called it mine said “SmartThings Shield” and edit the Device Type and select the “Irrigation Controller device type” or whatever it called it mine said “Arduino_8_Zone_Irrigation_Controller”.

On your smartphone make sure to go to marketplace, | smart apps | scroll down to my apps and select and install or configure the Irrigation Scheduler.

Enjoy

2 Likes

@billcat,

Thanks for the feedback on the instructions and taking the time to suggest improvements. I am burning some time at 38,000 feet on my way back from the west coast so I am updating the Read.me with your suggestions. Hopefully, future adopters will benefit from your contributions!

I’m looking forward to implementing this. Thanks to everyone who contributed and, clearly, particularly @d8adrvn and @mattn . I expect I’ll have a ton of questions and be back to beg for help over some silly question, but for now, I’m just shopping. I’ve finished reviewing the whole thread, and it’s mostly clear, but…

The Arduino is totally new to me, and I’m surprised that everyone else in 268 posts seems to understand all its nuances – I don’t.

  1. I read that the Mega is recommended, but it seems most people are using the Uno. Which should I buy (and why, please)?
  2. I gather that “Arduino” is both a company and an open-source design that is productized by a lot of people. Are generics reliable, or is it worth it to get a real Arduino-made Arduino?
  3. If the real is preferred, how do I know what 's real? For instance, I see blue, red, yellow versions on Amazon - does that tell me anything?

Thanks for any advice/opinions/warnings.

I
'll take a crack at it :slight_smile: I was just as confused when I started, but did a lot of reading on the Amazon comments and the Arduino site to try and understand all the different options.

  1. I use an Uno Rev 3 for an 8 zone system. If you’re planning on dedicating the Arduino for the sprinkler system (and why wouldn’t you?) then the Uno should be fine. If you plan on using more zones, or possibly also using the Arduino for other projects, then Mega, with more memory, will be more flexible.

  2. Yes, Arduino open-sources their designs, which makes it legal for third parties to use the design. They sell the “real” boards through their website and in partnership with a few re-sellers. Reading the comments on Amazon, it appears some folks are happy with generics, which are generally much cheaper, and other folks have issues. If you don’t want to get into that, order a real one. I tried to from Amazon, but I’m still not 100% sure that what I got was a real one. I think the only way you can ensure that you got a real one, is to buy from the Arduino website. There are lots of hits when you search Google for how to tell a fake Arduino.

1 Like

Thanks @Dan999 . I’ve ordered everything. I went with a knockoff Arduino Uno to save $18. It had good reviews on Amazon and I plan to spend some time bench testing, so it’s not a big deal if I have to return it for a genuine Arduino.

1 Like

Good luck @CAL7. Let us know how it goes. We have all been where you are at least once. :slight_smile: Let us know if you need any help. Have fun!

Is there anyway to change the code so the pump shuts off after a minute or 5 im using it more for a trigger and not an actual pump. This is for the 8 relay set up.

Woody,

I am flagging @d8adrvn Stan so that he can add his input on setting the pump for a 5 minute interval. Perhaps more background on what you are trying to achieve would be in order.

I guess I must be pretty good with the Arduino as the only thing that got me confused was how to setup run times for each of my zones. :slight_smile:

Oh, and the knock off Arduino boards function well in all of my experiences thus far.

1 Like

@woody_seiders,

If you simply want to turn off relay 8 five minutes after the last irrigation zone completes its cycle, this would be pretty straight forward. Within the Arduino code, there is a function called toggleOff. Within toggleOff it checks to see if relay8 has been enabled as a pump and if so, it turns off the pump. You could use the timer function to start a time delay before turning off the relay. If this fits your use case, let me know and I can send you the code or you can give it a try yourself. Before starting, we need to be sure that your use case is to 1) turn on relay 8 when any irrigation zone is activated and then always turn off relay 8 five mins after the last irrigation zone completes. Also, if you manually turn off relay 8, do you want that to be immediate or after 5 min?

I would like relay 8 to shut off before the next zone would start whether it’s 1 or 7. I am using a pulse timer and that is triggered by relay 8. What this is for is I have DC voltage valves and they need to see 24vdc for 1 second to open and close. Being that relay 8/pump stays on until the last zone shuts off it messes up my plan. Would be nice if I could use relay 8’s timer feature in SmartThings but it seems like it gets voided out its in pump status.

Thanks for the help as I am not to swift with codes.

I received everything yesterday and proceeded to assemble tonight. I think it’s going very well so far. I believe it’s put together and device handler, device, and smartapp are all runnning. ST paired with the Shield. It’s just not passing my test for actually throwing the relay. I may well not be testing properly.

I have it all on my test bench. The Arduino&Shield are powered and appear to be talking to the device in the SmartApp. All the zones are grey. When I activate a zone, it turns filled-in grey; no colors. Live logging reflects the zone presses.

But, my continuity test of the relays shows nothing. The NC contacts are closed. All the NO contacts are open and stay open.

No 24V power is involved because I just wanted to test the ability to throw the relay. Is there some reason I need to have the 24V connected? Is there some other reason my test bench setup is not right?

Thanks for any help.

EDIT: After I posted, I noticed that one red LED is lit on the Relay Module, corresponding to Relay 7. In the app or by checking continuity, there’s nothing different about #7.

EDIT 2: The app zone controller icon, in addition to changing color to dark grey, also says “SENDING”. Does that mean it’s trying to send and not succeeding, or it that it’s normal indicator for “ON”?

@CAL7,

Sounds like you still need to enter run times for each of the zones. On your smart phone, in the device handler you should see a sprocket in upper right corner. This takes you to the preferences screen where you can enter default times.

I appreciate the quick response. I did enter new default run times in the app (just checked and they are there). Used 15 minutes for Zones 1-5, 0 for Zones 6-8 and nothing for the two non-existent banks.

Please look at Zone 4. The instructions don’t describe a response like what I’m seeing.

EDIT: A little more info to help you (@d8adrvn or anyone) help me. Again, thanks!

The red LED is on zone 7 (which I have set to 0 since I won’t be using more than 5 zones) and is more or less on all the time. I was wrong above when I tested continuity - it is ON. Also, I see an occasional red led flash on Zone 8.

A reminder, FWIW: I did buy a knockoff Arduino, which I concluded was better than a fake Arduino. It’s yellow.

I’m powering the Arduino with a salvaged 12vdc/1a supply. My multimeter, which I don’t trust, measures it at 15vdc output. As I understand this is in acceptable tolerances.

However, when in 22-15v power, the Arduino/Shield combo is running warmer than I would have thought. It’s too hot to hold more than a couple of seconds. Is that normal?

When the Shield paired right away with ST, I took that as a good sign to validate my hardware. However, I’ve got no blue LED. Looking at pics posted here, I see it; but mine’s just a white dot. That can’t be good. Do any diagnostics exist, perhaps in the Arduino IDE?

I’ll be grateful for any tips on how I can further diagnose what happening.

@cal7,

First, the “sending” message that you are seeing is a proper message. Once a zone is activated, the Device Handler sends a message to the Arduino and the tile says “sending”. Its only when the Arduino replies that the appropriate zone (relay) has been activated, that the “sending” message switches to either the blue “on” or the gold “queued” message. This creates a positive feedback loop between the Device Handler (virtual relays) with the actual relays.

In your case, the fact that the tile gets stuck on the “sending” message, indicates there is no communication back from the Arduino.

The two main troubleshooting solutions to address this issue are:

  1. Entering run times in the preferences of the Device Handler. Note: the first screen shot that you provided shows run times for the Irrigation Scheduler Smart App. You enter these times in for each schedule that you want to create. To run the irrigation controller manually, you have to enter manual run times into the preferences of the Device Handler. Look at your second screen shot. In the top right is a sprocket. Press the sprocket and enter manual run times.
  2. Make sure the DIP switch on the ThingShield is set to D2/D3 (this is the factory default but I have received one that was set to D0/D1)
  3. The device code was never loaded onto the Arduino. This can be checked by opening up the Arduino (IDE), reloading the code (be sure there is no error messages) . You can also go into the Arduino .ino file and turn isDebugEnabled = true before loading it to the Arduino and then up a Serial Monitor window (Tools<Serial Monitor) to see if there are any messages going back and forth between SmartThings and the Arduino

Note: I edited my point #1 after noticing the screen shot was for the smart app rather than the device handler.

1 Like