Electricity monitoring with Christmas lights and Arduino

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:

[slideshare id=3126633&doc=arduino-presentation-100210132810-phpapp02]


This project got a brief mention in an Imperica article: “A colleague of Piper has built a Christmas lights application using MQTT and Arduino, with the lights changing colour according to energy use in the house.”

9 thoughts on “Electricity monitoring with Christmas lights and Arduino

    1. 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.

    1. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *