Controlling A PLC With Amazon Alexa

I recently purchased an Amazon Echo which is a hands-free speaker you control with your voice. Amazon Echo connects to the Alexa Voice Service to play music, provide information, news, sports scores, weather, and more—instantly.

It’s the ‘more’ this article will explore. Unlike other services, Alexa exposes itself via the Alexa Skills Kit

According to Amazon

“The Alexa Skills Kit is a collection of self-service APIs, tools, documentation and code samples that make it fast and easy for you to add skills to Alexa. You can also use the Smart Home Skill API, a new addition to the Alexa Skills Kit, to easily teach Alexa how to control your cloud-controlled lighting and thermostat devices.”

This article serves as an architectural pattern on how to interface Amazon Alexa with any PLC. I will provide an example of using an Amazon Echo to control a function of my PLC which is my heating. I have a regular multi zone gas ducted heating system which I drive via my PLC. This post assumes the gas ducted heating system is already being driven by the PLC and the theory can be transposed to any device controlled by the PLC. Details on how I built my thermostats, relays and logic can be found in this blog post – Interfacing Zoned Gas Heating with an Automation System (Homevision Pro)

Step 1: How Do I Interface Alexa To My PLC?
The first step I took was to look for an existing Alexa Skill on the odd chance their was a bridge. The skills at the time of writing focus on domestic products and not industrial PLC’s so I need a way to bridge Alexa with my PLC. After hitting a combination of Google and forums I am came across HA Bridge by BWS Systems. BWS Systems describe HA Bridge as follows

“HA Bridge allows connectivity from the Amazon Echo or other automation controllers to various Home Automation systems. There are features that allow connections to any http/https/TCP/UDP or scripts or programs on the host machine.”

Sounds simple enough and really it was. It emulates a Phillips Lux light for every device you add. The application can be downloaded from GitHub and comprises of a Java archive that requires JRE 8.

Step 2: Invoking HA Bridge
I will not delve on how to install JRE but will assume this is installed and working.
Worth noting is the archive includes a .DOCKERFILE so this could be ran on Docker or a service such as Amazon EC2 Container Service

To start HA Bridge simply execute the jar file with JRE.
Screen Shot 2016-08-04 at 8.26.23 PM
Once invoked the bridge will JettySparkServer on TCP port 8080
Screen Shot 2016-08-04 at 8.26.55 PM

Step 3: Configuring HA Bridge
HA Bridge is very simple, it’s not a complex offering nor does it need to be. The premise of the bridge is two fold

  1. Expose devices as a Phillips Lux light for devices such as the Amazon Echo that natively communicate to Phillips Lux lights
  2. Broker and pass calls to a HTTP(s)/TCP/UDP endpoint

Let’s add a device by browsing to http://127.0.0.1:8080 (or your machines IP)
Screen Shot 2016-08-04 at 8.31.19 PM

Next lets configure the settings, this will be dependent on your PLC or device you are communicating to
Screen Shot 2016-08-04 at 8.32.49 PM

So what I have configured is as follows

  1. On URL : A URL to turn my heater ON. I do this by setting a variable to 1
  2. Off URL : A URL to turn my heater OFF. I do this by setting a variable to 0
  3. Dim URL : A URL to turn adjust the zone’s temperature. This is dynamic and I pass in an intensity percent.

Hit ‘Update Bridge Device’ to save.

Step 4: Test HA Bridge
HA Bridge has a test function that will allow you to test ON/OFF/DIM(either raw or percentage). Before we get to linking the Echo to HA Bridge and talking to Alexa lets test that what we have done actually works.

Screen Shot 2016-08-04 at 8.46.35 PM

After hitting ‘Test ON’ I can see the PLC has received a VARUPDATE and the value for the variable is now 1.

Screen Shot 2016-08-04 at 8.48.50 PMNetIO registers this instantly as seen on the phone.
IMG_0582

Step 5: Discover New Devices On The Echo
Device discovery can be completed multiple ways. The easiest way is to just ask Alexa.

“Alexa, Discover My Devices”

If there i an issue you can go to “Menu / Settings / Connected Home’ at http://alexa.amazon.com and run through the wizard.

Step 6: What Should I Say To Alexa?
There are many ways to invoke ON, OFF and DIM commands with Alexa. Below is a handy table which can be found in the HA Bridge Documentation on GitHub

To do this… Say this…
ON Commands
Alexa, turn on <Device Name>
Alexa, start <Device Name>
Alexa, unlock <Device Name>
Alexa, open <Device Name>
Alexa, boot up <Device Name>
Alexa, run <Device Name>
Alexa, arm <Device Name>
OFF Commands
Alexa, turn off <Device Name>
Alexa, stop <Device Name> (this one is tricky to get right)
Alexa, stop running <Device Name> (also very tricky)
Alexa, lock <Device Name>
Alexa, close <Device Name>
Alexa, shutdown <Device Name>
Alexa, shut <Device Name>
Alexa, disarm <Device Name>
DIM Commands
Alexa, brighten <Device Name> to <Position>
Alexa, dim <Device Name> to <Position>
Alexa, brighten <Device Name>
Alexa, dim <Device Name>
Alexa, raise <Device Name> to <Position>
Alexa, lower <Device Name> to <Position>
Alexa, set <Device Name> to <Position>
Alexa, turn up <Device Name> to <Position>
Alexa, turn down <Device Name> to <Position>

Step 7: Lets Test It
We are now going to test turning on the heater, setting the temperature and turning it off and will use the following commands

“Alexa, Turn On Upstairs Heater
Alexa, Set Upstairs Heater To 21
Alexa, Turn Off Upstairs Heater”

Conclusion & Disclaimer
Amazon Alexa can be used to control almost anything and products like BWS Systems HA Bridge make connecting disparate systems possible.

I work for @AWSCloud but opinions expressed are my own

Thanks
Shane Baldacchino

 

Reading Exetel Usage Data With PowerShell

The de facto standard for control in house is our PLC, things mainly happen autonomously, but when things don’t happen magically the tool of choice is a smart phone running NetIO.

NetIO is a multi platform smartphone application, a generic remote controller for almost everything. It simply sends and reads strings over a network socket.

I have a NetIO server integrating with my PLC (Homevision Pro) written in TCL/TK and I write jSON code for our smart phones to leverage my PLC. This allows us to control everything the PLC has on offer. The PLC talks to everything in my house from heating and cooling, security, TCP/IP devices, power, lights, audio, and so on all in a consistent manner.

The other day I thought, wouldn’t it be great if I had a page showing all of my bills and how much I have used in real time, most places have API’s. So here goes my first example trying to read my usage data from Exetel.

 

Step 1: How Do I Talk to Exetel?
After hitting Google I am came across a page on Whirlpool that contained exactly what I needed.

https://www.exetel.com.au/members/usagemeter_xml.php?username,password’

Sounds simple enough and really it is. Putting this in your browser returns malformed XML, which isn’t great as an XML parser can’t be used but there are ways.

Step 2: Manipulating The Data
My language of choice these days is PowerShell so that is what we will write this in.

Dealing with Exetel  (and most other API’s) usually throws in a few curve-balls and here is what I found when writing my code.

  1. Malformed XML, the output is malformed and because of this I can’t use PowerShells’ built in XML parser. We will need to use regular expressions to pattern match and this is what I have done.
  2. It’s not a total, when I login to Exetel’s members page I get a total amount of data used but when I download XML I receive it split in to off-peak / peak and upload / download, we will need to combine

Step 3: My Code
My code for this solution can be found here. So after executing if you are wondering how did he get this to his PLC I have removed the function to post the results back to my PLC because unless you have exactly the same PLC I do it will be useless and cause compilation failure

ExetelData_Blog

Execution will return a variable called $TrafficTotal which will be the sum of downloads, uploads, peak and off-peak in GB that is rounded to whole integer. What you do with this is up to you

Step 4: Displaying in NetIO
The cherry on the top. My solution updates my PLC with this variable data and I use NetIO to read this and display it as a gauge. The max value on the gauge is my internet plan’s maximum consumption

NetIO_Exetel

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Shane Baldacchino

Installation and Integration of a Hydreon RG-11 Optical Rain Sensor with a PLC

This is an article I have been meaning to write for some time. I guess I haven’t as this sensor has been something that has just worked out of the box and hasn’t skipped a beat in almost 2 years.

I have written about integration between OpenSprinklerand Homevision Pro in this article. Just a refresh, OpenSprinkler is a commercial irrigation controller based on an Arduino platform. It is controllable by a web-interface or a HTTP based API.

It is pretty good and I think I would rate it an 8/10, its the best controller on the market for the modern age for stand alone control but there are limitations. Do I just want to water based on a schedule (No). Do I want to water when its raining (Maybe).

