Closed TheCook2 closed 7 years ago
You could just use interval and set it so it only water every other day, but you would have to make sure you started it on the correct day.
On Tue, Dec 20, 2016 at 4:29 AM, TheCook2 notifications@github.com wrote:
Hello from Canberra Australia, I have just built myself a little Pi box to control my sprinklers and this software is just what I need. Well done for filling this little gap in the world of useful applications.
In Canberra, a very hot and dry place (during summer at least), we have been placed on permanent water restrictions since the last big drought. As a result, we are only allowed to water on odd or even days (depending on your house number).
Has anyone had to deal with using sprinklers_pi before? If so, how did you fix it? Have I missed something?
If I am the first to think about this, my initial response would be to raise a cron job to set/reset a relay based on the date and then provide my 24VAC power to all the other relays via the odd/even one. The only issue I can think of is that sprinklers_pi may mess with the odd/even relay. If I pick data pin 20 (GPIO_BCM No 31) and only have 10 or so zones, will sprinklers_pi leave it alone?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/77, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKE3KOzEWRh6smwbAW8RpnYdOLir1uzks5rJ5_hgaJpZM4LRoJi .
I thought of that. It is a quick and easy solution. BUT I wouldn't want to get into trouble if I ever get a holiday and I'm not at home to update at the end of the month...
As I type this, my little Pi is clicking away and running all my test schedules. Cool.
I have written a quick and dirty batch file to run as a cron job at midnight.
PIN=28
DATE=date +%d
echo This is day number $DATE
echo I am messing with pin $PIN
echo
if [ $((DATE%2)) -eq 0 ];
then
echo This is an even day
echo Turning the even/odd relay off
gpio write $PIN 1; #Set pin to 3.3V which turns the relay off
else
echo This is an odd day
echo Turning the odd/even relay on
gpio write $PIN 0; #Set pin to 0V which turns the relay on
fi
I had to change the mode for pin '28' from in to out but after that it seems to work OK.
For now, a bit of (very) old fashioned relay logic will do the job. Maybe I will finally learn how to write in C and add the functionality to your program.
Thanks for the help.
Latest script is:
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
PIN=28 #The GPIO pin that will be changed
DATE=`date +%d` #Get the current day of the month
#echo
#echo +++++++++++++++++++++++++++++++++++
#echo "$(date) $line"
#echo Date is $DATE pin is $PIN
if [ $((DATE%2)) -eq 0 ]; #Divide by 2 to see if it is even
then #It is even so...
#echo it is even
gpio write $PIN 1; #Set pin to 3.3V which turns the relay off
else #It is odd so...
#echo it is odd
gpio write $PIN 0; #Set pin to 0V which turns the relay on
fi
#echo
#echo ------------------------------------
#echo
#sleep 10
#gpio toggle $PIN
The pin fixing script looks like this:
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
gpio mode 28 out
gpio mode 29 out
/home/pi/.Scripts/DateControl.sh
And crontab looks like this:
0 0 * * * /home/pi/.Scripts/DateControl.sh
* * * * * /home/pi/.Scripts/TempControl.sh>>Temp.log
@reboot /home/pi/.Scripts/RelayFix.sh>>Temp.log
TempControl.sh just looks at the CPU temperature and turns a fan on and off as required. The fan is controlled via pin 29.
Forgot to hit the 'Close' button
Hello from Canberra Australia, I have just built myself a little Pi box to control my sprinklers and this software is just what I need. Well done for filling this little gap in the world of useful applications.
In Canberra, a very hot and dry place (during summer at least), we have been placed on permanent water restrictions since the last big drought. As a result, we are only allowed to water on odd or even days (depending on your house number).
Has anyone had to deal with odd/even days using sprinklers_pi before? If so, how did you fix it? Have I missed something?
If I am the first to think about this, my initial response would be to raise a cron job to set/reset a relay based on the date and then provide my 24VAC power to all the other relays via the odd/even one. The only issue I can think of is that sprinklers_pi may mess with the odd/even relay. If I pick data pin 20 (GPIO_BCM No 31) and only have 10 or so zones, will sprinklers_pi leave it alone?