Here's some rough instructions for what I did
You'll need the following:
• Raspberry pi (obviously)
• relays (I used Sainsmart 8 channel solid state relay. It's safe to drive it right off the gpio, writing a 1 turns on the relay, writing a 0 turns the relay off; that's not true for other Sainsmart relay boards I'm told)
• phpMyAdmin, mySQL, & apache (I basically used drcurzon's instructables for setting this up located here http://www.instructables.com/id/Raspberry-Pi-Web-Server/)
• You'll need to build the sql database with my .sql file located on gist here: https://gist.github.com/4707325
• Gordon's wiringPi (https://projects.drogon.net/raspberry-pi/wiringpi/)
• mySQL connector
- Code: Select all
apt-get install libmysqlclient-dev libmysqlclient16
• the program and header files (I have them on gist for the moment https://gist.github.com/4707059)
• Php webpage (This is based heavily on drcurzon's script, I've added auto functions to it and changed the main page layout. Also on gist: https://gist.github.com/abishur/4958422
Basic Instructions:
1. Install phpMyAdmin, mySQL, and Apache
2. Install mySQL connector
3. Install Gordon's wiringPi
4. Download and configure sql with my gpio.sql file
5. Download control.php to /var/www/ and edit the username/password in the file to be able to connect to your mySQL database
6. Download sprinklers.cpp and associate header files (For me I made a directory /home/pi/scripts and saved the files there)
7. Change the #defines in sprinkler.cpp to what's true for you system and compile. using
- Code: Select all
g++ sprinklers.cpp -I/usr/local/include -L/usr/local/lib -lwiringPi -lmysqlclient -I/home/pi/scripts
the last include probably isn't necessary as it should search the directory with sprinklers.cpp by default, but I don't like leaving things to chance
8. You'll now have a program called a.out. This program must be run as sudo for wiringPi to work. As long as this program is running you can control the GPIO pins from http:\\your_pi_IP_address/control.php
You'll be able to turn them on and off manually or configure automatic settings for them to turn on on:
Even numbered days
Odd numbered days
User defined days
All of them use a specific start time and a duration to be on (in minutes)
As I said above I'll try and clean this up and make a proper instructables of it this week when I have some time. Enjoy!


