loading

Real-time Web Based Household Power Usage Monitor

Featured
Picture of 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.
 
Remove these adsRemove these ads by Signing Up

Step 1: AC Measurement

Picture of 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

Picture of 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

Picture of 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

Picture of 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!

Picture of 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

Picture of 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

Picture of 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

Picture of 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!
1-40 of 87Next »
ImpGuru5 months ago

Cool project, is this your data as well? https://data.sparkfun.com/streams/wpKKppdQJZhrX8Lx...

You can see the live chart here: http://imp.guru/f5s

If not you should try out pushing the data to data.sparkfun.com and analyzing with imp.guru.

miketranch2 years ago
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).
rkincaid6 years ago
Would it be possible to just measure the neutral wire and only use one ac clamp?
No, because dryers or other 220V equipment won't pass any current through the neutral wire.
legless ham4fun6 years ago
Huh? What?
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.
lrdforster3 years ago
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
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?
jasonT (author)  thecolorblue6 years ago
Actually yes, I am working on an update that will address the "power factor" errors.
How has progress on the update gone?
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...)
Hightechk4 years ago
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.".
ChookChooks5 years ago
This is worth a look :


Power Monitoring, Weather Station Data, Server Performance, throw in some Local News and an interest in Australian Magpies..

and you found ChookChooks.com

Sing out if you would like to know more :)


Power.bmp
paulstich5 years ago
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.
            I sure hope your still responding to comments on this...
         I am in Toledo, Ohio and am currently using Toledo, Edison... I am currently paying $900.00 Mo. for my Electric bill. I am compiling a list of projects to help cut these costs. So far burning wood for heat. I have an extensive knowledge of Electricity and a some somewhat limited knowledge of electronics.
I am considering using current transducers mounted on all "hot" lines from each breaker 40 total to monitor the current draw from all circuits individually. My plan would be to cut power to certain rooms and circuits through out my house and monitor the current draw usage real time Via my Blackberry. As well as be able to cut certain loads on the fly. I don't know why but for some reason I cannot wrap my mind around the project in such a way to be able complete it. Any help you may be able offer would be very help full.
Don't know what country this is but talk about dangerous!!! That's like a load of spagehetti in there! and why are your incoming cables exposed instead of being covered where they terminate??? Another thing is how do your supply company measure your usage? I can't see a meter.
1) In the US (California) at least, the terminals are left exposed inside the breaker box by the utility company, and covering them is unlawful because it could present danger when removing the covers.

