“We never know the worth of water till the well is dry” – Thomas Fuller

Between the increasing population density in my part of the UK, an apparently ever increasing demand for water (150 litres per person per day, apparently) and the impact of climate change, our water supplies are becoming a lot less predictable. In my part of the UK (Hampshire) we have been seeing real problems with water shortages during the summer for the last decade or so.

The response from the relatively newly privatised water industry has been to unceremoniously raise prices to cover the cost of “improvements to the infrastructure”, and “years of under-investment”. To be fair to them, the official statistics say that their network is leaking a lot less water than it used to. Unfortunately the average house-owner (well, OK, me!) hasn’t noticed any changes whatsoever – except in the charges. Until last month.

Southern Water are in the vanguard of charging for water by usage, by installing water meters, rather than linking payment to relative size of house. This clearly penalises larger families in smaller houses, though the water company would prefer to suggest that it promotes sensible water usage, and is fairer to everyone. I really can see their argument, but as the owner of what I have always felt to be a relatively modest house, shared with four squeaky-clean women, the thought of being put on a water meter has always made my blood run cold.

But there was only so long that I was able to resist … and last month, the water company swapped out my existing stop-cock in the street for a new one with an integrated water meter. No choice, simply a fait accompli. My initial (tight-fisted) thought was to initiate rationing, but somehow common sense prevailed and I’ve let normal life run its course for the last month with no real mention of this change to my family.

And today I went out into the street, and prised up the cover from the water meter to read it. This in itself was irritating because, despite being a smart meter that can be read remotely, Southern Water don’t issue us with the means to do that, and the meter-manufacturer considers the protocols to be “proprietary” and won’t tell me how to build a decoder. Southern Water will apparently read it every 6 months – which means their (presumably expensive) smart meters are about as useful in changing usage behaviours as the original dumb ones. Which is to say not at all. What a wasted opportunity.

However, at least I got the result for 26 days of water usage, rather than having to wait 6 months for Southern Water to get around to telling me. A further 10 minutes with Southern Waters charging information and a calculator results in the news that …

  • In our house we use about 82 litres of water per person per day
  • That works out at about 150m3 per year, which is significantly to the right side of “average” for a 5 person house
  • If I understand their charges correctly, my annual bill is about to be approximately halved.

I’m not sure whether to jump up and down shouting “RESULT!”, or slink off into the corner for not having elected to have a meter fitted a few years back when it first became an option. But clearly the next action has to be to find a way to read that smart meter in real time, and integrate it into my whole house monitoring, as I did with electricity, using my CurrentCost monitor.

Advertisements

Internet of things

Many years ago, back when I was still writing software for a living, I was involved in creating some software that is now called WebSphere MQ. This was designed to integrate different types of software and systems together, easily and without disruption. I always used to describe it as email for programs. Over time that whole concept was refined and extended, and the basic concepts are now used as the basic building blocks for what is often called the internet of things. This a concept where sensors and actuators are connected together (usually via the internet) so they can be more easily accessed. IBM’s Smarter Planet theme takes these sensors and actuators, and applies intelligence to them, allowing us to gain incremental benefits sometimes even in unexpected areas.

For a long time now I’ve been monitoring various sensors around my home, connecting them to my own internal data network, where I’ve been able to process the output of these sensors in various ways. I’ve been doing this using a protocol called MQTT, implemented on a very simple server, called Real Small Message Broker (RSMB) which was written by a colleague of mine. This has worked really well for my needs, and being designed for embedded use, requires practically no resources to run.

However, some time ago a service become available on the Internet called Pachube (now renamed to Cosm), which is essentially a central clearing house to which anyone can publicly connect and classify their sensors, creating a potentially huge number of datafeeds. These can then be aggregated, selected and reused by other people, giving individuals access to untold numbers of sensors, allowing them to create innovative new services that eventually others will then build further services on. It’s a great concept that I wanted to contribute to. Initially, as a trial, I decided to share the temperature feed from my home office with the world.

