measuring the power by arduino

please i want to ask how can i measure the AC or DC power for a certain device and thanks in advance

Use a multimeter to measure the current (I) draw of the device. Multiply by the device supply voltage (E). I * E = power.

With AC that only works for resistive loads and sinusoidal waveform. So is the device resistive? Is the AC sinusoidal?

The full-blown method that works for everything is to measure the voltage and current repeatedly and sum the product of I and V over time - this gives the true power consumption if the sampling is fast enough. It works the same for DC, sine-wave AC, square-wave AC or whatever.

If you know the nature of the waveform and the load you can cut corners and use a multimeter..

Some DMM do offer true RMS reading of AC waveforms. Measuring accurate AC current is not as simple as i might first appear to many.

Lefty

Measuring "AC power" by the product of voltage and current simply gives VoltAmps, which is only the same as Watts if both voltage and current are in phase.

To measure true power you need to include the power factor term (usually referred to as Cos Phi) which for anything other than a purely resistive load is always less than unity.