Forum Replies Created
-
AuthorPosts
-
danicoBlockedJon,
I went and wrote two programs, one to harvest the event info for the next seven days from Google Calendar and save to a XML file, the other to use that XML file to run the events. Will be good to compare your method to gather the events, I’m sure it is more elegant!
Also expanded the idea, so not just sprinklers (or Reticulation as we call it here), but to also include garden lights and maybe house lights when on holidays. Can be expanded further to include blinds and windows or whatever we need done on a periodic basis.
None of this is original work, it is all taken from others, and just tweaked, massaged and stretched a bit…
Works like this – the calendar and access is set up as per Ray’s instruction, it is a specific calendar used just for house tasking. On this calendar, we create our events, anything to do with sprinklers, the event starts with ‘Retic’, so to water my Citrus trees, the event title is ‘Retic:Citrus’, then we put in the start and stop time. For the garden lights the events are ‘Lights:Letterbox’ etc.,
I think the code is quite readbleto where you can add or remove these event types, and how to change the prefix wording.
So once every 15 minutes, GetCal reads the Calendar for the next seven days. If any of the events are newer or changed since the last read of the calendar, then the file is updated, else it is ignored. Also if the stored file is older than 24 hours, it will force a re-write of the event file.
At the moment the events are written to the current directory, eventually they will be written to my NAS, just not got there yet.
So that is all this does, over and over. Will likely be put on to my DNSPi – an extra job for it to be doing….So now the other side of things.
SprinklerPi gets hold of the saved ‘CalRetic.txt’ file and pulls out the relevant zone data. I was planning on writing an elegant program that ordered the events, put all the of the starts and stop in sequence, set various clock alarms to take care of the event, but that just got too difficult. Looking at how Ray had already done the calendar program, it was just the most straight forward way to go. So in a very similar method as that program, every say 15 seconds we look to see if any events are currently in play, if they are then the zones are set. It is really just Rays original program, but data from a file instead of from Calendar.
It does check to see if the file has been updated, and if so re-reads the data, else it just runs on checking and setting zones.
When it came to the Master valve, this is set in the software (as I have one), or it could be a calendar event that encompasses all of the sprinkler events.LightPi is very similar, it will sit in a box outside, but instead of an OpenSprinklerPi attached, it just has a SainSmart relay board, basically the same code but using the ‘Light’ XML data file.
In both of these programs, the tricky part is keeping track of how the time is being stored. The Atom feed from Google is in rfc3339 format, we want to save to file in a nice readable string, but to do comparisons and deltas, we need to be in datetime format. Can get very confusing, but I think it is right in the end.
Both programs are not yet complete, but are operational, and still contain many prints of current status as part of the debug process. These will be removed soon, and then the programs will run as a service.This is my first outing in Python, so I’m sure that there is much better and elegant ways of doing things, and really the hard work was initially done by Devon and Ray, but just wanted to get these out there as they may assist others in their home reticulation designs!
danicoBlockedJon,
Your approach to using Google calendar for the scheduling via two code pieces, is a similar way to which I was looking to approaching this. Have you been able to progress it any further?
I am very keen to see how you got to this point – my few attempts to use a private calendar have not been very successful!
I will chip away at this, and hope to get it running, but would be great to see how you achieved the success in the first half of the method.
danicoBlockedThanks for the response Ray.
Not an inductive load, actually planning to use your board to drive a bunch of garden lights! Already have your V1.1 Pi board looking after the garden watering, was looking at a method for simply turning the garden lights on at dusk, and off again at midnight (and maybe some other fancy bits), and just could not go past a V1 Pi with a V1 opensprinkler board! All is run by solar and a storage battery, the opensprinkler Pi will sit in a box out in the garden, and can then control all things garden lighting! So using FETs will be that bit more efficient than relays.
So given no drop in part (was hoping that you had heard of an obscure transistor that would suit!), I think the easiest solution will be to use a SOT223 MOSFET (a BSP100), but install it upside down – is not super elegant, but it should work.
What do you think?
danicoBlockedI too am looking to switch a DC load, and intend to replace the triacs with NPN transistors, or FETs seems very straightforward.
The problem has been in finding a transistor that suits – the gate for the triac is on the right side of the SOT-223 package, whereas it seems for all transistors, the gate or base is on left side of the package. So no easy ‘drop in’ replacement here!
Has anyone found an straight forward method for doing this swap?Many thanks!
-
AuthorPosts