What is It
Every time you get your power bill, you wonder, what is costing me this much? Are we leaving too many lights on. Does having umpteen computers in the house as bad as it sounds? How about that pet bearded dragon, how much is he adding to the power bill. I often had these questions, and being obsessed with home automation, I wanted to know what exactly is costing me what in that monthly power bill. You can start plugging your devices into watt meters or smart outlets and get some idea of what the general usage of something is, but this is 2015, where is the smart power grid we were promised so many years ago. Where is that smart panel with analytics and intelligence which would tell us that leaving the bathroom light on all day will cost you 10 extra dollars on your power bill at the end of the month. I looked, I’ve been looking for years actually, and best I could find is a very expensive system with a monthly monitoring fee.
Open Source Solution
As luck would have it, I am not the only one to want to know power consumption of everything in their house. Some very smart folks in England started an open source project OpenEnegryMonitor. After some research on this site and others I was on my way.
The Theory in a Nutshell
So this requires knowing a little bit about how alternating current works. So, AC current is a wave, it creates an electromagnetic field around any wire it goes through. The field is very small, but increases as the current increases, and there are non-invasive current sensors which turn this field into a measurable voltage and that is what we’re after. The idea is to take your measurement at the appropriate points, so you need a reference of an AC wave. The circuit that is designed in the open source project takes an AC adapter which converts high 120V current (me being in the US) to a low 9V AC current. The adapter, must be AC to AC, since we need to see the wave to be able to properly get readings from the current sensors. You can read more about it on the OpenEnergyMonitor website, but that’s the basic idea.
I expanded the basic idea from above to use all the analog sensors on a Arduino mega, that’s 16 pins. One pin must be devoted to measure the AC current, so that means with one Adruino mega, you can measure up to 15 current sensor source. The sensors clip on wires going to the breakers, so you can combine wires as space in the panel allows. Only trick is not to combine wires going to breakers on different phases or you’ll get one phase canceling the other out. My house has 2 panels, and using 2 Arduino Mega devices would give me up to 30 distinct current sensors.
Wiring It All Together
I basically followed the schematics from the OpenEnergyMonitor open source project. I soldered 15 headphone connectors and wire blocks onto breadboards with the requisite number of resistors and capacitors. Then connected the custom boards to Adruino Megas. Then I did the not so fun part of clipping all the current sensors safely around the hot wires going into the breakers in my electrical panel. This must done very carefully because even in the US, 120V and on some breakers as much 100A is a deadly combination. So when I did not have a clear and easy approach to a clamp the current sensor, I turned the breaker off.
The sensors then get connected into the Arduino expansion boards.
This is a temporary configuration with the expansion boards and Arduino’s sitting on a box of ceiling tiles. Arduino’s are connected with Ethernet into my home network.
In order to make things more professional and clean, I designed and printed enclosures for the Arduino + Current Sensor board combination and attached them to the wall in my electrical closet (obviously the mess in the above picture was not going to be a permanent solution).
This enclose was one of my first prints on my 3D printer, so it’s a little rough, but when installed it worked perfectly. The end result still needs a bit more tidying up with some wire ties and wire tacks, but it’s secure and safe.
The Arduino uses a slightly modified code from the OpenEnergyMonitor open source project (simply to gather all the data from all the breakers) — then it sends to my home automation webserver which persists the data into a MySql database. The data is sent by the Arduino roughly every 5 seconds, and is instantaneous reading of the current usage on each breaker combination. The webserver component only persists the data to the database once every minute or if the change in usage is more than 10 watts and represents a greater than 10% deviation from the previous value. This way I am able to record sudden energy draw spikes or drops and keep the amount of data I persist fairly reasonable. Arduino scripts have a 2 second sleep in the loop to keep the Arduino CPU from running too hot.
On the front end, I used a web based open source charting package from http://dygraphs.com/. It works very well for displaying time based line data. With some tweaking I’ve been able to optimize it so that my home automation server which also runs all HA related functions is also able to handle processing the displaying of chart data fairly easily. Considering that it’s powered by a quad core arm board, I am very happy with the result.
During the first 2 months of using the power monitoring system, we have been able to make a few efficiency improvements in our house. We change some thermostat schedules and switched out some inefficient lights for LEDs. These are simple things to do, but seeing the data plotted over a period of time really gives a good picture of the impact small changes will end up doing. I don’t foresee us making other significant changes to our lifestyle based on the analysis of the data going forward, but the initial information provided by this system will pay for the cost of the system in just 6 months. Considering that the most expensive components in the system are the current sensors themselves (30 at about $15 per) + cost of Arduinos, power supplies various electronics, the system ends up being roughly $450 all in. The savings we’ve been able to achieve in our monthly electrical bill are significant where we will save nearly $900 per year. From a financial stand point, this is worth the effort. From the educational standpoint, for me, it was definitely worth the effort. Obviously from the geek factor, it is unquestioned that is worth the effort.