5 Jan 2009

I spoke at Homecamp recently about how an ambient orb could be used to monitor home energy usage. I’ve finally gotten around to putting some of it into practice so thought I would share some of the details of the setup as well as some more of my thoughts on the subject.

There are three key pieces of hardware in use. The Viglen MPC-L is the heart of the system. As I’ve mentioned previously, this is a low powered linux box running Ubuntu. The CurrentCost meter is connected to the MPC over USB-serial and my trusty arduino acts as an integration point for homebrew toys – including my ambient orb.

The MPC is running a Really Small Message Broker (RSMB). This is a small-footprint pub-sub message broker that talks MQTT. Each time the CurrentCost sends out a update, a piece of perl (“cc_pub.pl“) parses the data, sticks it into an RRDTool database for graphing and also publishes it to the home/cc/power and home/cc/temp topics.

Another piece of perl (“orbcontrol.pl“) is subscribed to the house/orb topic. When messages arrive on that topic, they are passed over serial to the arduino.

The sketch on the arduino currently listens on its serial port for commands that are then passed to the BlinkM in the orb. The format of the commands is identical to those in the BlinkMTester sketch that comes with the BlinkM. In the future this will do more as more things are attached to the arduino.

So far I have described how the orb is controlled and how the power data gets into the system. The next piece is how the two are plumbed together. Unsurprisingly, yet another perl script is running the on the MPC that provides the glue for this mixed metaphor.

orblogic.pl is subscribed to the home/cc/power topic so it receives all of the updates from the CurrentCost. It then makes a decision as to what colour the orb should be and then publishes the appropriate command to the house/orb topic.

Orb setup sketch

That is pretty much it – simple eh? Well, I did skip over the most interesting part – how to decide what colour the orb should be.

There are two key philosophies that come into play here:

  • Alert the unusual – have the ‘default’ state be the least obtrusive, such as ‘off’
  • Band the data – don’t react to single-point changes in the value. For example, when monitoring temperature, nothing is worse than constantly saying “its 19°C, its 18°C, its 19°C…”

These points should be applied whenever thinking about how to turn a raw stream of data into a useful stream of information.

I currently have a very simple piece of logic controlling the orb:

  • If power < 400, turn the orb off
  • If power between 400 and 1000, turn the orb orange
  • If power > 1000, turn the orb red

When we’re sat in the living room watching TV, we typically use under 400 watts, so the orb will only show anything if we’re over this value. It is very unusual to go over 1 kw unless we’re cooking, which is why that gets a stronger alert.

powergraph sketch

Despite its simplicity, this has already had the effect of making us more aware of when lights have been left on or when the kettle has finished boiling.

But as with all things, it could get much smarter. Having said we typically use under 400 watts watching TV, I also made the caveat ‘unless we’re cooking’. Given the system has a history of our power usage, it could feasibly determine suitable bands dynamically – so going over 1 kw between 6pm and 7pm isn’t necessarily a bad thing. Also, it chould only go red if the value goes over 1 kw for more than the time it takes to boil the kettle.

It all comes back to determining what is ‘unusual’.

  1. James TaylorJanuary 5, 2009

    I keep thinking RRDtool should be able to help with determining what’s (un)usual in a smarter way, but I haven’t as yet actually figured out quite how.

    Alternatively, Dale’s current cost gui does some averages which would be useful. It’s be nice to do publish those averages to a suitable topic… not actually got round to doing that either!

    Like the illustrations by the way.

  2. nickJanuary 5, 2009

    I agree about RRDtool – I have only got so far to emulate what others have done with it. My attempts to extract values outside of this have been less than successful.

  3. JamieJanuary 5, 2009

    Great post Nick, Thanks for taking us through your setup, I’m a big fan of this type of monitoring but there is still one problem for me.

    Does this mean that you need to have your Arduino (and consequently your orb) near your MPC-L which, is presumably in a cupboard somewhere? This would be a problem for me because wires and exposed Arduinos do not tend to win over the hearts of other members of the house.

  4. nickJanuary 6, 2009

    Thats a good question Jamie. The MPC-L is tiny – smaller than a Mac Mini. It is also fanless, so essentially silent. This means it doesn’t have to live in a cupboard and is relatively easy to hide near the TV (depending of course on what your TV is sat on).

    Currently, it is all hidden behind the TV. This may look messy from above, but it isn’t visible from the front. You’ll also see I’ve boxed up the arduino.

    This is temporary until I find the time hide it all in the unit beneath the TV.

  5. pingback from knolleary » Blog Archive » Nokia LCD Shield for ArduinoJanuary 10, 2009

  6. pingback from Delphi can do MQTT too!February 23, 2009

  7. TDG • April 18, 2009

    Where did you get the semi-opaque globe casing for? Looking for a good cheap supplier in the UK

  8. nickApril 18, 2009

    @TDG – the casing is from a garden light sold by Marks and Spencer for £3.50. I bought a set of them at the end of last summer when they we’re doing 3 for 2.
    I’ve seen them back in our local shop just last week. At that price, I’m tempted to buy a bunch of them:)

  9. TDG • April 19, 2009

    Nick – genius!

    I’ve been searching for ages and almost thought about buying sheets of acrylic and shaping my own (doubt that would’ve ended well)… never even thought about garden lights

    I’m assuming it’s this one: http://www.marksandspencer.com/gp/product/B000NK7G04

    I live right next to an M&S so I’ll pop in and see if they’ve got any, I’m assuming it’s easy to take the bottom off?

    I’ve got myself a working ambient orb/blinkm with ethernet and it’s great 🙂 Just been needing the diffuser…

  10. nickApril 19, 2009

    @TDG – that’s the one. Here are the pieces it dissects into:

    Dissected Ambient Light

    It came apart fairly easily without much effort. Let me know how you get on.

  11. Bo Christiansen • June 18, 2009

    Hi Nick,

    I am not very computer savy. However, I would really like to get a Current Cost cc 128 and put it into a holiday house and then be able to collect the data remotely. Do you have a setup which would do this for Dummies?
    Kind regards
    Bo

  12. nickJune 18, 2009

    Hi Bo,
    it’s certainly possible to achieve what you describe, but I don’t have an out-of-the-box setup for you.

    Does the holiday house already have a broadband internet connection? If not, then you’d have to look at something that would log the information at the house for you to go collect during change-over.

    I’m happy to discuss further – give me a shout at [email protected].

  13. leave a comment

    You must be logged in to post a comment.