# 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.

## 28 thoughts on “How Many Watts Are You Using?”

1. GR says:

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. Kuro says:

The current transformer should produce a phase shift, but the project page says nothing about it.

2. kt819gm says:

Weemos module is using voltage divider.

2. Ostracus says:

Rather timely project in a smart meter world.

1. epitaxial says:

Who says smart meters are accurate? Wasn’t there a post here recently saying they varied from -30% to +500%?

1. Ostracus says:

Which is ironic in the context of Evad’s comment below. Yeah, use those parts, but…

3. not_bty says:

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. NewCommentor1283 says:

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. bty says:

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?”

1. Broti says:

there’s nothing like “Stromspannung” in German. That’s as stupid as mixing up voltage and current… It’s just Spannung. Dankeschön.

2. RW says:

Never looked at a used car and asked “What’s the mileage?” ?

2. Jerry says:

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.

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.)

Sorry bodgan, but this device shows a number, that resembles something, that seems to be related to some other thing, that doesn’t make sense.

@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.

5. Phrewfuf says:

In the headline picture, is he measuring power on the yellow-green wire? Shouldn’t that be the grounding wire?

1. Artenz says:

Looks like the brown wire

6. Installing current transformers can be a bit tricky as you have to separate the live wire from the neutral. There are some hall sensor based chips which can be installed externally to the cable. You just have to calibrate them with a known load prior to use:

https://moderndevice.com/product/current-sensor/

1. Yes, there are quite some projects looking into separating the readout from circuits using hall sensors. I highly doubt calibration is that easy or stable. I did a tiny bit of experimenting myself and such a method is a lot harder to achieve good results comparing to a bit of wire fiddling to get the transformer in.

7. reggy says:

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.

8. salec says:

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.

9. hmartin says:

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).