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 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
For more pictures of the setup check out the picasa album here.
- 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:
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 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 7 segment display using a MAX7221 and a mode selector using a shift register and potentiometer.
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.
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:
And here's a short description of how to build an enclosure
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.
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.
Quick cost breakdown
Measurement Board: £12.68
Xbee link: £54.32
Xbee link cable: £0.57
Display cable: £1.53
Ethernet shield: £29.00
2 Arduino's: £41.16
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.