To achieve that, I did the following:

  1. Created an account on Cosm.
  2. Defined a datafeed, which I named (“Study Temperature”), tagged with appropriate metadata (“physical”, “temperature”, etc)
  3. I then created and named a datastream to be associated with that datafeed, consisting of a set of single data points (namely the temperature in my study).
  4. I then created an API key to provide access to that datafeed. Normally you would limit the permissions associated with that key, but because of the way I intended to use it, I created a key that would grant complete access to all my Cosm resources.
  5. Since I am already capturing the temperature in my study and feeding it into the RSMB on my home server, I just needed to share that data with Cosm, which I was able to do by connecting my RSMB to Cosm with a Broker Connection, and some topic replication. See this post by Nicholas O’Leary, another colleague, who describes exactly how to do this. Note also my comments, where I conclusively prove that RSMB cannot do name resolution – you can only use dotted-quad IP addresses.
  6. Once the broker.cfg file has been saved, and the RSMB restarted, you should see data starting to arrive in Cosm.

At this point, I added a little icing to the cake. I could see that I was now sharing information to the world via Cosm, but Cosm also integrates with some other services on the internet, which together can be made to give some value back to me. In particular, we experience occasional power outages at our house, and I would like to know as soon as possible if our power has gone out so that (if necessary) I can call our key-holder and get them to flip the power back on and save the contents of our freezers.

Since I now have a permanent connection between my home server and the Cosm servers, I can use a feature of RSMB called notifications. When enabled, this publishes a message to a predefined topic on each broker describing the state of the connection between them. Essentially once a connection is established it writes “the connection is up” to that topic, and each broker tells the other ‘if you lose contact with me, write “the connection is down”‘ to that topic. This means Cosm can have a datastream whose content describes the current status of the connection between my house and Cosm.

So next I use the Cosm web GUI to define another Cosm datastream and datafeed for these notifications.

By then adding a Cosm trigger to that datastream, I can arrange to send a Tweet from Cosm to an account on Twitter. Simplistically I could simply get Cosm to send a Tweet to me. But in practice I have a separate Twitter account for my house (everyone has a twittering house these days) and so I get Cosm to send a Tweet to that account.

Note that when using the Cosm web interface to define the twitter trigger, the results under Firefox were so badly formatted as to not be usable. I swapped to Google’s Chromium browser instead, from which it was possible to actually get the trigger defined and working.

My Twitter account both follows my house’s Twitter account, and has arranged for Tweets from my house’s account to be enabled for mobile notifications (ie, they are sent, at no cost, to my mobile phone as SMS messages).

Finally, I update my RSMB broker.cfg configuration to enable notifications and name the notification topic, and restart RSMB.

What this means in practice is that whenever the connection between my house and Cosm changes (coming up or going down) a message is published to a Cosm datafeed, which triggers Cosm to send a Tweet to my houses Twitter feed, which then shows up on my Twitter feed, and also causes Twitter to send me a mobile notification (an SMS message to my mobile phone) containing the message that was originally written to the Cosm datafeed. From that SMS message I can tell (from anywhere in the world) when a power failure occurs at my house, and when it has been recovered.

Easy 🙂

Just for reference, if you want to replicate this, here is my broker.cfg. Be aware that it will be line-wrapped:

#
retained_persistence true
#
connection cosm
try_private false
address 216.52.233.121 1883
username MRxxxxxxxxxxxAPI_KEYxxxxxxxxxxxxxxxxxxxxxxxx0g
clientid rmappleby
notifications true
notification_topic /v2/feeds/63101/datastreams/0.csv
topic “” out house/temperature/study /v2/feeds/63014/datastreams/0.csv
#

Monitoring resource usage

My recent use of my Current Cost unit to determine whether or not the insulation on my heat store was efficient enough has rekindled my interest in energy monitoring again. And the fact that my gas-powered central heating boiler has broken down made me wonder how hard it would be to measure the gas consumption of my house in the same way that I currently measure my electricity consumption. And if I’m going to do that, then I may as well look at the water usage too. And it may be interesting to combine those with the internal and external temperature.

Since I started playing with my Current Cost, back in 2007, it has become a Current Cost Classic, and there is a new kid in town, the Current Cost Envi, which does everything the Classic does, but has the ability to also independently monitor several individual appliances. It occurred to me that it would be possible to subvert a couple of those appliance monitors to measure the gas and water usage. I suspect that this is likely to confuse the Envi display unit (which will assume that all inputs are electrical) but the XML that comes out the unit and into my home server will allow me to correctly interpret the data and present it as a series of useful graphs.