The problem with OpenSprinkler is that it has no context of how much rain has fallen. If we receive 50mm of rain yesterday and its sunny today do we need to irrigate? Here lies the problem and hence why I utilise a Hyrdeon RG-11 in my house.

The task this sensor performs is to measure rain-fall and the whole process looks something like this

Hydreon RG11 –> PLC (HomeVision Pro) Input Port –> PLC Logic –> OpenSprinkler

You can buy cheaper sensors but the reason why I bought the Hydreon RG-11 is simple. Reliability. It has no moving parts and if my automation journey has taught me anything it is that things with moving parts will eventually break. The Hydreon RG-11 Rain Gauge senses water hitting its outside surface using beams of infrared light. It uses the same sensing principle used in millions of automotive rain sensing windshield wiper controls.

Being optical (and not mechanical, chemical, or conductive) it’s far more rugged, sensitive and reliable than other offerings. Leaves cant clog its mechanism and it just works. In the last 2 years I have no experienced any false positives

rg11-home-sm

Enough about the sensor, lets get started

Bill of Materials
– 1 x Hyrdeon RG-11 ($99AUD)
– 1 x 12VDC 500ma PSU ($0AUD – Leverage existing PLC PSU)
– 1 x Galvanised L Bracket ($8AUD)
– 1 x Quad Core Cable Between Hyrdeon RG-11 And PLC ($15AUD)

Total Cost = $122AUD

Tools used
– Pliers
– Screw Driver
– Electric Drill

Step 1: Configure the Hyrdeon RG-11
The device includes a series of dip switches that allows it to be set up for the mode of operation that best matches the application. The output is a NO/NC which can interpreted by your application. Depending on your mode selected the output will vary

rg-cb

Tipping Bucket – Replace your tipping bucket with a low maintenance alternative
It’s Raining – Close a skylight at the first sign of rain, and open it when it stops raining
Condensation Sensing – In this mode, the Rain Gauge continuously monitors the clarity of the sensing surface.
Wiper control – This mode will control the wipers from off through intermittent and steady-slow speeds.
Irrigation Control – This mode will measure both rain accumulation and rain intensity.
Drop Detection – Use this mode if you want to do your own external data interpretation.

So for my use case given I want all of the logic to be controlled by the Homevision Pro I have gone for “Drop Detection” with the NO/NC pulsing every time 1mm of rain is detected.

Step 2: Mount The Device
It should go without saying but this device needs to be mounted in a position that isn’t susceptible to shade by buildings. I have chosen to mount this off my garage using a galvanised L bracket to distant it even further from the house.

DSC_1068

DSC_1075

Step 3: Connect It All Up
Following the instruction push your cable through the cable gland, wire up your power (get the right polarity) and PLC input settings, validate your dip switches and grease the O-ring before sealing it all up. Connect the PLC end, enable your port if you need to and away you go.

rg-11-parts

HomevisionInputPorts

Step 4: Test and Add Your Logic
That’s it, simple. You now need to add your logic. My logic is to
– track the total rain fall (mm) stored in a variable
– roll up to a per hour (mm) stored in a variable
– graph rainfall by the minute using the Google Graph API
– display data via NetIO on a phone (see below)
– Depending on the maximum temperature of the day subtract 3-5mm from total rainfall, when rainfall is at 0mm fire OpenSprinkler early in the morning and again at night if outside temp was greater than 25C and send push notification to state what happened.

IOUpdateIMG_1259

 

 

 

 

 

 

 

Shane Baldacchino

Presentation: Automation and Scale On Azure – An Introduction To ARM Templates

I recently had the pleasure to present an Azure ARM templates 101 to Melbourne Infrastructure Coders. I want to thank all of those who attended, David  Lutz (@dlutzy) and Matthew Jones (@geekle) for facilitating and REA for the use of their facilities.

My presentation, Automation and Scale On Azure – An Introduction To ARM Templates, covered off an overview of ARM templates, the structure, how it relates to Azure and Azure Stack, a brief comparison against AWS Cloud Formation, Azure Resource Visualiser, deployment methods (Azure Powershell / Azure xPlat CLI) and what you can accomplish with ARM. I also spoke about the tooling you can use to manipulate these templates.

If you haven’t looked at Azure ARM templates and use the Azure platform I thoroughly recommend that go and take a look, it is the future of Azure.  There are a number of excellent resources out there for you to make a start, including:

You can find my presentation including the cmdlets used in the demos (see notes) by clicking the following link –  Infra Coders – Automation & Scale Using ARM Templates.

Managing PoE WiFi Access Points Power State Based On Alarm System Status

It has been almost 5 years of automating our house and during that time most systems have been automated successfully. These days it is about fine tuning and this is what this post is about.

Our house is on the largish side and contains three Cisco Aironet AP’s to provide a unified hidden SSID. We leverage our alarm system (Inner Range Integriti) extensively so our PLC (Homevision Pro) can make decisions to control power, security, lighting, audio and so on.

So with this being said there are use cases in our household when we don’t need all our WiFi AP’s running.

If we are sleeping we don’t need WiFi out in to our front yard and if we are out and the house is fully armed we only need WiFi at the front of our house for re-entry

Calculating Cost
With this being said what does it cost to power an AP? Is it worth the hassle to fiddle with something that works? Our AP’s are PoE based and run at 48v DC and use approx 1AMP. To convert this to watts you can use amps multipled by volts
1 amp * 48v = 48w
So assuming power draw is 48w and power costs 30c a killowat hour
0.048 * 0.30 = $ per hour * 24 * 365 = $126.14

It costs approx $125 to run a single access point for a year, so our annual power cost for WiFi is $375. It is worth it

The Solution
The Homevision Pro (PLC) and Inner Range Integriti (Alarm System) talk to each other. When the alarm changes state the PLC knows.
So with the ability to read data off the serial stream coming from the Inner Range Integriti we can take action and turn off our AP’s based on alarm system status.

Without delving to much in to the rules and operation of our house I derived a simple script that would manipulate the state of the switch ports to which the AP’s are plugged in to. They get disconnected when not needed and reconnected to the network when need, all of which is based on the alarm status.

The code snippet below relies on the following technologies and assumptions
– Cisco IOS operating system with Telnet enabled
– VBScript compiler
– Not a switch stack

The idea is portable and could be modified to suit any technology platform


'---------------- DO NOT EDIT BELOW THIS LINE ------
' **************************************************
' * Author - Shane Baldacchino *
' * Version - 1.0 *
' * Email - shane@baldacchino.net *
' * File Name - CiscoSwitchPorts.vbs *
' * Script Language - Microsoft VB Script *
' * Creation Date - Tuesday 23rd, December 2014 *
' * Modified Date - Tuesday 23rd, December 2014 *
' **************************************************
'On Error Resume Next

'---------------- EDIT BELOW THIS LINE -------------
'Versions
ScriptVersion = 1.0
'Cisco Switch IP
Cisco_Switch_IP = "xxx.xxx.xxx.xxx'
'admin password
admin_password = "xxxxxxxx"
'en password
en_password = "xxxxxxxxx"
'---------------- DO NOT EDIT BELOW THIS LINE --------

Set args = WScript.Arguments
'Shutdown(0) or NoDown(1).

set oShell = CreateObject("WScript.Shell")
oShell.run"cmd.exe"
WScript.Sleep 500
oShell.SendKeys"telnet " & Cisco_Switch_IP
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys & admin_password
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys"en"
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys & en_password
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys"config t"
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys"int fa0/" & args(1)
oShell.SendKeys("{Enter}")
wscript.Sleep 1500
Select Case args(0)
Case 0
oShell.SendKeys"shutdown"
Case 1
oShell.SendKeys"no shutdown"
End Select
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys"exit"
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys"exit"
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys"exit"
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys"exit"
oShell.SendKeys("{Enter}")
WScript.Sleep 1500
oShell.SendKeys"exit"
oShell.SendKeys("{Enter}")
WScript.Sleep 1500

'Code to log to database
'------Removed for blog ---------

Wscript.echo Now & "| Script Processing Complete"
Wscript.echo Now & "| Script Terminating"
Wscript.quit

Executing The Script
The script above has two arguments
– argument 0 = 0/1 [0 being power state off, 1 being power state on]
– argument 1 = int [switch interface port]

A video of the script in action can be found here

Summing It Up
The script above is generic means to manipulate the switch ports and how you link things together is up to you. Without divulging how our house operates this script is called by the PLC when alarm system state changes either to to turn off and on AP’s.

Based on a weeks usage (logged to a database) our 3 AP’s have gone from 24 hours usage each day to approximately 14 hours usage and apart from being awesome to watch it saves a few dollars

48watts * 0.30 kilowat hour cost * 10 hours avg use * 365days * 3AP's = $157.68

