Schedule features: Start-time, days of the week, zones (up to 6 currently), duration per zone, interval (time elapsed between complete cycles), and iterations (number of cycles through the zones).
This app is built with node.js, features a react front-end, and uses a postgres database. While designed to run on a raspberry pi and control solenoid valves through its gpio pins, SprinklerTime can run in demo mode on your local machine for development and testing. If no gpio hardware is detected, the app will automatically run in demo mode.
note: This application is designed to run on a local wireless network and be accessed by web browsers on computers/phones on the same network, not over the internet.
To get started:
In the command line:
-
Run
cd sprinkler
to get into the directory. -
Run
bash setup_database.sh
which runs a simple script to set up a 'sprinkler' table in your database, creates a user ('pi') with a password ('raspberry'), and grants necessary permissions. -
Run
npm install && cd client && npm install && npm run build
to install necessary dependencies and bundle the react front-end.
On raspberry pi:
Out of the box, SprinklerTime is configured to run at 192.168.1.10
. If this is unavailable on your network and you have to use a different static ip, you must update the target address for the websocket to match in /client/src/App/App.js
on line 16. Don't forget to add the port (xxx.xxx.x.xx:8080)!
-
Wire up your hardware. You must connect the gpio output pins to a relay which is powered seperately and will handle switching your solenoid valves on and off. (details coming)
In demo mode:
- In
/client/src/App/App.js
, update the socket address to run at localhost:8080 but uncommenting line 15 (const ws = new WebSocket('ws://localhost:8080');
), and commenting out line 16.
To start the app:
-
Run
node index.js
in the sprinkler directory. The application will be served at localhost:5000 or (by default) at192.168.1.10:5000
-
Once the app is running, you can go to localhost:5000 or whatever static ip you have set up and start making, saving, and running watering schedules.