I would like to measure the power consumed by a mains device. I have heard that it's not as trivial as simply measuring the average current, as the device may be resistive, capacitive or inductive, and these things will measure differently.

Is there a reliable way for an MCU to measure the power used by a mains device if you don't know in advance if it will be a resistive, capacitive or inductive load? (Even if it involves measuring the instantaneous current and voltage at a high rate and using the MCU to keep track of the power consumed during each 50Hz cycle).

  • 1
    \$\begingroup\$ Try searching for "wattmeter with PIC" or with ATMEL on Google, I know of at least these two that can give you some results at large. Good luck. \$\endgroup\$ – Vlad Sep 3 '12 at 13:04

There are special data acquisition ICs for this, like this range by Analog Devices. They consist of 2 high resolution ADCs (Analog-to-Digital Converters), one measuring the voltage and the other the current. Two ADCs are needed because the measurements must occur simultaneously to get an accurate power reading. An internal computational block may calculate (reactive) power. Programmable gain amplifiers can set sensitivity.

They usually interface via a serial bus like I2C or SPI with a microcontroller. Some ICs used in kWh-meters give a pulse for a programmable energy unit instead, like 10 pulses per kWh.


The other day I opened one of this cheap energy measurement plugs. I found a measurement IC, I think it was one of these STM chips mentions in the answer from stevenvh, provide the measurement via a S0 pulse output. However, the wiring for that chips wasn't really simple. However, if it would be an option for you, do it the same way: get one of these plugs (below 20€ or so), open it, identify the measurement chip and use the output of it. The one I found had a S0 output with 500 pulses per kwh and a reference output with 3200 or so pulses per kwh. Use the one with the higher number of pulses for a higher resolution.

Yes, I know, this is at best a makeshift solution. But if you want to create a design, you at least would find the chip you can use.

And always remember: mains power is dangerous.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.