Automating my sprinklers

I have been spending a few hours creating a sprinkler controller.  The basic structure is to have a Perl program do the hard core logic, and then issue a webservice request to trigger the sprinkler controller on for a watering cycle.  So far, I have the embedded controller ready to interface to a hacked sprinkler controller .  The controller just takes a simple command to water a zone for so many seconds.  There is no higher level sequencing that is in place yet.  In reality, I probably need to send a sequence to the embedded controller so the power supply only powers one water solenoid at a time. The alternative is  to put that logic in the Perl program, so that’s where I am now.

I have been working on the Perl program to figure out my watering algorithm.  So far, I just make a request to a NOAA weather site for an airport  about 2 miles from me. The document is slurped as XML data that XML::Simple throws into a hash.  From there, I take the relative humidity and integrate the “dryness”,  or 100 minus the humidity, for the given time span.  I have decided to water my grass every 3 days as a ballpark until I see how things are working. The program just prints out a trigger message for now.  In the future, this will spawn off a sequence of webservice requests to water the lawn.

So far, we have been having some interesting weather.  There have been off-and-on rain storms coming through, and this week is setting up for a rapid change into hotter weather.  A weather description that matches “Rain” will cause a reset of the integration so the lawn is not watered.  The script logs some pertenant data to the end of the script so I can rerun a scenario in the future with real world data.

A side product of this project is to tie it to my Doggie Dumpcam, which captures realtime image changes on my front lawn.  The tree is growing bigger lately, which is creeping outside of the mask area and triggering a lot of image captures.  Some interesting things have been captured, including dogs, birds, and hornets.  This Perl program will have the capability to trigger a particular sprinkler zone between, say, the 6am and 8am hours for a small timespan.

SOA Musings

Every so often, the world rolls by, and you hear bits and pieces of things.  Most often, they don’t mean too much, so you just make a mental note and that’s about it.  Sometimes, though, it totally catches you offguard, and you wonder how you managed to miss the whole boat.  SOA is one of those things. Well, maybe half the boat.

When you talk SOA, I think you are also talking Java, but folks will not tell you that.  For some extra reading, you can check out What is SOA. I haven’t yet, so I can’t say I know anything. After you figure all that out, then check out SOA Principles for some more. Then, you can check out SOA Patterns when you get really board.

See, these links are really so I can go read those things, and then I’ll try to update this post.  In my naive thinking,  SOA is just doing what you were taught.  But then you really do it that way, and don’t cut corners.  Remember all that talk about design up front, test driven development, and developing to an agreed upon interface?  That’s really what SOA is.  But I need to check the previous link to see if I’m right.

The other thought is that SOA is doing what you were not taught.  I can’t remember being taught all the things in The Pragmatic Programmer. But it seems to be full of what you should do, and other things I wasn’t taught. But hey, maybe that’s because I’m an EE.