How Many Watts Are You Using?

One of the best smart home hacks is implementing an energy monitor of some kind. It’s easy enough to say that you’re trying to save energy, but without the cold hard data, it’s just talk. Plus, it’s easy and a great way to build up something DIY that the whole family can use.

[Bogdan] built up a simple whole-apartment power monitor from scratch over the weekend, and he’s been nice enough to walk us through the whole procedure, starting with picking up a split-core CT sensor and ending up with a finished project.

The brains of his project are an ESP8266 module, which means that he needed to adapt the CT sensor to put out a voltage that lies within the chip’s ADC range of 0 V to 3.3 V. If you’re undertaking an energy monitor project, it’s as easy as picking the right burden resistor value and then shifting the ground-centered voltage up by 1.6 V or so. We say it’s easy, but it’s nice to have a worked example and some scope shots. The microcontroller reads the ADC frequently, does a little math, and you’re done.

The rest of the code was borrowed from here or there. EmonLib takes care of the math, ArduinoOTA allows him to reflash the firmware over the air, and Blynk takes care of making a nice Android app for visualization. In the end, a nice dot-matrix LED display lets [Bogdan] obsess about every last Watt in his living room. Adding a second ADC channel to the ESP8266 so that he can get a bit more accuracy out by measuring the instantaneous voltage is probably a project for next weekend.

29 thoughts on “How Many Watts Are You Using?

    1. Also, I thought
      – adding a DC offset over an AC waveform should not produce a phase shift, as in the first chart from the blog
      – both voltage and current should be known when measuring AC energy consumption
      – power (W) and energy (Wh) should not be mixed as in the App’s display: “POWER USAGE 145Wh”

      Still, the project is a nice way to see and log an approximation of the energy consumption, and I really appreciate the effort of documenting it with physics graphics, charts, pics, code and explanations.

  1. What you wanted to say was “How much power are you using ?”
    please do not refer to a physical quantity by its unit name.

    We hear this a lot in the English language, same goes for current and “how many amps?”

    In most European languages this is frowned upon in schools and will cost you points.

    For me this is on the same level as getting capitalization right on SI units.

    1. meanwhile, on the other side of the world,
      i have to keep “teaching” people that current is the amount of amps, NOT VOLTS. television is teaching people that current and voltage are interchangeable and mean power(ugh), and amps are the most dangerous type of electricity. … and i quote “…120 volts of current…”

      we all say voltage around here, so amperage should also be okay.

      they get all pissy when i tell them voltage is not a technical term, OR EVEN A WORD, but they SWEAR they learned it in high-school.

      PS: voltaic-potential-difference, you reeeally want to say it every time the “voltage” changes?

      PPS: maybe it’s electron-potential-difference ? im not quite sure but my point still stands.
      now time for some tuning-derrived music-station selection….. TUNEAGE!

      1. i agree, it is likely because in English the physical quantity name and unit name are the same for Voltage that this is accepted for U, I, R, and apparently P too.

        In Dutch, French and German the names for the physical quantity Voltage all translates to “Tension” in English.
        Dutch: “Spanning”, French: “Tension”, German : “Stromspannung”.

        Yet for other quantities, it is less heard. You do ask about capacitance rather than “how many Farads?”
        or “How far?”, or “what’s the distance?” instead of “how many miles?”

    2. Not sure what you wanted to say, but what you did say is ‘I am a pedantic dick’.

      And you said it with poor grammar and incorrect punctuation, which I’m sure is on the same level as getting ‘capitalization right on SI units’ to a lot of people.

  2. There are parts designed for the smart meter market that will make meter-grade measurements (hint: they measure voltage and current, at the same time and compute power factor.)

      1. @evad: not a hack.

        @Eduardo LP: It’s closely related to a unit called a Watt, at least according to the commercial meter that he calibrated to. And that’s probably only 5% accurate at best. So meh. If the Kill-a-Watt gets to use “Watt”, so does Bogdan.

  3. I see he is using a current transformer, but is he reading the line voltage as well? I did not see that. The ESP8266 has but one analog input and I did not see any kind of an analog switch to go from reading I to reading E. Last time I checked you needed both to calculate power.

    1. Skipping the voltage readout and using only a current transformer will indeed not give you the answer to “HOW MANY WATTS ARE YOU USING?”, but it is a good enough approximation. The biggest advantage is that you don’t have to work with high voltages, assuming you can stuff the current transformer in the junction box without any need to rework the wires.

      1. Yeah, he’s only measuring the current, and the code assumes some power factor or other. But Bogdan calibrated against a commercial wattmeter and got within a few percent. Good enough for an informational/relative measurement. And good enough that I’d tell my wife that it was measuring “watts”. Maybe not good enough for NIST or the power company…

        He even suggests at the end of his post that he could get a dual-ADC chip to add to the system to get more accuracy, but right now he’s stuck with the one ADC on the ESP8266.

  4. For correct measurement of power you do need to measure the voltage and current at the same points in time. However, your mains connection is basically a (more or less) constant AC voltage source. I’d say measuring current only and multiplying it with nominal voltage would get you a ballpark estimation of your power consumption. It wouldn’t be a fair measurement for billing purposes, but for users’ own estimations of power consumption, it is probably mostly sufficient.

  5. Cool project! For those who don’t have the time or energy to partake in this, you can buy a WiFi enabled switch with an ESP8266.

    It uses a shunt resistor, so it needs to be installed in line, and is only rated for 15A (so ~1.8kW for 120V, ~3.3kW for 240V) There are many open source firmwares available (such as espurna).

    https://www.itead.cc/sonoff-pow.html

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