Monitoring Home Electricity Consumption with a Raspberry Pi – part 1


A couple of years ago I was lucky enough to be given a Current Cost Energy Meter like the one in the photos below.  This type of device comes with a Hall Effect Sensor which goes around the Live Cable to your Electricity Meter and a display unit.  The two communicate with each other using Bluetooth.

After a while using the Meter and looking at the display, I did quite a bit at home to reduce my electricity consumption, including changing  light bulbs for cost efficient LED ones, I purchased one of these remote controlled plug sets to be able to switch devices (TV, Computer, Xbox etc.) off of standby when they were not being used.

Current Cost ClassicHallEffectSensorI discovered that the Current Cost Classic transmits data out of the socket on the bottom of it.  It looks like an Ethernet connection, but the signal coming out of it is TTL logic serial data.

I decided to see if I could capture this data and do something useful with it.

I purchased a RJ45 to USB cable from the CurrentCost Online Shop and after some “googling” managed to get it to work..

The rest of this blog is about how I used a Raspberry Pi to capture and display the electricity consumption of my house.

Solution Overview

The Raspberry Pi automatically reads data from the Current Cost Meter, processes it, stores it, graphs the data and serves it out on the web to be viewed by a client with a web browser.

I use the following configuration/packages to achieve this:

  • Current Cost Meter via the RJ45 to USB Cable sends data to the Raspberry Pi (Rev 1 Model B) running Rasbian via one of the USB Connectors.
  • The data is captured, processed and stored in RRDTool using PySerial and some hand cranked Python code.
  • Using automatic cron jobs RRDTool is used to create graphs which are dropped into the structure of the simple website being served by the Raspberry Pi.
  • Lighttpd is used to serve the Website to my home LAN
  • I have used port forwarding on my Broadband Router to enable me to view the website from the Internet i.e. work etc.  The website is password protected. For reasons which will become clear!

Website Design

I deliberately kept the web site design very plain and very simple to ensure that the Pi is not overloaded and also so that the site can be viewed from PC”s, iPad and also Android phone.  And actually I am not very good at html!

Home Page

Home Page

This is what the site looks like, a front page, links for Electricity Consumption for the last 10 mins, 2 hours, 4 hours, last day, last week and Temperature in the last day (the Current Cost device has a temperature sensor in it).

And alongside are examples of the other pages of the website.






Last 10 minutes

Last 10 minutes

Last 4 Hours
Last 4 Hours

Last day
Last day

Last Week (incomplete)

Last Week (incomplete)



RRDTool allows to do calculations on the data, and therefore for the graphs I compute the Average and the Maximum.  This is not too noticeable on the shorter timescale graphs, but you begin to notice the effect on the graphs for the last day and the last week.

Also I calculate the load factor, which is expressed as a percentage on the graph where 100 = a load factor of 1.

The Load Factor is normally at 100 until something with a motor switches on or off.  This is most obvious when the Washing Machine motor switches on, but I have also seen the load factor change when the central heating pump comes on and the compressor for my two fridge/freezers.

The Current Cost display spits out a reading every 6 seconds, which means it is quite good at capturing peaks or spikes in energy usage.  This means that for example it is possible to start to identify what appliances are being used in the home, by their signatures.  This includes items like Kettles, Irons, Fridge Freezers etc.

The corollary of this is that, with a little bit of knowledge, it becomes possible to know if a house is occupied or not.  This can be used for positive or less positive reasons.  If you are on holiday you might not want to see your kettle being switched on! Equally if  you are monitoring the electricity consumption of an Elderly relative or friend you might want to check that they have made their cup of early morning tea by 10am.

It is for these reasons that the website I created is password protected.

In the next blog post I will go into detail on how to setup your Raspberry Pi to monitor your electricity.

This entry was posted in Energy, hacking, Raspberry PI, tinkering. Bookmark the permalink.

9 Responses to Monitoring Home Electricity Consumption with a Raspberry Pi – part 1

  1. circulosmeos says:

    I’m very interested in this set up!
    If I’ve correctly understood it, the clamp is plugged to the wireless transmitter, which communicates with (could you tell the distance just for reference?) the display you’ve shown, which in turn is from which the rj-45 to usb cable plugs to the RPi, which must be near this display. I suppose the display must be connected to AC, and that the trasnmitter uses batteries. Is all of this correct?
    Also, now the CurrentCost Online Shop sells a “Current Cost White TREC Energy Monitor” not exactly the one you purchased… but it should’ve the same output, as they still sells the RJ45 to USB cable. Do you know if this is correct?
    thanks for your time and congratulations for your work!

    • Gaz99 says:

      Hi, thanks for your kind comments. The Clamp and the transmitter block are in the Meter cupboard, it has a ten year battery I think. The block is paired to the current cost display using Bluetooth. So it will work over Bluetooth range. In my setup the Meter is on the outside of my garage wall and the Display is in the hall which is about 5m away line of sight and “through” two brick walls. The display uses a “wallwart” type plug to power it (so it needs a mains socket).

      Regarding the TREC, the specifications are here. It looks like it uses 433Mhz to talk to the transmitter block. If you manage to get any XML output from it, post it as a comment and perhaps I can help adapt my script to parse it. (unless of course, you want to do that 🙂 ). Regards.

  2. Pingback: Home Energy Centre using Raspberry Pi and Nook Simple Touch | piamble

  3. Julian says:

    Amazing, clear write up! I too am very interested in this setup.
    Following your guide, I’ve hooked up my Envi-R power meter to my Pi, had to change a couple of the settings to get it to read in the data but other than that it works exactly like your system. I’m having a weird problem whereby the Pi only seems to record power usage for ~1.5hrs after turning it on, anything longer and it just doesn’t seem to record (or doesn’t display on the website). Forcing a reboot every hour solves the problem (if you can call that a solution!).
    Any ideas why it might be acting this way?
    Thanks for the great guide!

    • Gaz99 says:

      Hi Julian, thanks for your kind words. Glad you found it useful. you could try running the script with the DEBUG variable set to 1. This will give extra output, perhaps the script is crashing. Also Ensure the Pi is not overheating. Is it in a enclosure or does it have free air flow around it?

      If you get any extra info, post a comment.


  4. gazzat5 says:

    Hi, nice blog post!
    The current cost transmitter actually uses 433mhz via a rfm02 (transmitter only version of a rfm12b, see .) rather than bluetooth.
    The range is fairly good in my experience, I have reliably used it between a garage and the second floor.

    In my setup I skipped the rj45 to usb cable after I broke the usb connector. I ended up wiring it directly to the serial rx, 3v and gnd pins on the pi, since these run at 3.3v anyway.

    My code uses a python script to grab the xml from the serial port and then sends it to xively, and I’ve found it usually crashes during the history output of the display (one minute past odd hours). since I’m no longer at uni I dont have the free time to debug the code so I cheated and wrote a bash script to restart the python script whenever it died, in an infinite for () loop.

    • Gaz99 says:

      Hi gazzat5 thanks for posting the above. Sounds good. Any chance you could post a link to your code and share it with the other readers on this blog? that would be great. (don’t forget to remove any API keys/userid’s / pwds though!)

  5. Mariyan Davidov says:

    how you read data (485) from device.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s