I was wondering if someone knew how to measure power/current and then interface it to a micro controller to store the data onto some external memory.

I basically want to measure the power a device is consuming and save the data.

  • 1
    \$\begingroup\$ Absolutely vital is to know if this is an AC load (eg mains powered) or whether powered from a DC supply. If from DC, what rate of load current variation and what duty cycle of power high to power low etc. Also what accuracy required and measurement period and if logging, what sampling rate. // If from AC, what's the load, eg resistive (eg heater) or partially reactive (eg AC motor). // The answers given are corre t but MAY suggest a solution which is more complex than needed in practice. Or may not. \$\endgroup\$
    – Russell McMahon
    Commented May 14, 2012 at 22:31

2 Answers 2


You need to capture the waveforms v(t) and i(t) at your target load. Then, multiply those two, to get the instantaneous power p(t)=v(t)·i(t), and finally (as is usually the case), average it over a certain period of time.

In summary, you need to do:

$$ P_{avg}=\dfrac{1}{T}\int_T v(t)·i(t)dt $$

You can do that either in the analog domain, using a somewhat inaccurate analog multiplier, or --preferably-- in the digital domain, using two ADCs (or a single ADC with two sample and hold front ends), and doing the multiplication and the averaging digitally.

See also this related answer.

One of the key things to emphasize is that knowing \$v_{rms}\$ and \$i_{rms}\$ is not enough to compute power, because -for instance- if v(t) and i(t) are such that there is no "overlapping" between them (v(t)·i(t)=0 for all t), then you could have zero power, but nonzero \$v_{rms}\$ and \$i_{rms}\$.

There are ICs that include two preamplifiers, two ADCs, and a digital multiplier, and simplify the task of measuring power flow.

  • \$\begingroup\$ thanks for that detailed information. this will help tons!! \$\endgroup\$
    – Edwin
    Commented May 15, 2012 at 5:56
  • \$\begingroup\$ Also worth mentioning is that if resistance, voltage, or current are a constant, you may only need one ADC or analog channel. At that point, the analog solution may win out if you don't already have a microcontroller. \$\endgroup\$
    – W5VO
    Commented May 15, 2012 at 14:33

Power = Voltage * Current

So measure voltage and current separately and calculate power of the device. I did an undergraduate project way back 10 years ago measuring the power consumed by various machines in a lab in college. Used special digital output current and voltage transducers which were connected to computer using serial ports. You can use any software or write your own code to get these inputs and calculate Real Time power.

  • \$\begingroup\$ "measure voltage and current separately and calculate power" Wrong. Read my answer. \$\endgroup\$
    – Telaclavo
    Commented May 14, 2012 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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