Sprinkler Controller Written in Node, running on Raspberry Pi

How I made my sprinkler controller for my garden and yard. The controller provides http endpoints that trigger a sprinkler valve to turn on or off. A daily routine can be provided using cron, and/or a frontend could be built to turn the sprinklers on and check their state (neither of those tasks is covered here).

You'll need:

Note on the wire: I used a 5-wire, so I can run 4 zones (we have 8 relays, 4 unused for future), and have one wire left-over for ground.

Build the manifold

Things to consider

I used 3/4" PVC and glued several parts. Only 3 valves are connected in the picture, the 4th will be for a hose to give my dogs fresh water at regular intervals.

Software Installation

Install Node on Raspberry Pi. These commands worked for me:

This will give you the latest copy of Node created for ARM architecture, which is not exactly bleeding edge (I got Node v4.2.1 in April 2017), but that's okay!

Clone this repo and upload it to your pi.

git clone git@github.com:atmartins/martins-sprinklers.git

Modify deploy.sh (adjust IP address of your Pi, or anything else needed).

cd martins-sprinklers && vim deploy.sh

Then run deploy to copy the source to your Raspberry Pi

./deploy.sh

SSH into the Pi and start the sprinkler server:

Use - Turning Water On/Off

There are a few endpoints that can be interacted with. I'm running this on my Raspberry Pi on my local network at `192.168.1.217:3217`.

If you use a tool like Postman, you can very easily hit these endpoints.

HTTP Verb - URL - Explanation

The following work the same for channels 1-8:

me@aaronmartins.com