LauraCowen.co.uk

Laura's view from her world

Electricity monitoring with Christmas lights and Arduino

February9

This was my geeky Christmas project:

What’s happening in the video…

The red/orange lights flash faster when the electricity usage in my house increase. The green/blue lights flash faster when the electricity usage in my Mum’s house increases (though in the video, the usage stays at a constant level so the lights don’t speed up).

Initially, the lights are flashing at the default reading of 1 kW. Then as the electricity usage levels vary, the red/orange lights start to flash out of sync with the green/blue lights. After a short time, though, I switch the kettle on (you can just about hear it in the background!) and you can see the red/orange lights start to flash a lot more quickly (as the kettle takes about 3 kW on top of whatever the current reading is). The lights slow down again as the kettle switches off.

How does it work?

In my house I have a Current Cost monitor, which reads the live power usage of the house and publishes it (using IBM messaging protocol MQTT) to a server on the Internet. An application on my laptop (to which my Arduino – small circuit board with a processor on it – is connected) subscribes to the readings in real time and passes the information to the Arduino. The Arduino does some calculations to convert the readings to speed of flashing so that the higher the reading, the faster the lights flash. The Arduino uses that speed calculation to control the relay switches connected to the Arduino, which in turn control the power to the lights – when the relay allows power to the lights, the lights come on; when the relay cuts the power to the lights, the lights go off, and so on.

This slideshow on Slideshare shows the overall connections between all the parts, and some pretty pictures:

tagged with:
posted on 2010-02-09 at 01:02 pm in Making Things, Open Source | 7 Comments »
7 Comments to

“Electricity monitoring with Christmas lights and Arduino”

  1. Avatar February 9th, 2010 at 1:51 pm Kirrus Says:

    What do you use to link the current cost meter to the internet? :)


  2. Avatar February 9th, 2010 at 2:27 pm Philip Stubbs Says:

    How easy is it to get the Arduino to talk to Linux? I have just acquired a huge bag of LED’s, and fancy having a go at making one of these :- http://www.youtube.com/watch?v=81DjwWqE6Iw&NR=1&feature=fvwp


  3. Avatar February 9th, 2010 at 5:19 pm Laura Says:

    Current Cost is linked by USB serial cable to a (Linux; though could be Windows) server in my house. On the server is an MQTT client, which publishes readings to an installation of IBM’s Really Small Message Broker (but could in future be the open source Mosquitto) on an external server on the Internet somewhere (not hosted by me).

    Take a look at MQTT.org for more information about the MQTT brokers and clients. The MQTT client I use isn’t freely available but there are others.

    Note that the Arduino MQTT client on that page is only for if you have an ethernet/wifi shield on your Arduino that can access the Internet directly. I don’t use that because I connect my Arduino to my laptop and have an MQTT client on there too which can connect to the external server to subscribe to electricity readings. Which means I always have to have my laptop on when using the lights, of course.

    I’m not sure if all that makes sense but reply if not and I’ll try to write a blog post explaining it more clearly.


  4. Avatar February 9th, 2010 at 5:21 pm Laura Says:

    Getting the Arduino talking to LInux in order to program it? That’s easy (on Ubuntu at least). The Arduino.cc has a page on what you need to install – think it’s all in the Ubuntu repositories now. Not sure about other distros.

    The Arduino has USB serial connection to laptop which just works in my experience.


  5. Avatar February 10th, 2010 at 10:09 am Philip Stubbs Says:

    That was what I was after. Thanks very much.


  6. Avatar February 10th, 2010 at 11:56 am Kirrus Says:

    Ditto, that helps, thanks :)


  7. Avatar February 11th, 2010 at 12:32 am Mum Says:

    How do we get the green/blue lights flashing?


Email will not be published

Website example

Your Comment: