Real-time Web Based Household Power Usage Monitor

291,772

436

92

Published

Introduction: Real-time Web Based Household Power Usage Monitor

This Instructable details a real-time web based household power usage monitor. The end result is a live chart in a web page that updates every 10 seconds with the instantaneous power usage for my entire house. The electrical current is measured on the main lines entering my home with AC clamps. The signal is then conditioned with a simple circuit and monitored by an ioBridge module. The ioBridge module takes care of feeding the data to the internet without the need for me to host a power hungry home web server. By using ioBridge widgets with a few JavaScript API calls on my web page, I am able to chart the data with Google Charts as it is measured and make kilowatt-hour calculations in real-time.

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 main component in the circuit is an Analog Devices AD8220 instrumentation op-amp. This part only comes in surface mount style packaging. I needed to use a tiny SMT-to-DIP adapter board for my circuit. Don't feel like you need to use the exact same part. Any rail-to-rail instrumentation op-amp will work just fine. For example, the AD627 (Analog Devices) will work too and it comes in a breadboard friendly DIP package. In my circuit, I used a 16k resistor to achieve a gain of 4. Feel free to use a different resistor to get to a particular gain you need. However, any change in gain must be compensated for in the JavaScript of the webpage.

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.

Caution:
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

Since describing how to use Google Charts and javascript could be an Instructable of its very own, I'm not going to cover that in much detail. Basically, I ripped off a few other examples I found on the web and modified them to fit my needs. I'm providing a link to the source code of my original power charting webpage. If you make the system as I have described, then you should be able to replace the ioBridge widget embed code(s) in my html with your own.

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!

Share

    Recommendations

    • Water Contest

      Water Contest
    • Oil Contest

      Oil Contest
    • Clocks Contest

      Clocks Contest

    92 Discussions

    https://www.linkedin.com/pulse/why-we-need-monitor-important-electrical-parameters-felidae-systems

    Great job on the 'Ible, I want to make one of those too!

    Nice write-up, thanks! I've been working on a related project using a Kill-A-Watt as a starting point. I've added an Arduino clone with a radio (e.g. a JeeNode or Moteino) and it samples the supply voltage and load current 50 times per cycle, computes true RMS values, and also VA, Watts, and power factor, and transmits all that to an R-Pi. I've been documenting the project on my blog, www.mikesmicromania.com. I recently obtained the same current clamps you're using from SterenShop, and they look really decent. For my next project, I'll re-create your whole house project. Thanks again, your project helped my design, and you helped me find the current clamps (very reasonable price compared to everything else out there).

    Would it be possible to just measure the neutral wire and only use one ac clamp?

    5 replies

    No, because dryers or other 220V equipment won't pass any current through the neutral wire.

    Dryers and 220V equipment use the difference between the two others wires. The neutral wire is at 0v. So, let's say you want 240v. 60 times a second you will have a configuration that looks like this: start of cycle: black wire - +120v Red Wire -120v half cycle: black wire -120v Red Wire +120v As you can see, you would get 240v by using the black and red wire since they are 240v apart at their peaks (AC). The rest of the house uses either the black and neutral wire or the red and neutral wire. And that is why they usually say your house is on two different phases.

    Is this why you can just measure the red and black wire, add that up and get your energy consumption? I figured you would have to account for the the voltage going thought the neutral separately otherwise the 240v would be accounted for twice.

    You have a weird way of wiring stuff in your country. You want to try testing the idea that there is no current in a neutral wire from any appliance in my country by grabbing it and you will likely have a whole new hairstyle if you live. Of course all of our mains equipment runs off 220V-240V here. Houses here are normally just supplied by a single phase coming from a supply in the street that is multiple phases. If you want power from a second phase for some reason is taken from another in the street supply. You could also get 415V 3-phase power connected if required here.

    I just come across your instructable and had a look. I found both it and the comments interesting reading. Power factor is interesting and needs a simple measuring solution.

    Many years ago when I was an apprentice I recall seeing an analouge Power meter which compencated for power factor. As I recall it had a voltage coil and Current coil combined in such a way they gave a Power reading.

    The Idea was as the current signal is out of phase with the voltage one rotating force would work against the other rotating force, Calibration was done in 2 parts, 240 vac and zero current moved the needle to 0 Watts increase in current the rotated the coil back up the scale.

    Using tis principle and two conditioned analouge signals one AC volts the other ac amps into two op amps respectively and combine those outputs in a multiplying opamp should give a representative Power Output with Power factor included. ie when current or voltage is momentarily 0 the power is 0.

    Multiplication requires 2 logerithmic amplifyers and a summing amplifier. for those who didnt know. Op amps are good at analouge maths. once comleted then digitise using an ADC

    1 reply

    circuit attched quite simple remember it releys on analouge measurment and simaltanious readings. The output would need to be calibrated with known inputs and powerfactor

    ScreenHunter_02 Jan. 01 21.45.gif

    I love this idea but I am really worried about opening up my fuse box to set it up (esspecially, since a lot of the technical stuff went over my head). Even if this setup is only 40% accurate, its a great example of what someone could do with a iobridge. This looks like a great weekend project and maybe another weekend just playing with google visualizations api. With more money, do you think it would be possible to make this more accurate?

    3 replies

    Actually yes, I am working on an update that will address the "power factor" errors.

    Ooh, I can't wait to see how you do that. It will be really hard unless you can "correct" the misalignment of the current draw. This might give you some ideas (schematic down the bottom...)

    I've been watching your live graph and it's amazing how many times it can peak at nearly 4kw's. What draws that much power?

    BTW, Great instructable, when I try to do it I will use CT's. I doubt I will use the ioBridge because there isn't much of a DIY factor to that (It's also partially because I'm too young to have a paying job...)

    i hope you know what your doing if you try this because you could easily kill your self. also i would recommend covering those open circut boards (dust and if you have children)

    looks cool though im wondering wether i want to do this or just buy one?

    Correction. In step 2 it should read "2. AC Current Clamp. Stand-alone type what that will give an output in milli-volts per amp.".

    Good stuff!  Thanks!  I built this using the AD627 as you suggested.  Works great.  I'm using a homemade ammeter coil (based on the info in hydronics' $2 Carabiner ammeter) and an Onset Hobo U12 data recorder.  I would like to improve the rectification, and am thinking about trying a true-rms chip, like the AD737.