In our case $157 dollars per year of electricity use. Minor but it all adds up and why power something when you don’t need it? Plus from a security perspective you are reducing your surface attack area when AP’s are powered off.

Shane Baldacchino

Our Front Yard – Landscaping And Lasers

Landscaping our house has always been something on the cards for our family but it was placed on the back burner due to differing priorities. It wasn’t until our body corporate put this on the agenda did we get pretty serious about it.

Whilst technically I find I can learn grasp most things life, design is not something I have a flair for. We didn’t want a different look for different areas of the house. We engaged award winning Apex Landscapes to design landscaping for the entire house. Our brief was
– Integrate technology in to it, make it a tour de’force
– Little or very little maintenance (read no wood)
– Look high end and really stand out for the right reasons
– Something different to other houses in the estate

We had a front that looked like this

They envisaged it would look like this

From laser leveling to CAD designs, Apex Landscapes are the most professional company I have dealt with with spectacular attention to detail. This kind of meant their price with to date and their prices reflect it. After receiving our designs and their implementation quotes we needed to figure out a way to so most of this ourselves as we simply couldn’t afford the implementation price. We decided we would do everything but the hard landscaping of the front yard. We settled on ‘The Blake Escape’ to perform the hard landscaping of our front yard with myself tackling
– irrigation
– electrical (design, relays, programming, sensors)
– soil works
– planting
– steelwork (letterbox CNC)

Bill of Materials
I wont be costing this out (probably due to embarrassment) but suffice to say this project ran in to 5 figures many times over. It involved the following high level items
– 1 x Landscape Design (Surveying, CAD design)
– 1 x Excavation
– 1 x Exposed Aggregate Driveway
– 3 x Carpenters
– 3 x BrickLayers
– 5 x Landscapers
– 9 x CM3 Of Concrete
– 1 x Bobcat
– 4 x Pallets Of Honed Blue Stone Pavers
– 7 x M2 of Blue Stone Crazy Paving
– 4 x Pallets of Bessa Blocks
– 2 x Pallets of Ledgestone Hotham
– 13 x m3 of soil
– 50 x m2 of turf
– 23 x Lengths of Electrical Conduit (Combination of 25mm and 32mm)
– 50+ x Electrical Conduit Adapters (Bends, Elbows, Couplers)
– 150m x 13mm of Low Density Poly Pipe
– 50m x 13mm pressure compensating dripper
– 1 x Antelco EzyValve 4 Solenoid Valve Controller
– 1 x Brass Pressure Regulation/Filtration devices
– 500m of figure 8 electrical cable (lighting)
– 150m of 8 core electrical cable (relays)
– 100m of 6 core electrical cable (sensors)
– 100m of 4 core electrical cable (sensors)
– 5 x Omron 12V DC switching relays
– 8 x Optical Isolaters
– 2 x PNP Through Beam Laser Photo Switches
– 1 x PNP Photo Electric Switch
– 1 x Laser Cut 6mm Steel Plate Letterbox Cut Out
– 13 x Havit LED EyeLid Lights
– 6 x Havit LED Spot Lights

This project has taken approximately 9 months to complete and the following steps are compressed

Step 1: Do the Thinking Up Front
Every company I spoke to about the build told me this was such a technical design with more than a few shying away from the job. Being technical I knew that it would be much harder to retro fit my grand plans after build. I sat down and designed the irrigation, lighting and sensors.

Step 2: Run Cable Umbilical
Three is a lot going on in our yard with everything being driven from a PLC in the garage. It’s not really practical to drive 20+ lights, sensors and solenoids directly. The plan was to run multiple 8 core cables to my letterbox area for relay control and power distribution. There would be a rail o of 20AMP 12v DC that would be switched via relays which are controlled by the PLC.

Cables were ran through the garage roof and out via a junction box before disappearing in to conduit heading towards the future letterbox.

Oscar was a great help

Shane Baldacchino

Afraid.org (DNS) Windows VB Script Update

Whilst very busy I host a handful of websites for friends and family from my garage fibre connection. The thing is my ISP doesn’t provide me an a static IP address. This is obviously an issue when hosting websites.

This can be solved in one of two ways
1. obtain a static IP address either by changing your ISP or plan (if possible)
2. change your A records when your public IP address changes.

I elected to go with option 2.

After evaluating providers our there I settled with Afraid. The clinching factor was the ability to change your A records via an API call over HTTP. Other providers lacked this feature and the 5 years now I have been using Afraid and they have been rock solid with no apparent outages.

