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 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
For more pictures of the setup, check out the picasa album here.
- 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.
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 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 7-segment display using a MAX7221 and a mode selector using a shift register and potentiometer.
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.
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:
And here's a short description of how to build an enclosure
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.
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.
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! 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.