noob: measure arduino power consumption

I ve seen many posts on measuring power consumption of a circuit with arduino and sensors and I am confused :-[
I need these info to estimate the size of batteries to use

If I just take 5v from arduino, add a resistor ,connect an analog input and the second end of the resistor to the ground am I going to get accurate measurements?

what value resistor should I choose?

You don't measure power by measuring voltage. You need to measure the current taken by the arduino. To do this you put the meter in series with the power lead. No resistors involved.

Thank you for the answer Mike

I want to use the ADC as a meter..so I thought that I know the arduino voltage =5v , I add a resistor, i measure the voltage drop on the resistor with the ADC and I get the current by ohms law...

isn't that correct?

In theory that is correct but the problem is that you are asking the arduin to measure it's own current. The problem with that is that if the resistor is in the supply then the voltage drop across it is by definition sitting at a voltage higher than the arduino can measure. This is because you can only measure up to the supply voltage.
If you use resistors to drop down the voltage there is nothing much of the voltage to measure.
Say you have a 50mA load, then using a small resistor say 10R in line will drop 0.5V. This then only gives the arduino 4.5V to work with and the maximum voltage it can measure is 4.5V.

.so I thought that I know the arduino voltage =5v

But once you introduce the series resistor it is working at a voltage determined by the current draw. This is a bad thing to do electrically as it increases the impedance of the supply and that can lead to all sorts of malfunctioning.

Wind back a bit and think exactly what you want to measure and what parameters is it likely to be within.

ok Mike...i'll give it more thinking...
thank you

From the batteries perspective the total power consumed is just the battery terminal voltage times the battery current being consumed. Just take a digital multimeter and measure the current being consumed from the battery by placing the meter leads in series with the positive wire going to the Arduino external power connector or the Vin pin, which ever one you are using. From there you can calculate battery duration based on the mAH rating of the battery.

Lefty

Thank you Lefty for the reply

I already did that but I am looking for a way to use the ADC of arduino to do the measurement so I can log the results!

so I can log the results

Are you expecting the current consumption to change as the arduino runs, it won't normally unless you are powering something that changes what current it takes.

I already did that but I am looking for a way to use the ADC of arduino to do the measurement so I can log the results!

Ah I see. Well it won't be just a simple analog read as you will in software have to keep a total mAH consumed totaled over time to then have a handle on remaining charge available in the battery. What are you trying to determine with the value you log?

a simple battery terminal voltage reading will give you a rough idea of the state of charge of the battery, especially for Li-po or lead acid batteries. A simple voltage divider can be wired to a analog input pin to scale the battery voltage for the 0-5vdc range of the analog input pin and the voltage should drop over time as the battery discharges. ni-cads and nimh batteries have much flatter discharge curves so you only get a drop towards the very end of discharge.

One method of measuring real time current is to use one of those specialty hall effect ICs that output a voltage proportional to the current passing through it's sensing pins. Sorry don't have a device number handy.

Lefty

thank you very much Lefty for your replies