Introduction: Real-time Web Based Household Power Usage Monitor
Step 1: AC Measurement
There are a few ways to measure electrical power. The way I chose might not be the most accurate but it achieves two of the main criteria for this project. It had to be cheap and I didn't want to screw with my home electrical wiring to make it work. I did not want make an electrical connection with main power wires. The idea of interfacing directly to 220v makes me nervous. I could have used a Kill-A-Watt but it is only good for one outlet. Plus there is no way to get at the actual data, basically can just look at it on the LCD display. I've also seen commercial power meters for this kind of thing. Since those meters can cost over $1000, I didn't want to go that route either.
For this project, I used an AC clamp. With an AC clamp, it is possible to measure the current traveling through a wire without physically touching it. Basically it is a simple transformer where the wire of interest acts as the primary coil and the AC clamp is the secondary coil. Most AC clamps are integrated into a multi-meter. I used a stand-alone type for my project. It outputs 10mV per ampere and is intended to be connected to a multi-meter. All you do is multiply the voltage reading by 100 to get the current in the wire. These can be found for $20 or less on Ebay. Mine were made by Steren, model MUL-285. The great thing about using an AC clamp is that I was able to do all of my prototyping without ever turning the power off.
Step 2: Round Up the Parts
Here is a simplified list of things you will need:
1. ioBridge IO-204 Monitor & Connectivity Module
2. AC Current Clamp. Stand-alone type what will give an output in milli-volts per amp.
3. Circuit parts
- prototyping PCB or solderless breadboard
- 16k, 47k resistor
- 10uF polarized capacitor
- 10k 15-turn potentiometer
- small signal diode (1N4001or equivalent)
- instrumentation op-amp (AD8820, AD627 or equivalent)
- digital multi-meter
- extension cord
Step 3: Construct the AC-to-DC Conditioner Circuit
The main drawback with using an AC clamp is that the mV output is also AC. This isn't a problem for a multi-meter since it can be set for measuring AC voltages. However, the ioBridge module is expecting a DC voltage on its analog input pin. Therefore a little signal conditioning is required to convert the AC RMS value into a DC equivalent. The circuit I used was my own design and used components I had on hand, so I'm almost certain that it's less than ideal. After I was done soldering it up, I found a simpler circuit here. You may want to try it instead.
The other part of the circuit is a leaky peak detector made with a diode, resistor and capacitor. Its purpose is to translate the AC wave peaks into a DC voltage level. The 47k resistor causes the leakiness. Since the voltage level updates 60 times per second, adding that resistor increases the system's response time.
The potentiometer is used for offset calibration. I used a 15-turn pot for the best accuracy. To calibrate, power the circuit, make sure the AC clamp is not on any wire and measure the circuit's voltage output.
Step 4: Test and Calibrate
Now that the circuit has been built, it's time to test and calibrate it.
1. Power up the ioBridge module and connect the conditioner circuit to it. The conditioner circuit will be powered by the module.
2. Connect the AC Clamp leads to the circuit. Make sure you don't have the clamp on any wires at this point.
3. Set your digital multi-meter for DC voltage and connect to the ground and output pin of the circuit.
4. Adjust the potentiometer until you reach an output voltage of 1.000v.
5. Make a "calibration cord" by splitting the wires of an extension cord. Be careful not to cut or expose the extension cord wire.
5. Put a single wire of the extension cord (not the ground wire) in the clamp and plug in something of which you know the AC current draw (preferably something with a resistive load, like a heater) . Note the reading you get with your circuit compared to the real value. Although this step isn't actually necessary, it's nice to see if you are in the ballpark. To calibrate my setup, I plugged a portable space heater into a Kill-A-Watt to check the real number. It turned out that I was about 7% off and adjusted my calculations accordingly.
Step 5: Accessing the Main Power Lines
If your breaker box is anything like mine, then there are 4 screws holding the cover panel to the wall. Remove the screws and pull the cover off.
Don't touch ANYTHING inside the breaker box! The beauty of using an AC clamp is that it's designed for this sort of thing. Just clip it on a line you're interesting in measuring and put the cover back on immediately. Touching the wrong thing in there will kill you. I don't assume any responsibility if someone injures themselves trying to recreate this.
In most US homes, the electricity comes in as 220v on 3 main wires. Some appliances, like ovens and clothes dryers, are connected to these 220v lines directly. However, by using just one of the lines, the power is reduced to 110v for all the wall outlets. Usually, a home's electrical wiring is divided into two sections. One line (known as a leg) powers one section of the home and the other line powers the other side. To get the total power usage in my house, I put an AC clamp on both legs and added the measurements together.
If you are interested in monitoring a single breaker or maybe a single appliance, this method will still work. Just put the clamp on the wire coming out of the breaker.
Now just tuck that clamps in the box so the cover can go back on.
Step 6: Put the Cover Back on the Breaker Box!
Really, I'm serious. There was a reason it was on there.
Step 7: Mount the Hardware
I did about the easiest thing I could think of and just screwed everything to the wall. Not the most visually appealing, but it's functional.
Since I didn't have an network connection near my breaker box, I connected the ioBridge module to a LinkSys wireless gaming bridge. The gaming bridge allowed the ioBridge to talk my wireless router.
I'd like to point out that there is no home web server involved here. Just the ioBridge module and wireless bridge that together consume less than 5 watts!
Step 8: IoBridge Module Setup
Sign in at ioBridge.com and create an "analog monitor" widget on the I/O channel you have connected to the circuit. Set "auto-fresh" to "on" so your widgets gets a new measurement every so many seconds.
Step 9: Power Calculations
At this point you should have a system that outputs a number between 0 and 1023 corresponding to a voltage from 0 to 5v that in turn corresponds to the amount of current measured by the AC clamp. With a little math, we can calculate the AC current from the widget value.
CircuitVoltage = WidgetValue / 1023 x 5
I = (CircuitVoltage - 1) x 100 / Gain x CorrectionFactor
where Gain is the gain of the op-amp and assuming you are using a 10mV/A setting on the AC clamp. It's "CircuitVoltage - 1" because there is a 1v offset provided by the potentiometer.
To convert this to Watts, the math gets a little fuzzy. A number called the "Power Factor" is needed. The power factor is different for different appliances (and even changes for that appliance depending how it's being used.). Some appliances use voltage and current in phase with each other. This is the case with a heater for example. An electric heater would have a high power factor, maybe 90%. Other things, like computers, use power differently and their voltage/current demands are not in phase. In these situations, the power factor is lower, maybe 35% to 50%. Your entire home is a combination of all these devices with differing power factors. In order to calculate power usage in watts from voltage and current, you'll need to make a guess at the power factor. Most people use 60% as a good estimate for a home's average power factor. I used 75% in my calculations. It's important to point out that the power factor of you entire home is not constant but changing all the time. To get power use the following:
Assuming V = 110v (US homes)
P = V x I x Power Factor
Step 10: Google Charts and Website Integration
There are a few features of the chart that I'd like to point out. First, it automatically updates every 10 seconds. It will continue to add more points for an hour. After an hour, data older than an hour will be scrolled off the chart to make room for new data. This limitation is because of the way Google Charts works. A Google Chart is created through the use of a URL. Since a URL is limited to 2048 characters, there is a limit on the amount of data that can be plotted at once. The other thing I want to mention about the chart is that it will automatically scale the Y-axis.
Happy power monitoring!