Afraid provide multiple ways to update your A record via HTTP but really its more focussed around Linux and the examples other people have written are cumbersome batch files

With hosting multiple sites I wanted a better more streamlined way to update my A records. For that purpose I wrote a VBScript that can be scheduled in Windows.


' **************************************************
' * Author - Shane Baldacchino *
' * Version - 1.0 *
' * Email - shane@baldacchino.net *
' * File Name - DNS_Public.vbs *
' * Script Language - Microsoft VB Script *
' * Creation Date - Thursday 18th, September 2014 *
' * Modified Date - Thursday 18th, September 2014 *
' **************************************************

'---------------- EDIT BELOW THIS LINE --------------------------------
'Versions
ScriptVersion = 1.0

'Domain 1
Set objHTTP = CreateObject("Microsoft.XMLHTTP")
'Replace the GET URL to that of what is listed in Afraid.org for your domain
objHTTP.open "GET","http://freedns.afraid.org/dynamic/update.php?xxxxxxxxxxx", False
objHTTP.send
'Replace 'domain 1' with your domain name
wscript.echo now & " | domain 1 - " & objhttp.responsetext

'Cut and paste the above to add in multiple domains
'---------------- DO NOT EDIT BELOW THIS LINE -------------------------

Execution can be performed by using the cscript VB compiler.


cscript DNS_Public.vbs

Which yields the response in my case of


C:\Archive\Scripts>cscript DNS_Public.VBS
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

17/12/2014 1:36:35 PM | domain 1 - ERROR: Address 124.168.106.85 has not
changed.

17/12/2014 1:36:35 PM | domain 2 - ERROR: Address 124.168.106.85 h
as not changed.

17/12/2014 1:36:41 PM | domain 3 - ERROR: Address 124.168.106.85 has n
ot changed.

17/12/2014 1:36:42 PM | domain 4 - ERROR: Address 124.168.106.85 has n
ot changed.

17/12/2014 1:36:42 PM | domain 5 - ERROR: Address 124.168.106.85 has
not changed.

A copy of this VB script can be downloaded here

Shane Baldacchino

Installation And Integration Of Open Sprinkler and Homevision Pro

Before we started landscaping I had grand plans for irrigation for our house. It was borne out of two desires.
1. With a growing busy family I can’t guarantee that our plants and lawn can be watered
2. Because I can

What quickly became apparent on my home automation journey is that the more sensors I had connected to my Homevision Pro the more powerful my decision logic could be. It was for that reason alone I didn’t want another system separate to the Homevision Pro calling the shots.

I looked at using the Homevision Pro but didn’t really want to waste valuable output ports and upon reading a website I regular read I elected to use a product, . OpenSprinkler. What drew me to OpenSprinkler was that it was an irrigation controller that was TCP/IP enabled and after more investigation I figured I could make simple HTTP GET’s to control the system. Opensprinkler is a great product but it is also quite basic in its logic. It can water based on timers and a rain sensor. But it cant water based on more advanced weather conditions.
– If today is going to be 40C do we need to alter how much water is being dispersed and at what time
– If it rained 7mm of rain over night but isn’t raining when the cycle is set to start do I really need to water?

So whilst I am a big advocate of OpenSprinkler I decided to just use it as a ‘dumb’ TCP/IP irrigation controller and let Homevision Pro call all the shots.

Bill of Materials
– 1 x OpenSprinker ($180AUD)
– 1 x 24V AC PSU ($30AUD)

Total Cost = $210AUD

Tools used
– Soldering Iron
– Pliers
– Screw Driver
– Multimeter

Step 1: Mount and Connect to Network / Valves
Being a small unit I elected to mount OpenSprinkler inside my Homevision Pro enclosure. There was just enough space inside this enclosure for a nice neat snug fit. Ethernet, power and valves were all connected to OpenSprinkler. That’s about all there is to do for physical installation. The rest of this is in the logic.

Step 2: Figure out how OpenSprinkler works
OpenSprinkler is simple to use. The thing is I want to make calls to it that my browser or smartphone application makes. I used Firebug which an excellent Firefox plugin and this showed the following structure

GET http://OpenSprinkler_IP + Station Name + Status ON / OFF + seconds

which translates to

GET http://OpenSprinkler_IP/sn1=1+120

The above GET will cause station number 1 to turn on for 120 seconds. It is a simple as that.

Shane Baldacchino