So on Thursday I acquired a shiny new Current Cost Envi unit in ghastly white, as sadly my supplier didn’t have any tasteful black ones left. I also had a chat with the friendly folks at Current Cost, and thanks in part to the long relationship that we’ve had with them, I’ve acquired a couple of wireless sensor development boards. These have a single simple digital input, which sends a fixed 0 or 500 signal to the display unit on it’s own channel. Not quite as useful as a proper analog setup (which I’m already thinking I could obtain by hacking a current-clamp board!), but absolutely ideal for counting pulses on (say) a gas or water meter…

So the next part of this project is to dust off my (ancient) electronics skills, and work out how to interface one of these boards to my gas meter in such a way that the gas board won’t have kittens next time they read the meter; ie, contactlessly. A few people have already done this, using a variety of different mechanisms, depending on their meter type. I need to spend some time with my gas meter to determine what’s possible, but hopefully I can do something simple with hall-effect sensors, photodiodes or similar.

Water is looking more difficult; I’ll have to buy and install my own flow-meter into the rising main of the house; not sure how expensive that will work out to be, or how I could calibrate it, but I’m sure there must be suppliers out there with lots of information waiting to be read on the internet.

And if nothing else, that would finally settle the discussion over whether it will be cheaper for me to move to a water meter tariff or not!

Efficient insulation

Four years ago I replaced the hot water system in my house with a heat store, which (at the time) was a fairly revolutionary system with some real advantages:

  • mains pressure hot water
  • high capacity
  • enables more efficient boiler usage
  • no cold water tank in the loft
  • no hot water cylinder in the airing cupboard
  • DIY installable

The heat store is essentially a large tank of very hot water, heated indirectly by the boiler. That hot water is then used to instantly heat cold water from the rising main, to provide the hot water for the house. In some ways it operates on similar principles to the hot water part of a combination boiler, except that the heat store is much more powerful (160Kw), allowing it to cope with multiple hot water outlets with ease. It is also potentially more efficient than a combination boiler, as the boiler can run for long efficient burns while charging up the heat store, rather than short on/off burns of the combination boiler while heating water on demand.

In my case, I installed the system in the loft, as it allowed us to reclaim a lot of cupboard space. The system came factory insulated, and it was claimed that it needed no more insulation, even when installed in outbuildings or loft spaces. But I’ve always had a niggling doubt, wondering if I was losing heat to the loft, especially when the weather is cold. But I’ve never been able to prove it to myself one way or the other.

The failure of our central heating boiler this week has given me the opportunity to prove that the heat store is adequately insulated, because while we’re waiting for the new boiler to be installed, I’ve switched the heat store over to electric operation. And electricity usage is very easy to monitor, especially if like me, you happen to have a Currentcost meter.

The heat store has a 3Kw heating element built in, which for the time being I’ve set to run permanently via a thermostat. Whenever the water in the tank drops below 70c, the heating element will cut in and heat the water. Currently the loft drops to about 2c overnight, so if the insulation is inadequate I’d expect to see the heat store lose heat overnight (when we’re not drawing hot water), and for the heating element to cut in, and a 3kw electric load appear on my Currentcost logs.

But it doesn’t. It looks as though the only time I need to top up the heat in the heat store, is when I draw heat off it to produce hot water for the house. Which is good. Incidentally, I believe that the regular “blips” of power usage that are particularly noticeable through the night are caused by the freezer, when the compressor cuts in.

Click the image for more detail:

Power usage proving heat store insulation is adequate

12 hour power usage

Toys!

I’ve been monitoring my whole house power consumption for some time using a currentcost meter, connected up to my home server. However, I’ve been meaning for a while now to pick up a meter for measuring the power consumption of individual devices to help me fine tune my power consumption. This week my local Aldi were running a special offer of a (fairly sophisticated) meter for £8. Turns out that it can measure voltage, current, mains frequency, power consumption, and power correction factor, which indicates how efficient a device is. Since then I’ve been wandering around the house measuring things, trying to work out what we leave running all the time that we actually need to turn off.

So far I have been unable to find a single “wall wart” adaptor that uses *any* measurable power when idle, despite the media talking about how we should all go around and disconnect them all. Things like my powered speakers for my laptop however, draw 10w all the time. Ooops.

