If you have a sprinkler system, chances are you do since you are looking at this. wouldn't it be cool if you could control your sprinkler wall through a remoate device like, laptop, phone or a tablet ?. Yes thats exactly what Open Sprikler Pi enables. Raspberry Pi is bacially a computer (FYI $35) with GPIO. For more on Raspberry Pi check here.

Ray from http://rayshobby.net created an extenstion board for Raspberry Pi that allows interaction with your irrigation system valves. Check out Ray's website for more.

Assuming you already have a raspberry pi based iggrigation system setup and now you would like to control the valves using a command line tool (i.e to open or shut the valves) or use java scripot interface from your application to control the valves, you need few things set up first your Raspberry Pi before we begin

Node.js is the JavaScript runtime environment built on Google Chrome's JavaScript runtime. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.

Easiest way to install Node.js on your raspberry pi is to download the pre-build binaries for ARM distribution. Pick a latest version for which ARM distribution is available at http://nodejs.org/dist. For example

-s, --shut [stations] List of stations to open. Defaults to shut all stations.

to open valves 6,5

sudo ospi --open 6,5

to shut off all the values

sudo opsi --shut

With these two basic commands you could easily set a cronjob. For example

0 5 * * * /bin/ospi --open 6

10 5 * * * /bin/ospi --shut

12 6 * * * /bin/ospi --open 3

16 6 * * * /bin/ospi --shut

20 6 * * * /bin/ospi --open 5

23 6 * * * /bin/ospi --shut

30 6 * * * /bin/ospi --open 4

33 6 * * * /bin/ospi --shut

40 6 * * * /bin/ospi --open 7

43 6 * * * /bin/ospi --shut

In the above a cron job would open valve 6 at 5 AM and shut it off at 5.10 AM every dat. It should be fairly easy to write a wrapper script that could fetch the current condition and conditinally call ospi to open the valve based on weather factors.

On the otherhand if you would like to control the valves using your node app then you can use the ospi service apis. To do that you need specify a dependency on ospi in your package.json and then install the node modules. This will initialzie the ospi module