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.

    • BillNo Gravatar says:


      Right now I can get measurements at about 2-3Hz, but that’s because of how long the the slow software implemented serial I used to send the data out. You could tweak the code to get many more measurements of a single aspect (like PF) and send out the group of measurments.

      PF was one of the hardest things to confirm accuracy, because I don’t have any proper power gear to compare it too. I used a multiple channel o-scope and measure the zero crossing of voltage and amps and computed PF by hand and my power meter was fairly close.

      My design for this was quick, to use minimal components, and wasn’t really designed for things like accurate PF measuring, just a number close. With all the interest, I want to try to design another version that is more accurate and capable.

    • RyanNo Gravatar says:

      Would like to buy a pcb also!

    • Dave BushongNo Gravatar says:

      Last year I bought a commercial product from BlueLine that performs roughly the same function as your great idea does, Bill. I think it was around $80 Finding out where the power goes was very enlightening and just knowing this helped me lower my electric bill by around 10% by just being aware of the facts, and adapting. The Kill A Watt works for individual things that plug in, but for things that are hard-wired into the house, it was still a guess.

      One of the extra features that this commercial product has is the ability to program it to show dollars and cents on the display instead of watts. This is helpful for people in the household who can’t do math in their head. Another great feature is the way it forecasts your next-month’s electric bill in dollars.

      These things are, of course, purely value-added software to the sensor itself, and only add to its usefulness. I suppose that there might be 99 more great ideas that can use this project as a starting point. It’s is probably worth mentioning that none of them are much value if the original power consumption data is in error, or not dependably accurate. Thanks to Bill for carefully making sure this was faithfully done in his design.

      For anyone who attempts to duplicate his project and scrimping on the current sensor, please be sure that you don’t sacrifice accuracy for saving dollars or pennies. You can read out the result to four decimal places and yet your answer might be off by a huge amount… if your current sensor is no good.

      Thanks to Bill again! Great project!

    • KishanNo Gravatar says:

      Don’t know if you have any PCBs left, but I’d be interested in 2 to 4. If you are going to order another batch, I could just contribute to that, if you are interested. Thanks!

    • DavidNo Gravatar says:

      I doubt you have any PCB’s left, reading through the comments there were a lot of people saying they would be interested. But I figured I would ask anyway. If you do have some left, or are going to do a second run, please let me know. Thanks!

    • BillNo Gravatar says:

      Yes please, anyone interested in a PCB please continue to add a comment with a working email address. I’ll contact everyone in a week or two (when I get back from travel) about setting up a group order.

    • Ryan ShatfordNo Gravatar says:

      I have been wanting to do something like this at my place for a long time. I’m in ireland, so i’ll understand if I can’t get shipped a PCB.

    • BillNo Gravatar says:

      I’ll ship a PCB anywhere you are willing to pay, and it wouldn’t be much more then $6-8 total.

    • DaveNo Gravatar says:

      What was the total cost for this project?

    • StacyNo Gravatar says:

      I would like a pcb as well. Will sell a complete kit?


    • BillNo Gravatar says:


      Cost of development was high, like usual, but cost of parts is rather low. Clamps are $30, and the rest of the parts is around $20 max.


      Yeah, I’m thinking the same thing, and also a quick redesign with some additional features that people have been asking for. I will be keeping everyone that drops a comment for a PCB with a valid email address in the loop to what’s going on.

    • NateNo Gravatar says:

      Would love to get this PCB! When you put together an order let me know and I’ll send $

    • Bill KearsonNo Gravatar says:

      Great project. Where did you get the current clamps at? I was looking at buying the clamps that come with the TED units but could not find any specs.
      Thank you,

    • BillNo Gravatar says:


      Man, there’s been a lot of comments on this. I posted the source of the clamps way back in the first page of comments.

    • AdamNo Gravatar says:

      I am interested in getting a PCB.

Leave a Reply

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