How to build a whole home energy monitor

This page and linked pages detailed below document how to build whole house energy monitor that has a display for easy, quick access to current energy use information, usb datalogging for detailed long term data storage and Internet connectivity for online graphing.

First a quick look at the installed setup:

The Display

The display unit consisting of 4 large green led 7 segments. On the right is a 6 mode – mode chooser so that you can select by turning the potentiometer (bottom – right) whether the display shows real power, apparent power, power factor, RMS Voltage, RMS Current, frequency or cumulative kWh used. The display is connected to the main unit by a cable that goes through the wall at the back of the display.

The Main unit

The main unit is the small box in the far left of pic below with the white CT sensor wire crossing the shelf over to the sensor clipped on to the main mains wire on the right. The main unit contains the Arduino, voltage and current measurement electronics, power electronics, usb pen datalogging and xbee wireless link.

The Ethernet unit

The ethernet unit is connected to the router, the small box on top of the larger box houses the wireless xbee link.

Web based graphing

Below is a screenshot of the web based graphing that can be seen live here.
Graphing is done using flot – a very nice piece of software.

For more pictures of the setup check out the picasa album here.

Main Features:

  • Voltage measurement with step down AC to AC adapter
  • Current measurement with CT sensor.
  • Power for sensor board provided with same AC to AC adapter used for voltage measurement.
  • Calculation of Real power, Apparent power, power factor, RMS voltage, RMS current, frequency, cumulative kWh.
  • Display unit consisting of large green 7 segment display,
  • 6 mode – mode chooser and red/green led indicator to indicate when grid is below and above 50Hz.
  • USB pen data logging using VDIP1 board
  • Xbee wireless link from sensor unit to the Ethernet unit.
  • Ethernet board for logging and graphing on Internet.
  • Flot based graphing on website.

The block diagram below details the overall setup:


How the documentation works

The documentation is organised in such a way that each major part in the above setup is documented independently so that each part can be tested to make sure they work independently. There is then a section at the end about bringing each part together to build the setup above. Hopefully this way it will be easier to troubleshoot when things don't work and it makes it easier to bring the parts together in different configurations and use them for other projects.

Apart from the measurement board each other section has been documented by others to some extent so there will be links to the tutorials that I found useful and I will just add the extra relevant details and adaptations if any.

So here we are:

Measurement board

Note: This guide needs updating to be consistent with version 3.0 of the mains AC- non invasive energy monitor.

The measurement and power board consists of the electronics required to convert the signals from the CT sensor and AC power adapter to signals that are in the voltage range the arduino is happy with. It also contains the electronics required to convert the AC power from the adapter to DC for the Arduino. Currently works with single-phase 2 wire distribution system such as used in many homes in the UK. If you're in the US, have a 3-wire single phase system and would like to help adapt the design for the 3-wire system, please get in contact.

USB data logger board

USB pen drive datalogging is done using a Viniculum VDIP1 usb host controller board and a write start/stop button and indicator to do safely start/stop/remove. It makes it possible to store large quantities of high detail data over a long time.

How to build the Display unit

How to build the 7 segment display using a  MAX7221 and a mode selector using a shift register and potentiometer.

Xbee wireless link

Point to point wireless serial link using Xbee's. Connection between the main unit and the ethernet unit. The Xbee's just relay serial messages between the arduino's and so wire connection can be used instead of the xbee's without changing the arduino sketches.

Ethernet unit and web based Flot graphing.

How to send data to a mysql database using the ethernet shield and a perl script on the server and then how to access the data in the database with flot for graphing.

Bringing it all together

Once you have each section above working independently, the next step is to get it all working together. The wiring diagram below shows how each major part is connected together and how the IO of the Arduino's are configured:

The pictures at these links may be of use when deciding how to route wires and position the various parts:

Main unit assembly | Installed energy monitor | Measurement board assembly

And here's a short description of how to build an enclosure

Arduino Software

Here are the full arduino sketches for the main and ethernet units. They are made up of the stand alone sketches from each section above. So if your just wondering how one part works or want to take say the usb data-logger part and use it in another project then have a look at the stand alone code.

I tried to annotate them as best I can so I wont go into how they work here, but let me know if anything is not clear.

Download: MainSketch27Jan.tar.gz

Download: EthernetSketch27Jan.tar.gz


Full parts list

Here's the full part list, it contains links to suppliers (mainly farnell), part prices and alternative parts to try to bring the cost down.

Google Docs part list

Quick cost breakdown

Measurement Board: £12.68
Xbee link: £54.32
Xbee link cable: £0.57
DataLogger: £15.44
Display: £19.56
Display cable: £1.53
Ethernet shield: £29.00
2 Arduino's: £41.16
Total: £174.25!!!

Thats a bit steep I know! and so Ive been looking at how to bring it down a bit. If the Xbee wireless connection is replaced with an simple RF link, the nuelectronics ethernet shield and arduino's are used and a display based on an SAA1064 driver chip, the overall cost can be reduced to £91.71. I've added further detail's on the alternative components inclucing links to suppliers and tutorials in the spreadsheet. Im hoping to get a chance to have a go at making a cheaper version soon as I may be building an energy monitor for the local community center here and so I will update as soon as there are any developments.

block.png33.56 KB
EthernetSketch27Jan.tar.gz1.92 KB
MainSketch27jan.tar.gz7.59 KB
Ragnarok's picture

Re: Home energy monitor

is it possible if we change the output of the Xbee linking to a GSM module so that the design would be SMS based??this is the concept our group have.. :D

Ragnarok's picture

Re: Home energy monitor

Hello, i am trying to build this power monitor here in the philippines, is there any available schematic diagram by this time?tnx for the help!! :)

Ragnarok's picture

Re: Home energy monitor

Hello, i am trying to build this power monitor here in the philippines, is there any available schematic diagram by this time?tnx for the help!! :)

electrosv's picture

Re: Home energy monitor

Hello, where i find the schematic and .hex for this project?

TrystanLea's picture

Re: Home energy monitor

 Im afraid there is no schematic for the project as a whole, but each module is independantly documented either with schematics from me or linked to schematics of that particular part by others on other sites. 

Guest's picture

Re: Home energy monitor

Does this sketch incorporate all the sketches of the Xbee, data logger, display, measurements?? because when I open it, it opens all those together, so are they run together?

Guest's picture

Re: Home energy monitor

Dear all,

I am trying to download a sketch, i.e. for example MainSketch27Jan.tar.gz
How do I install and open them in Arduino pls?


Guest's picture

Re: Home energy monitor

you just have to open them with winrar and then just run them

yzf600's picture

Re: Home energy monitor


I love this site! Thanks for putting all the info on here.

I'm working on developing a open source wireless module using the atmega128rfa1 micro. My goal is to have a wireless IPv6 (6LoWPAN) network formed with them. One of the things I planned to do/make with them was a whole house power monitor system. I've got several "modules" in the pipe before a power monitor, but once I get the software working, I think I can crank out new PCB designs pretty quickly. I'm thinking the cost of the board and electronics for the monitor would be around $15-$20 USD. Couple that with 2 CT sensors, a voltage sensor, and a $40 "gateway" USB stick (Atmel's Raven USB stick), and the cost goes down quite a bit. The drawback is you actually have to run a IPv6 network translation between the USB stick and your server. I also haven't figured out any of the application layer software yet (like server client TCP port communications).

I'm documenting the progress on my blog.

TrystanLea's picture

Re: Home energy monitor

 cant seem to comment on your blog the resistor color code captcha doesnt seem to work?