How to build a whole home energy monitor

This page and the linked pages detailed below, document how to build whole house energy monitor that displays current energy use information, can do usb data logging and has Internet connectivity for online graphing.

First a quick look at the installed setup:

The Display

The display unit consists of 4 large green 7-segment LEDs. On the right is a mode chooser you operate by turning the potentiometer (bottom – right) to display 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 an AC-mains wire on the right. The main unit contains the Arduino, voltage and current measurement electronics, power electronics, USB pen datalogger 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 with flot.

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

Main Features:

  • Voltage measurement via AC to AC adapter
  • Current measurement via 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,
  • Mode selector and red/green LED indicator to indicate if grid frequency is above or below 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 covered independently so that each part can be tested to ensure it works. There is a section at the end about bringing each part together to complete the build. Hopefully this way, it will be easier to troubleshoot if things don't work, and make it easier to bring the parts together in different configurations, and use them for other projects.

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

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 signals from the CT sensor and AC power adapter to signals in the voltage range suitable for the Arduino analogue inputs. It also contains components to convert the AC from the adapter to DC for the Arduino. Currently, it works with single-phase 2 wire distribution system as is common in many UK homes. If you're in the US, and have a split-phase 3-wire system and would like to help adapt the design for the 3-wire system, please contact me.

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 safely start/stop/remove the pen drive. The datalogger 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 via Xbees. Connection between the main unit and the Ethernet unit. The Xbees relay serial messages between the Arduinos. A wire connection can be used instead of the Xbees 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 how to graph the data in the database with flot.

Bringing it all together

Once you have each section working independently, the next step is to get them all working together. The wiring diagram below shows how each major part is connected together and how the I/O of the Arduinos 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 complete Arduino sketches for the main and Ethernet units. They are made up of the stand-alone sketches from each section above. So if you're wondering how one part works, or want to use, say the usb data-logger section, in another project, then have a look at the stand alone code.

I tried to annotate them as best I could, so I wont cover 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 parts list. It contains links to suppliers (mainly Farnell), prices and alternative parts to reduce the project cost.

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! I've been looking at how to bring it down a bit. If the Xbee wireless connection is replaced with a simple RF link, the Nuelectronics Ethernet shield and Arduinos are used with a display based on an SAA1064 driver chip, the overall cost can be reduced to £91.71. I've added details on the alternate components including links to suppliers, and tutorials, in the spreadsheet. I'm hoping to get a chance at making a lower cost version soon as I may be building an energy monitor for the local community center here. 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?