And while I was in Aldi I also picked up one of these blood pressure monitors too. I wasn’t sure how accurate it would be, but on trying it out, it seems to give approximately the same readings that I’ve seen the nurses record during my hospital visits. So it may well be surprisingly accurate.

However, my view is that I’m less interested in the actual readings, and more interested in any marked changes in the readings; because if I see any significant increase or decrease then I’ll be needing to go visit my GP anyway.

“Measure twice, cut once”, Anon

As many of you will know, over the last 3 or 4 years I’ve become increasingly concerned with what is often referred to as “Green Issues”, and in particular the environment and how we are impacting upon it. I guess it’s one of the results of getting older and having kids – a case of suddenly realising that what we do now is going to affect them, and even their children. Now this isn’t to say that I’m particularly fanatical; I’d like to think that I’m a pretty pragmatic kind of guy. But I do try to do what I can, even though that’s pretty much limited to trying to reduce my personal impact on the planet, and finding ways to reduce the impact of IT on our planet (this latter one because its part of my day job, working in emerging technology for a large multinational IT company).

So I was really interested to come across this little device recently. Although I’ve seen such things before (usually at high prices), this is the first one that I’ve seen that can handle proper 3 phase supplies, and also has a PC interface on it, allowing it to be integrated with a home automation system.

The companys business model is to sell these (hopefully in huge quantities!) to the energy supply companies, who will then either sell or give them to end-user power-consumers in an effort to help them to reduce their power consumption. This model is being helped (in Europe anyway) by the expectation of legislation that will require energy supply companies to find ways to help energy consumers to reduce their power consumption (and hence CO2 emissions). Unfortunately you can’t (as an individual) buy one just yet, but fortunately (for me) the company I work for is involved in a trial using them, and so I was allowed to buy one at the price an energy supply company would pay. I don’t believe I’m allowed to say exactly what that was, but let me just say that it was a pleasantly affordable deal.

Setting it up took about 60 seconds. Hook the current clamp around one of the meter tails (the wires running from the supply companys electricity meter to my fusebox) and turn on the wireless transmitter. Plug the display unit into my server with a serial cable, and then into the mains for power. Power consumption numbers appear on the display unit – simple as that. I must admit that I’ve not done a detailed check on the unit for accuracy, but a few quick empirical tests show that it’s definitely close enough that I’m happy to believe the accuracy claims on their website.

Reading the data from the serial port is a small matter of a little bit of perl. The data itself is encoded in a tagged text format, similar to XML, which naturally makes it trivial to parse in a perl script. So its easy to extract the interesting bits of information, and store them in a round robin database, where they can then be analysed, graphed, or whatever. In my case I’m extracting the instantaneous power consumption figures for the three cable clamps (even though as a domestic user, I only have single phase) and the temperature at the display unit. This means I can combine the room temp of my study (where my server and the display unit are) with the internal temperatures of my server, and see how external temperature affects those, as well as watching how my electricity usage varies over time.

Of course, the trick here is to use this thing to lower my energy consumption. But that doesn’t really mean to stop doing things. We will still need to run the washing machine, the tumble-dryer, the fridge and freezer etc, and we’ll still want to boil water in the kettle. Because although all of those things take a “lot” of power, it’s power that’s being spent on useful work. Where we can (and should) be concentrating is the “resting” power-consumption of the house. The stuff that’s running 24×7, and doing nothing useful, that could be shutdown. And yet, to my surprise, despite having quite a lot of general stuff that does run 24×7, my base resting power consumption is pretty low (well, compared to some of the other people on the trial, anyway!)

Overnight the numbers are under 200w. And that includes my server, my printer, my ADSL/wireless, my 24 port switch, the central heating controls, the alarm, and a nightlight for the kids, plus a surprising number of “standby items” including alarm clocks, radios, 2xTV, set top boxes, various cellphone and laptop chargers, etc etc. And the big ticket items are the ones that it would be difficult/impracticable (for me) to change – namely the server and its associated support networking. So it seems like we’re doing a pretty good job at the moment, though I think I might try unplugging some of the easily accessible stuff, and see if I can half it.

After all, 100w saving doesn’t sound a lot, but when its over a whole year, that’s 876kwh. Nearly £90 of electricity ($170). And there are 25 million households, and a lot more commercial/industrial establishments in the UK who could attempt this …

If you’re interested, you can see near-realtime graphs of all this data here.