Not So Tiny Power Meter

Posted in Projects, Software Libraries, Tutorials by Bill
19 Dec 2010
Not So Tiny Power Meter

The Kill A Watt is an awesome product; it measures volts, amps and power factor of an individual appliance which can be used to calculate power, cost to run, etc. It’s also quite hackable. But I wanted something that would give me the same data for my whole apartment. After some Googling, the best I could find was this project from picobay, but I didn’t want to invest in an expensive network IO platform. There were also some off-the-shelf solutions, but they too were expensive and limited. Well, time to design my own solution then.

Enter what I call the ‘Not So Tiny Power Meter’. The catchy name comes from the microcontroller I used, ATtiny85, and some sizing issues I had with the enclosure.

I started out with a plan to use volt-meter current clamps just like the project I linked above (photo of clamp from and use a dedicated chip, the AD736, to convert the AC signal off the clamps to a DC voltage representing the RMS current value. The chips are expensive, tough to use as I found out, and still require external amplifiers to scale up the value to 5V ADC range. So I nixed that idea. Instead, I decided to use a single op-amp to scale up the AC voltage off the clamp and sample it directly with the ATtiny’s ADC. The circuit would be cheap and easy to design and I can convert the signal to RMS in code.

Then I had a thought. If I’m sampling directly, why not measure more than just amps? As an EE, I’d love to know more about my power usage, like power factor, frequency, and a more accurate measure of power by not assuming a voltage like most other projects; but I still wanted to keep the device simple. Then I had another thought: Why not measure voltage through the same transformer that’s giving my circuit power? After a few tests, I found that a properly designed rectifier and regulation circuit wouldn’t distort the source AC waveform too much. They key was to keep the values of the capacitors before the voltage regulator (circled in red) to a minimum, just enough to support a stable DC voltage. Anymore and the inrush when the rectifier diode starts conducting severely distorts the AC wave form.

My design is simple. An AC transformer powers the circuit and a voltage divider drops the source voltage down to ADC range for measuring. A dual sided half-wave rectifier and regulation circuit provides +5V and -5V rails. The AC signals off two AC clamps are scaled up using two op-amps. I planned on using trim potentiometers to calibrate the gains of all the measurement circuitry, but found it was easier to just use transfer functions (found with experimentation) in code.  Everything is measured with an ATtiny85, and transmitted out of the breaker panel by a cheap RF transmitter. Since all sources are AC, the ATtiny could only read the positive half of the waveforms. When the signal would go below the ATtiny’s GND, the protection diodes and input resistors would protect the ADC pins from damage.  With this design, I can measure voltage & frequency off one phase and current & power factor off both phases.

(Circuit Diagram, Click for Full Size)

The theory of operation is simple. First, the ATtiny85 will repeatedly sample the volts ADC pin for over a full period of the 60Hz sine wave. The peak value of the samples is remembered. Repeat for both current clamp ADC pins. After the max values are captured, the ADC clock is increased for faster sampling, with higher errors. To measure frequency and power factor, I used a 8 bit timer that  I extended to 16 bit in software. Using the timer, I measure the difference in time between two peak values of the voltage waveform. Then, I measure the difference in time between a peak value of the volts waveform, and a peak value of the current clamp waveform. Repeat for the second clamp. After all these measurements, some conversions are done to convert the peak values to RMS, times to frequency and power factor, run through a transfer function to account for various gains in the circuit and transmitted out via software serial as ASCII sentences with checksum.

Comparing to real measurement hardware, my project had respectable measurement accuracies of:

  • +/-  1 Volt,
  • +/-  1 Amp,
  • +/-  2% for frequency,
  • +/- .03 power factor when current is above 10 amps.

The circuit is designed for 120 Volt, 100 Amp mains, but can be adapted for other systems.

I ran into a few issues through the course of my project. The first issue was with the enclosure. All good projects should be protected by an enclosure, especially when installed into a breaker panel. First my poor planning resulting in a enclosure that was too small to house all the banana jacks for the current clamps. Then the second enclosure didn’t match the mechanical drawings provided by the manufacture. What stinks is I already had PCBs made to the spec of the drawings before I received the case. O well, time for double stick foam to mount the PCB instead inside an overly large box (part of the irony of the name).

The second issue was the quality of the signal off the current clamps. When using function generators for testing and programming, I could measure frequency, power factor and max value with great accuracy. The noisy signal off the current clamps is another story. Really, power factor measurements with currents less then 8~10 amps are very noisy.

Third, I originally used 434Mhz radios, until I realized it is the same frequency as my external temperature/humidity probe for my clocks. I quickly changed the radios to the lower frequency versions.

Anyway, I got the project built, tested, and installed into my breaker panel. Everything is internal so nothing extrudes. Right now, the data is received by another one of my projects, an Arduquee display. The display just shows live power usage. I plan to experiment with data loggers to log the data and/or play with the Google PowerMeter API to send the data into the cloud. This project was just to build a sensor to get the data out of my breaker panel.

Here’s some photos from the build, and the installation into my breaker panel. Click for larger pics.

Quite a workbench

Checking the signals

Installation into panel


The temporary LED display showing power (Watts), now hanging on my wall. Notice the RF receiver on the left.

My design is open-source. All the theory of operation is well documented in my code, and all code and Eagle PCB files are available to download:

Not So Tiny Power Meter files(zip)

I even have extra PCBs for any that what them, $5 plus shipping. Drop me a line in the comments if interested.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.


Warning: count(): Parameter must be an array or an object that implements Countable in /homepages/46/d285670699/htdocs/bill/wp-includes/comment.php on line 879
  1. 135 Comments.

    • Jason JankaNo Gravatar says:

      Oh man that is awesome Bill! I’d love to buy an extra board if you have any. I’ve been trying a few solutions to measure mine but all were lacking. I was looking at the TED 5000 but the price is pretty insane, especially once you start monitoring more circuits. As you want to monitor more circuits with your setup, the only additional cost is the clamp, correct?


    • John ClintonNo Gravatar says:

      Bill, you might enjoy reading how I used products from OnSetComp to monitor my home electrical usage:

      Take care,
      John (jjarrettc)

    • BillNo Gravatar says:


      It would take a little more then that. I purposefully chose the minimal components as possible for this project. The ATtiny MCU only supports 3 ADC channels (ignoring the one on reset), and I’m using all three. To expand to multiple monitoring points would require an upgraded MCU or a analog mux. Though all the interest in the project has made me want to revisit the drawing board for a more complex and robust design.


      Awesome. Yeah like I told Jason, all the interest in this project has made me want to take another pass on it. A system that can use smaller Hall Effect sensors and more of them to monitor power flow.

    • byronNo Gravatar says:

      Here’s my line dropped where I would love to have a PCB 😀

    • DavidNo Gravatar says:

      Hi Bill, Nice work ,but why did you use those big meter clamps? There are lots of cheap alternatives out there that work as well if not better. For example; over at they have some nice professinoal AC current sensors available:

      SKU: THM104C4B, 30 Amp… $9.50 USD ea.

      SKU: THM105C4B, 100 Amp… $11.50 USD ea.

      Regards, David

      BTW, I’m not affiliated with Seedstudio.

    • Ov3rTheHillNo Gravatar says:

      Nice! I have been using a commercial monitor (a CurrentCost ENVI, which does not come with its own graphing solution, but points to several sites where both open and closed source graphing solutions can be found. Possibly of interest to you might be Paul Mutton’s graphing solution, for the CurrentCost but certainly adaptable to yours:
      His graphing solution uses RRDTool on Linux to both log and generate single layer graphs.

      With a 6-second averaging interval, I am able to see current variations that speak to the possibility of an unexpected variable speed fan in my furnace, an underdamped refrigerant pressure oscillation in my air conditioning system, and a beautifully critically damped current flow on my new variable speed pool pump. No overshoot or ringing on that thing at all — and it saved 12 KW-H/day alone over an old 1-1/2 HP induction motor pool pump. I was also able to see that my medium sized home was never burning less than 900 Watts 24/7. Much, but not all of that, came from an office copier, office equipment, cable TV boxes, several computers, a water cooler and a few lights all on 24/7. Remediation included turning off that gear when not in use, going to CFLs and LED lighting, putting countdown timers (GE has a nice 12-hour model at Home Depot suitable for use in single-wide electric switch boxes) on things like computers, the TV and DVR and cable box. That saved another 15 KW-H/day. Altogether, being able to measure whole-house usage, graph it, recognize individual loads has allowed me to work out the amortization of my investment of about $2000 — it will all be paid off in less than two years.

      Graphing, with fraction-of-a-minute (6-seconds per data point) resolution I find is key to identifying individual loads when using a whole-house power monitor.

      I don’t believe the device I’m using has power factor correction nor does it have actual voltage measurement. It says I’m doing 17 KW-H on days when my reads of the electric meter say I’m doing 21 KW-H/day. But so what! Identification of individual loads is possible with 6-seconds per data point, and real time graphing. After a few weeks of comparison of rolling average KW-H results from my measurement device against readings from my power company’s meter, I know what the conversion factor is so that readings from my whole-house monitor tie out to my power company’s watthour meter.

      Summary: High accuracy, even PF correction, I find not as important as fine resolution in the time domain of realtime measurements. These are useful for identifying and controlling use of individual surprise heavy loads. But for follow-up on my remediation efforts, nothing beats logging the readings off my old analog watthour meter, keeping a running average, and seeing how that ties out to my next power bill.

      My power company has a tiered rating schedule — $0.12 for the first 1000 KWh in 60 days, a few cents more per KW-h for the next 2000 KW-H in 60 days, and a few cents more for the next 3000 KHW/60 days. Might not sound like much but when I did a spreadsheet of how many continuous Watts comsumption were required to hit Tier 3 in 60 days, it came out to about 2100 Watts continuous 24/7. That might sound like a lot, but with a 5KW compressor on my Air Conditioner, and all that other excess load, it was all too easy to hit.

      A couple other surprises from home power monitoring: An again 13 Watt CFL bulb was actually burning 39 Watts. The base of the bulb was turning brown. Out it went! Another surprise was that a 9 bulb chandelier with 40-Watt Incandescent bulbs left on for 8 to 12 hours burns up to 4 KW-H/day — that was a biggie! Sure I should have known that, but I hadn’t until I actually *saw it* on my whole-house graphs. That usage justified replacement of the incandescent bulbs with nine $20 LED bulbs.

      Two years and everything will have paid for itself — the monitoring equipment, the variable speed pool pump, the LED bulbs, everything. And It’s all gravy after that.

    • BillNo Gravatar says:


      The clamps were cheap ~$10-15, and I had seen them on other similar projects. I’ll have to take a look at the SeeedStudio products. Though for monitoring your utilities, 100 Amps is on the low side of what’s out there. A lot of residential services at at least 150 Amp services if not more.


      Man, what a comment! Thanks for your stories. The difference in your meter vs. the company’s meter was due to the difference in voltage I bet.

    • Ross NeugeborenNo Gravatar says:

      I’d be interested in buying a PCB. I’ve been trying to hack together a project like this for a while – originally to monitor a site to size an alternative energy system.

    • JackNo Gravatar says:

      Hi Bill,
      I’d be interested in buying a PCB if I can get one.
      BTW – Happy Holidays!


    • coryNo Gravatar says:

      I would be interested in purchasing one from you.

    • Dill an LaughlinNo Gravatar says:

      I’m interested in Buying a PCB.

    • MarianoNo Gravatar says:

      Bill, we use Analog Devices AD7755 and AD7761B dedicated microprocessors (meter in a chip) in our meters (see working throughout Latin America.

      Your project is very interesting. You’re reading power factor which we don’t, or can’t, with with our current gear. It seems to me that with your true PF readings and 6-sec data points you could also read harmonics. Pls comment.

      Re your +/- 1 Amp accuracy. Theoretically it’s +/-1% or Class 1 in meters (100A), but most homes hover around 30 amps which would make the accuracy to in the >3% range.

      I’d like to talk with you. Please send me an email.


    • Bake KingNo Gravatar says:


      I’d ABSOLUTELY be interested in buying a PCB.

      Let me know how to go about it!

    • AustinNo Gravatar says:

      This looks very similar to a commercial product that works with Google Power but DIY’s are usually more fun.

    • Jae StutzmanNo Gravatar says:

      I’d be interested in a PCB if you still have them!


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.