2016 Aug 10, 10:08 PM
Dan,
First of all thanks for your excellent piece of work. I have a 7 zone install which includes my pool pump which had been running problem free since August 2015. Just last week I noticed that irrigation had stopped and I suspected the 24v transformer, upon investigation this was found to be OK and I noted that none of the relays were being switched though software wise everything looked normal.
To cut the long story short it was well past midnight and pushed to get things working in the dark hours I simply swapped the Pi out and everything is back to normal. I have not yet tested the Pi I took out to confirm if the GPIO has died.
Anyway my reason for writing is that I am looking into changing the existing setup to make it easier to maintain deploy and I am interested in the possibility of having RF ( 433mhz ) stations.
I have searched high and low and whilst I see that opensprinkler is capable of doing this and in a post in another forum I see a response suggesting using a generic 433Mhz Tx connected RF transmitter to +5V, GND, and GPIO pin 17 on RPi
and making changes to your interval program I am unsure where exactly to fit this in.
Ideally I would like to be able to add these RF stations via the UI and have multiple RF stations but think the code below would be just for one station which would not be very useful.
Grateful for your thoughts and help.
Kind Regards
Joseph
Code:
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
SEND_PIN = 17
SIGNATURE = 0b0000111101010101
COMMAND = 0b11110001
DELAYSHORT = 160
DELAYLONG = 500
OVERHEAD = 0 # overhead time (in us) for calling GPIO.output and time.sleep. If 0 doesn't work, try 125
def ookPulse(on,off):
GPIO.output(SEND_PIN,True)
time.sleep((on-OVERHEAD)/1000000.0)
GPIO.output(SEND_PIN,False)
time.sleep((off-OVERHEAD)/1000000.0)
def pt2262Send(signature,command):
for k in range(0,16):
for i in range(0,16):
if((signature>>(15-i)) & 0x1):
ookPulse(DELAYLONG, DELAYSHORT)
else:
ookPulse(DELAYSHORT, DELAYLONG);
for i in range(0,8):
if((command>>(7-i)) & 0x1):
ookPulse(DELAYLONG, DELAYSHORT)
else:
ookPulse(DELAYSHORT, DELAYLONG)
ookPulse(DELAYSHORT, DELAYLONG)
time.sleep(.005)
def main():
GPIO.cleanup()
GPIO.setmode(GPIO.BCM)
GPIO.setup(SEND_PIN,GPIO.OUT)
while True:
pt2262Send(SIGNATURE,COMMAND)
time.sleep(5)
main()