Thursday, 31 May 2012

Automatic Garden Watering

It's been super hot in the UK recently but luckily I've been able to use my LightwaveRF kit as part of an automated garden watering system.

I store the water in my water butt (very environmentally friendly) and have purchased a Hozelock "Butt Pump", a mains powered pump which sits in your water butt (see below).


The pump is mains powered so I've simply run an extension reel out to my greenhouse and used one of the LightwaveRF socket adapters, (see below).


So the pump then pumps water from my water butt in to my greenhouse.  Using kit from Hozelock I can then set up a system to water the stuff in my greenhouse:



And also my veg patch:

Then using LightwaveRF timers (which you set up on the web interface) I can simply set the pump to come on in the evening, run for 5 minutes and then switch off.  Easy!

Tuesday, 24 April 2012

Power Measurements and the UDP Interface

More reading of the LightwaveRF forum led me to discover a command that allows you to interrogate the WiFi Link unit to get power measurements.  I want to use this as, although the handset app and web interfaces give you instantaneous measurements, you can't track usage over time.

So if you send the command 123,@?\0 in a UDP message (see previous post on how to do this) to the WiFi Link you get a response along the lines of 123,?W=150,7710,3148,14970.  Here:
  • 150 is the current instantaneous power measurement in Watts
  • 7710 is the maximum power measurement for the current day (in Watts)
  • 3148 is the cumulative usage since midnight that day (in Watt Hours)
  • 14970 is the total usage (in Watt Hours) for the whole of the previous day
Based upon this command I knocked up a Visual Basic application that takes one of these measurements every minute and logs the resulting information to a text file.  Now the application is working on my Vista PC which is crumby and unreliable and it's also my family PC so there's a good chance of it being stopped.  However if I can get the application to run for long enough I can perform some interesting long term usage analysis.

Here's a graph I put together using this data:




Max_Day (blue series) is a day when the whole family was in and we had another family visiting us (so lots of cooking, making cups of tea etc).

Min_Day (red series) is a day when we were in and out in the morning up to lunch time and then went out in the afternoon and evening.

So on the Max_Day you can see:
  • Minimal usage through the early hours
  • First cup of tea of the day at 0630 is
  • Big lunch so lots of usage
  • Even bigger tea (between 1900 and 2000) so even more usage
  • To bed just after 2200
...and on the Min_Day you can see:
  • Slightly later breakfast but lasted longer (probably something cooked)
  • A light lunch
  • Out in the afternoon and then in to the evening so minimal usage
  • Back just after 2200, a bit of usage then off to bed
So for me very interesting as I can see explicit links between what I do and the resulting usage. 

Looking at the cumulative measurements (see below) are also interesting:


So as expected the lines (so usage) are similar for the early hours but then diverge significantly.  Min_Day is also interesting as it highlights the quiescent or steady state usage of my house through the things that are always on.

Focussing in on a shorter time period for the absolute measurements is interesting:

You can see that usage is broadly quantised which I assume is down to things like my fridge and freezer kicking in and out.  It shows my houses steady state is roughly 270 Watts.

So overall this is all very fascinating to me.  The power meter and the ability to log measurements gives you excellent visibility of the cause and effect of using electrical items.  Additionally, the steady state measurements show how important it is to look at the energy rating of electrical items before you buy the,.


Sunday, 8 April 2012

The UDP Interface

A bit of Googling on all things LightwaveRF led me to this site.  It' someone's Blog where they describe how to control the LightwaveRF WiFi Link box using commands in UDP segments.  Very interesting and perhaps a way to get around having to use LightwaveRF's software, (which has distinct "improvement opportunities").

In simple terms you form a UDP segment with a LightwaveRF command in it, send it to the WiFi Link (which listens on port 9760) and, hey presto, it executes the command.

Example: The command “000,!R1D1F1|” means room 1 ("R1"), device 1 ("D1"), switch on ("F1").  Conversely “000,!R1D1F0|” would mean switch off.  The "000" is a command reference, (so you increment it for each command in turn).

I thought I'd have a play myself using the only programming language I've any recent experience in, Visual Basic.  Imagine my delight when I found out that Microsoft now provide free "Express" versions of Visual Basic, C# and C++.

So dusting off my Visual Basic knowledge I hacked together an application that can send UDP segments to my WiFi Link. I've used the Winsock control before for IP/UDP/TCP stuff but in the latest version of VB (Visual Studio 10) you have to import the system.net.sockets object.  The example at this MSDN page was what I used as the basis of my code.  

With a bit of trial and error I worked out that you need to:
  1. Bind a UDP socket to local port 9761*.
  2. Form a UDP packet with the LightwaveRF command in it.
  3. Send the command to port 9760 on the IP address that you WiFi Link is on.  (Both PC and LightwaveRF were on my LAN so I just used the private IP address that had been allocated to the LightwaveRF).
  4. Wait for the response which is in the form of  “000,OK”
....and the command is executed by the LightwaveRF WiFi Link.

* This was the hardest thing to find out.  The LightwaveRF sends all response packets back to port 9761, no matter what port you send from.  I needed to download and install Wireshark to spot this.

When you first send a command from your PC, a prompt comes up on the WiFi Link asking you to confirm access from this particular IP address.  A security feature I guess and you confirm access by pressing a button on the WiFi link.

I was intrigued by the pipe ("|") character in the command and a but more tinkering showed how you could get extra messages on the LED display of the WiFi link by extending the command.  For example "“000, !R1D1F1|Study|Dehumidifier” would mean "Study" and "Dehumidifier" appear on consecutive lines on the WiFi link. 

Looking around the LightwaveRF forums there's lots of talk of the LightwaveRF "UDP Protocol".  So more investigations and updates on this later...

Monday, 26 March 2012

Power Meter Accuracy - Another Update

So I've left it just under a week since JSJS Designs got back to me to say they'd updated the WiFi Link and that should make it more accurate.

Here are the results.

Over the period my proper meter states I've used 75kWh.
Over the period my LightwaveRF states I've used 69.9kWh.

So the LightwaveRF readings are now under to the tune of 6.8%.  More accurate than the measurements I took before (it was 31% over).

I will continue to monitor...

Tuesday, 20 March 2012

Power Meter Accuracy - Update

I raised a support ticket with LightwaveRF on the accuracy of the power meter. Here's the response I got, (within 12 hours so good timely responses).

Hi Paul,We released WiFiLink version 2.28 yesterday which has adjusted the way the energy monitor calculates usage. The readings are in kWh, yes. You should get better accuracy from yesterday onwards, but be aware the figure given is an only an approximation.Max is kW, whilst the Totals are in kWh.Let me know if this helps!

I did spot the upgrade to 2.28. So another round of measurements, let's see if it's more accurate now.

Monday, 19 March 2012

Power Monitor Accuracy

For the last week I've taken some measurements to see how accurate the power meter is. To do this I:

  • Took a reading from my proper electricity meter when I installed the power monitor.
  • Noted the daily measurements from the power monitor for the remainder of that day and the rest of the week.
  • A week later took another proper meter reading and noted the cumulative measurement up to that point.

Results:

My meter readings state I used 111 kWh
The power meter readings state I used 145 kWh

So a 31% error.....

I will contact LightwaveRF support as this can't be correct. Another update when I know more.....

Thursday, 15 March 2012

Feel the Power!

On Sunday I installed the LightwaveRF power meter. The picture below shows it outside it's lovely packaging. The power meter consists of two main parts. The clamp that goes around your live AC feed (on the right in the picture) and the sender unit (on the left). In simple terms the clamp measures the power usage and the sender sends the measurements to the WiFi link unit. The sender unit takes 2 AA batteries and sends a measurement every 10 seconds.
Here's a close up of the clamp. It looks to have some form of magnet inside. I'm not clamp meter expert so see Wikipedia for an explanation of how they work!

Here it is installed in my meter cupboard, clamped aroind my live AC feed. The sender unit nestles on the bottom.




To pair with the WiFi link you just put the sender into learning mode (press and hold a button) and select an option on the UI of the WiFi link. When paired you get the latest reading from the sender always shown on the WiFi link screen.




You can view the measurements on the web interface or via the handset app (example shown below):


You get:

1)Current power consumption (in kW).

2)Max usage for the past 24 hours (in kW I assume but no units shown - naughty).

3)Cumulative usage that day (in kW Hours I assume but no units shown).

4)Total usage yesterday (I assum ein kW hours).


The dial refreshes every 10 seconds or so with a bit of animation, very nice. The warning states it could be 20 secs out of date which is about right in practise. Flick the kettle on and the dial goes up to about 3.5kW within a short period of time, (off the scale of the app UI in fact which is a bit poor).


More later on the energy meter...