Whole house current monitoring

[Debraj Deb] put together a current monitoring device that interfaces with the circuit box at his house. The system is controlled by a PIC 18F4520 and uses an LM358 Op-Amp to rectify the AC signal, as well as an MCP6S21 for range adjustments for detecting both high or low current loads. The data displayed on a character LCD includes average, RMS, and peak current. For now the data is saved to an EEPROM and can be dumped using a serial connection but [Debraj] plans to add a GSM modem so he can send energy use data to his cell phone.

[Thanks Ganesh]

Comments

  1. Very cool & useful. Wonder how hard it is to plug into the google power stuff. Placing in eeprom isn’t very useful, but getting it out automatically would be better.

  2. Brad Hein says:

    I’ve been looking for a solution like this. I think my AC shorts out occasionally when it freezes up, but it’s hard to tell. Need to shed some light on the issue…

  3. Brad Hein says:

    err… AC as in Air conditioning haha.

  4. Dennis Booth says:

    I need printable schematic, kit, or assembled device… Or info on where to get same.

  5. biozz says:

    how do you calibrate this thing?

  6. cgmark says:

    Biggest issue with something like this is safety. You are dealing with a lot of amps, 200+ sometimes.
    Not something to play around with.

    There are plenty of ways to do it cheaply with boards from places like sparkfun when you are using low currents below 30A but as you go higher you will need to either use something like a lookup table or formulas to scale the input to actual usage.

  7. cgmark says:

    @biozz use the math :)
    V=IR

  8. HackerK says:

    Any more details?

  9. Jim says:

    The only unsafe part is the time when you put the transformers on the mains(if doing whole house at once).. but there are clamp on transformers that don’t require the main lines to be moved or disconnected. Once those are installed the voltage and current measured from the transformer output are pretty tiny.

  10. Eric says:

    @cgmark – current transformers ;)

  11. Allan says:

    Very soon my utility will be switching to smart meters where you are billed based on time of day in which you consumed energy to encourage consumption during off peak demands. Each day you will be able to go online and view you previous days usage and this tool would be great as a comparison tool.

  12. turbo says:

    I’m impressed by how he got his wife to assist him. I would only get eye rolls.

  13. zing says:

    @cgmark OMG, it connects to TEH MAINZ

  14. Mark says:

    Why not simply use a rogowski coil? http://en.wikipedia.org/wiki/Rogowski_coil

    That’s really your standard ac amp meter which you can just clamp to your incoming wire.

  15. megaton says:

    @Brad Hein. Your a\c is not shorting out. If it is freezing up, you have another problem entirely.

  16. Oh no, breaker box mentioned, here come the safety police. The current measuring is very likely done with a magnetic pickup coil, without a direct connection to the mains. The only danger is installing it in the first place, since the main input buss is exposed and not able to be switched off before the ‘main’ breaker. Common sense dictates that if you don’t know about the dangers inside a circuit breaker box, then you shouldn’t mess with it. Also don’t stick forks into outlets like I did when I was a kid, it made me a bitter old man.
    I have a whole bag of those pickup coils (fleabay) which the to-be-sensed wire passes thru, I wanted to monitor every circuit leg to see precise info on where the energy was being consumed. But via experimentation, I think I came to the conclusion those are best coupled to a smart energy monitor chip (microchip makes some) which can do the calculations very accurately without needing to know a ton of AC math. (which is hardcore, at least for me) You run into issues with high frequency devices like CFLs and SMPS’s, but the chip takes care of that. Now I have the energy mon chips(samples), but they require quite a few external components, so still shelved.

    Props to this guy that rolled his own! And the adjustable gain feature is very smart, that’s one of those things you think of after you made it and it isn’t precise as you needed. Great project, wish it had more details.

  17. cotton509 says:

    Nice idea many add some power controll too. That would make a Eco home easyer to build

  18. itisravi says:

    @cgmark You are not dealing with 200 Amps! The max fuse rating at your house is about 5Amps and your ‘average’ home draws less than that :)

  19. cgmark says:

    Don’t compare measuring power from a lamp cord with measuring the feed coming from the power meter at the service entrance. They require totally different approaches. The gauge of wire coming into the main breaker is usually 2/0 or 4/0 AWG and most of the current sensors like coils or hall devices are not equipped for that.

    There is also no place inside a service panel to attach such a device and have it be safe. The only place that is exposed for attachment is before the main breaker disconnect. You do not want to be attaching a device to a line that cannot be turned off except by pulling the meter.

    Retail devices that do it use a split core and special mounting boxes that have a disconnect then the sensor then the main breakers. Just putting a sensor in a breaker box before the disconnect is foolish.

    http://www.controldepot.net/splitcorelooppoweredcurrentsensorw4-20maoutput0-1000-1500-200amps.aspx

  20. cgmark says:

    @tisravi

    Maybe where you live but in the USA a mains panel on a home is usually 200A with each circuit for 110/120VAC rated 15/20/30A and 220/240VAC rated 30/40/50A

  21. Alex says:

    @itisravi

    Sure, most homes draw an “average” of 1000 watts, or 4.5-ish amps at 220 volts (EEs don’t flame me here, I’m using DC math for the sake of argument) but most homes do have 100-200 amp service coming into the box because the peak load is going to be way higher than the average. So yes, you could be dealing with up to 200 amps.

  22. imsolidstate says:

    What’s an MSP6S21? Google only turned up this project.

    @cgmark – he said it was a current transformer, so it’s not actually in the circuit. It’s just as safe as anything else touching the insulated wires inside the box. Current transfomers for current sensing have small outputs.

    I’d have skipped the AVG and Peak measurements and tried for power factor. See how much power your wasting.

  23. D_ says:

    Good grief, if your are uncertain of your ability to put transformers over the service inductors hot, hire an electrician who has the proper equipment to do so. The smallest service you will ever see(USA) is 100 amps, if code is followed.As others mentioned there is nothing lethal coming from the panel to the circuit, no matter the size of the service

  24. itisravi says:

    @cgmark, @Alex. You guys are right.I stand corrected.

  25. mahoney says:

    How does he perform 4 quadrant multiplication for AC power if the measured current is put through a precision rectifier?

    He could detect current phase in realtime, but I wonder how accurate that would be with several appliances drawing complex waveforms.

  26. David says:

    I just spent two months in India and wish I had something like this in place… lots of power issues where I was at. Actually, I did a similar project a few years back for my place in the US but it monitors all branch circuits and has a web front end to interact with all the historical data:

    http://www.kondra.com/circuit/circuit.html

    Would have loved to have this installed there!

  27. Gert says:

    A friend had some funky voltage levels. He called the company and they placed a box smoothing out the output.

    I plugged in a O-scope and his levels were nicer than mine.

    A constant voltage will improve the life of anything (except your fingers) plugged into the ac outlet.

  28. Gordo says:

    I dont see much trouble finding rms amps with a coupled coil, u might be sampling the voltage after some filter/rectifiing and the storing or showing instantaneous values. But then you get apparent current (real current consumption might be associated to current in phase with 50Hz?)

  29. Bogdan says:

    Nice build!
    I am still documenting about building something similar. I am going to use a current transformer for measuring the current as this is the safest way.
    @Those arguing about high currents
    If you are using a current transformer all you need is one rated for that current and the output is in a safe range.
    I recommend reading AVR465 app note, it explains the theory behind it and software functionality so you can use whichever micro controller you want.

    http://www.applejelly.org/AVR/8-Bit/appnotes/pdf_avr/AVR465.pdf

    Still, i like @Debraj Deb’s idea of using a PGA better than switches.
    The only real problem i actually have is calibrating the thing, but i’ve got something similar to a kill-a-watt thingy.

  30. Debraj Deb says:

    Thanks for all the comment. Here are my comments –>

    Schematic: –

    The hardware is built on a general purpose board and hence I do not have a PCB layout. But I plan to put the schematic on paper, so it might benefit others. But as such, the hardware is simple.

    Rough calibration: –
    every appliance that we use carry the power rating. My water heater is rated for 2KW and hence, it will draw a current of (2000/230) = 8.7Amps. And the RMS reading that I get on my LCD is almost 169. Hence 169 = 8.7Amps. This is a quick calibration, but very rough indeed.

    Correct calibration: –
    Get a standard meter and measure the current drawn in the mains, and the display on LCD. Try with different euipment — water heater (resistive), laptop charger (capacitor current), lamp ballast (inductive)…

    Safety and isolation: –
    I used a current transformer to measure the current. The output of CT is isolated and hence safe. I am not measuring the voltage, I assume it to be 230V constant. Even if I had to measure the voltage, I will use a tranfomer to isolate the mains. I usually work on hig voltage circuit and hence aware of the risks involved.

    Another puspose of the project: –
    My wife forgets to switch off the water heater. So, it keeps running for 1/2 hour and that increases my electricity bill. I will connect a buzzer on the board which will beep loudly if the heater is ON > 10min (which is sufficient).

    current transformer: –
    I got is from a scrap dealer. But in India, you can get a new one for US$2 ~6, which will give a decent output upto 18Amps (230V * 18A = 4K, big power!!). My CT has a resistance of 330ohms.

    MSP6S21: –
    Its a typo, the real part number is MCP6S21, a programmable gain amplifier from microchip>>

    http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en010483

    Can be insterfaced to uC thro SPI and provides different gain from 1 to 32..

  31. smoothp says:

    Was thinking of having a more distributed sort of monitoring, monitor at various power supply junctions in the home and have it logged in a central location. Any ideas?

  32. Debraj Deb says:

    Another point that I wanted to clarify: –

    I use a precision rectifier to convert AC signal from current transformer into DC and then feed the DC into microcontroller. The DC is ripple DC and I do NOT use any filter capacitor. I am sampling the waveform at a rate of about 33uSec, which gives me about 60 samples over one cycle (1 cycle = 20mSec for 50Hz, India). Using the samples, I calculate RMS, Average and peak.

  33. Bogdan says:

    @smoothp you may apply the same thing, and add radio or some sort of communication between the modules.

  34. One thing to keep in mind is that in US power is split phase. So you have to measure both, also because of the split you can’t assume voltage will be at any constant.

  35. non says:

    Measuring only the amps gives correct data for the pure resistive loads only.
    Everyone pays for the real (active) power which is apparent power x phase angle (between voltage and current).
    You have to multiply the measured voltage with the measured current in every 33usec to get the real power.

    Nice work anyway.

  36. non says:

    I forgot this one, wouldn’t be a simple timer much more convenient and easier for this purpose ? ;), a button, a 7 segment LED display, a relay and a cheap pic
    every button press adds one min (or just starts from 10 min.), the display shows for how long the heater is on and counts back…

    … if the heater is ON > 10min (which is sufficient).

  37. andrew says:

    Wow guys, you don’t really understand what you’re playing with.

    200A service is not capable of supplying 200A. It is capable of supplying much, much more if you give it the opportunity to. Depending on how far you are from the pole pig, the gauge of the wire and just what exactly you do to short it, you could be on the receiving end of several thousand Amperes of current.

    Yes, you’re using current transformers. Good for you. These things can and do fail. Insulation fails. You could very well end up on the receiving end of these multi-thousand Amps of current hitting your circuit. I’m far less worried about the insulation failing as I would be of accidentally touching something while slipping the CT on. Best to disconnect the service before attaching this thing, or using split-core CTs as someone else mentioned.

    “Real Power” measurement is tricky, even for us pros. For hobby stuff measuring your current and voltage simultaneously and multiplying to get instantaneous power isn’t always easy, and if you want to keep yourself isolated presents some interesting design challenges. Complex harmonics can also present interesting waveforms to measure, which mean you’ve got to increase your sample rate to even see them. There’s lots of information on this out there if you’re curious: the term “crest factor” is a good starting point. For most of us though we don’t need to be quite so precise, so a peak-reading S&H and some fudge factors will do just fine.

    Very nice project. I’ve mean meaning to do something like this with my own house.

  38. Bogdan says:

    @andrew I am not familiar with US wiring, but shouldn’t there be another fuse right where the cable that is supplying your house is connected to a bigger line? This should prevent excessive current in the situation that there is a short somewhere before any breaker in the house.
    @Debraj Deb I have just noticed, you say 33us and 60 samples per cycle. One of them is not correct, which one is it?

    I think this project is as simple as it gets, the best next thing to improve is to measure the voltage to account for active energy only. Measuring it after a transformer might not be a good idea. I think there is a phase shift, am I correct?

  39. cgmark says:

    @bogdan

    In the usa 4KV power line provides power to step down transformer on the pole. The transformer is split phase so it has 3 wires . 2 of the wires are out of phase and provide 110VAC each. The 3rd wire is neutral . Measuring from phase to phase wire gets you 220VAC and from either wire to neutral is 110VAC.

    From the transformer on the pole it goes directly into a meter base. Inside the meter base it connects directly to the meter there is no fuse or breaker in the path.

    Picture with connections labeled.

    Notice that once the meter is installed there is nothing breaking the connection to inside the home.

    The power goes from there to the service panel inside.

    There is nowhere to tap it before the breaker without the risk of fire if what you do fails. And if it does home insurance will not pay for the damage. Electrical code in the usa specifies that only a licensed electrician can alter the wires on the input side of the main disconnect.

    Even though I am an EE when I rewired my home I could install my own disconnect after the meter but had to have the power company make the connection to that because I was not allowed to do it. So on the home I have 2 disconnects. One on the outside right after the meter and one on the service panel inside. But most homes are not wired like that. The only thing stopping 200A + current from flowing if something fails or a mistake is made is the wire size.

  40. cgmark says:

    @imsolidstate

    While the connections may be insulated there are no provisions for adding that in the NEC code. You do not want a device hanging inside the box around those wires. Otherwise you will have a situation where if you do attach it and anything goes wrong your are liable for the damage it causes. If the insulation shorts, if a lightning strike causes it to fail then you would be liable. Home insurance will not pay if you tamper with the service feed.

    The only correct way to do it and have it be safe is to follow the NEC and have two panels installed. One with a disconnect between the meter and main panel and a second one on the main panel itself. Then you have a safety device between whatever you do and the power lines outside. You can add your device and then connect the wires to the main service panel.

    Doing it any other way and you are on your own if it goes wrong.

  41. Debraj Deb says:

    @Bogdan
    I get about 60 samples/ cycle. So the sample rate is about 330uSec (not 33uSec, as I mentioned earlier).
    Yes, for transformer, I will get a phase shift and that will make the work complicated. My idea was to keep the design simpler. I plan to aproximate the power measurement over a time and then compare it with the display on my energy meter. Let see, how much does the error goes? If it is reasonable, I do not need a voltage measurement. But, for actual Watts measurement, we will need voltage too.

    @non
    Yes, a simpler PIC will do. But I used PIC for 2 reasons — first, I found it (PIC18F4520) easily in the local market and second, I like the C-programming possible with MPLAB on PIC18F. For C-programming with PIC-16, I need to use Hi-tech ‘C’, which I have not used and hence a mind set, which I need to break. :-)

  42. imsolidstate says:

    @cgmark

    I’m not sure he cares much about NEC. He’s in India right?
    “If the insulation shorts” if the insulation fails, then there are problems anyway. Current transformers are used all the time in industry to measure power.

  43. Debraj Deb says:

    @imsolidstate

    Yes, I am in India.

    I am not sure of the NEC code. But in my house, the wires used are “ISI” grade and flame retardant. If insulation fails from the wires, the CT is still insulated. If everything fails.. well, thats a serious day altogether.

  44. Lee Wilkerson says:

    @cgmark
    In the US and Canada where I’ve been, there is a fuse outside on the high voltage wire before it goes into the pole-mounted transformer.

  45. Diane says:

    My friend is having surges in their home, watch batteries dying, lightbulbs going out and pumps frying, they feel it is a magnetic field going on, what do you think?

  46. Vick951 says:

    Hi everyone,
    I know this topic is getting old but I am really interested in controlling the current running in my house.
    I would like to monitor it from the house panel, after the fuse but I don’t know what stuff should I look for in order to do that?
    I’d like to have the results on a computer. During my classes, we worked with “Fluke” equipments and were able to give measure orders and stock the results. I’d like to do something pretty similar.
    If someone can help this way, it would be very helpfull!
    Thanks @ all

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 94,037 other followers