2) In most places, the Meter is OUTdoors (where it can be easily read), while the breaker box is INdoors (where it is difficult for you neighbors to tamper with).
jasonT (author)  jeremiahthebullfrog6 years ago
Since the voltages on the wires coming out of breaker box to my custom circuit are in the millivolt range, I didn't feel like I needed to cover them. Besides, this was a weekend project and I ran out of weekend.
While this can be a worthwhile project, there are some serious "gotcha's" that will limit is usefulness. Power is the flow of energy per unit time. One Watt is the flow of one Joule of energy past a point in one second of time. The circuit as designed is a positive peak detector with a time constant of about 0.5 seconds. This results in a snapshot of the current when it is at its positive maximum, and so we can only really calculate an energy flow at this instant. We are making many assumptions about what is occurring during the rest of the waveform period, and these assumptions can quickly lead us astray. One gotcha is discussed in the article; this is power factor. If the voltage maximum does not occur at the same instant as the current maximum, this will give us an error in our power reading due to our assumptions. The power factor will correct for this, but it assumes that both the voltage and the current are sinusoidal. The power factor varies as various devices are turned on and off, and thus we would have to know the correct power factor for all the devices and if they are running or not in order to make corrections. Switching power supplies and lighting dimmers create a non-sinusoidal current waveform causing errors that cannot be corrected for in this design, another gotcha. Here's an example: A common technique for lighting dimming is called phase cut-on, which turns off the current at its zero crossover point, and then turns it on after a delay that is constant for every cycle. If the dimmer was adjusted to supply half power to the lighting load, the current would be blocked after every zero crossover until the voltage was at its maximum, and then turned on. At that time the current would go to the same maximum as if there was no dimming. The circuit would respond to the same peak and would give the same power reading even though power was reduced by 50%! An accurate power meter has to detect the instantaneous power and integrate it over the unit of time, keeping track of the sign of the power. This is why they are so expensive. Any accurate meter would have to know the polarity of the voltage and the direction of the current. One last reality check. This design cannot differentiate between power flowing out and power flowing in. A power meter that gives the same reading for 1000 W as for -1000 W has some serious limitations. If you replaced your house loads with generators, could your power meter tell the difference? If not, can you really trust it? (The power company meter turns backwards if you put power into their line.) I appreciate the authors desire to generate an inexpensive display of power usage, and many of the ingenious ways he implemented it, but it will only give a broad generalization of power usage, which may be good for things like telling when your air conditioner is going on and off.
hey man that is the longest comment ive ever seen if i waned to write some thing like that i would make a new fourm and link to that topic. hehe instead if having a very long detailed comment.
You are correct for all of these points, but I think you paint a bleaker picture than necessary. I agree that the power factor issue is a big gotcha. However, that can be estimated and/or short-term measured (seasonally, depending on HVAC equipment) to get a fairly reasonable idea of how to modify the apparent power to get real power. For that matter, the voltage is not a constant either, so it should be measured. It's generally 118-126 V at my house, with a long-term average somewhere around 122.5 V. That is another bit of uncertainty this method incurs. The average residential monitoring application (at least in the US) will not suffer greatly from lighting dimmers and switching power supplies. These are generally a small percentage of the load at any given time. I'd guess the clamp errors are greater, especially at low currents draws. There is a lot to be gained by a better understanding of the magnitudes and time of energy use and what's going on in one's residence. I think this project is great in both means and ends, despite the limitations. The system really needs to be repeatable more than it needs to be accurate to Watt (or Wh) to give good feedback to the home occupant(s) about energy use. It has the potential to still be more useful than the monthly kWh reading from the electric utility that comes another two weeks after that month ends. I just wanted to add a bit more positive spin to the measurements, because I think they still have a lot to offer.
legless6 years ago
just don't do it in OZ. We can't touch in the power box at all except for replacing a fuse or resetting a breaker.
You probably can't, but just do it when nobody's watching :-)
Vidar_766 years ago
Good idea and 'ible! Must say i was a bit chocked to see your breaker box, is it common to have the cables like that? Even if you got half of the volts compared to most european households it looks quite unsafe.
jasonT (author)  Vidar_766 years ago
Normally we don't remove the front panel cover like I did in this Instructable. There is a little hinged door on the front that will allow access to only the breaker levers without exposing all the wires. I'm sure many people will give me grief for even suggesting the idea of removing that cover on my own and not having a certified electrician handle it... but if that were the case and I had to hire someone else to do all the work, it wouldn't make much of an Instructable!
sweavo jasonT6 years ago
In the UK we don't see so many exposed contacts so easily. The tails, meter, and breakers are all designed so that connections are hard to brush against. It was a shock to me to see so much bare metal behind that cover!
snarke sweavo6 years ago
I know, this comment's coming really long after the initial discussion. But I couldn't resist. "So many exposed contacts?" Perhaps you're assuming some of the things you're seeing are carrying a voltage that actually aren't? There are only two areas in this box that are somewhat dangerous. First are the little silver cubes that the author marked as "Exposed 220v main lines." Of course, you can only get 220v if you touch both of them at the same time. If you touch one, it would be 110v (it's actually 120V in my house). On most boxes, these cubes are actually set into a socket with a plastic surround, so it's quite hard to brush against them. The other place is above the installed breakers. There are metal tabs running up the center of the structure that holds the breakers. You can see three of them in the picture. (I can tell this box is using Square-D QO breakers, and I use those myself, so I know how they hook up even though it's really hard to tell from the photo.) Those tabs are also recessed below a plastic collar. You could get a finger onto them if you poke right at one, but an arm or fist, for example, would be unable to make contact. That's it. Each breaker has a hot point where the wire connects, but you can't see those in the picture because they're also recessed into the side of the breakers. There's a fair amount of shiny metal to the left, right, and below the "220v" yellow-boxed area, but as one can tell from the fact that all the wires going to them are white, those connectors are to the "neutral" wire, and are at 0 volts. Since this is the main breaker box for the house, they're also almost certainly connected to a big fat copper wire that's connected to a metal pipe or stake driven into the ground outside the house. (You can see this wire in the lower right of the box, leading upward to its own silver cube connector. I don't see an obvious connection between it and the white wires, but usually that's done by bolting the neutral connector through the plastic breaker-holding frame into the metal case. The naked copper ground wires and the wiring bus that they're all screwed into is also fastened directly to the case.) So even with the cover off, you actually have to put some effort into getting yourself or a tool into a position where it could get zapped.
sweavo snarke6 years ago
thanks for the info. knowing white = neutral makes the picture a lot less scary!
This is typical in the US. As you see the center buss bars extending above the breakers, these are open positions for additional breakers, the front panel has blanks that are removed when the new breaker is installed. The main power input at the bottom of the panel the white wire is the circuit neutral and the colored wires are HOT electrically. Usually main input HOT wires are black. I agree would be nice here in U.S. to have the shielded buss bars and main power lugs. This is another reason why we require licensed and most of the time union electricians to do the work.
Actually in the US, the homeowner has the right to perform any maintenance to their home, including electrical. If it is a rental home some jurisdictions require a state-licensed person do the work. If you perform any maintenance to your home, it is still your responsibility to follow the current building codes however.
jasonT (author)  DarkStarPDX6 years ago
I didn't know that. Thanks for the info!
Here in Iowa when I first setup my modular home Y2K I was able to do all of the electrical service feed. Now I hear that there is a proposed change in Iowa Law where you must get a licensed electrician to do that work and if you are building from scratch, the whole project. I understand the need for safe construction practices, it seems to me if the home owner has the aptitude for use of hand tools and reads the National Electrical Code Book, it is lengthy, the home owner can save some money!
It's like that in the UK too. Now you can only do very basic things without certification, like replace a plug or add a spur. Most other tasks need to be "part p" certified. It's enforceable here because we recently changed all the colours of our electrical cables, so it's easy to see where new work has been done. The bad part is (according to what I've heard) that the electricians must sit a govenrment-approved course costing £1000, and must sit it every year. It starts to look a lot like just another lever to take money off the public and put it in the tax man's pocket.
WOW!!! I just ran the exchange rate 1000 pounds Sterling is equal to $1,363.00 U.S. Dollars. With the electricians having to be recertified annually, no wonder the cost of electrical projects goes thru the roof! I agree it's just another method government gets into your pockets, if government could our politicians would tax the air we breathe!
I'll drink to that, or I would if the tax on wine wasn't so high
If you would like to see pics of a wind powered generator project I am working on private email me. It is a 2.4kw generator, here in central Iowa we are number 10 in the amount of wind available to produce power in the USA. When you look at a wind map of the central US from North Dakota down to Texas this area is referred to as the Saudia Arabia of wind power potential.
1-40 of 87Next »