How to meassure power consumption of arduino?

Hello there....

I'm counting cars using an arduino and a light sensor. I have developed several software approaches to analyzing the sensor-data. I would like to compare the energy consumption of the approaches.

How would I go about it?

Thanks

I'm counting cars using an arduino and a light sensor. I have developed several software approaches to analyzing the sensor-data. I would like to compare the energy consumption of the approaches.

I don't think that this is a relevant thing to do. Power is consumed by hardware, not software.

Unless the software causes different behavior in the hardware, or puts the Arduino to sleep in different ways, the power consumption by the hardware won't change.

Do you have some reason to believe that the power consumption WILL be different that you didn't share?

Do you have some reason to believe that the power consumption WILL be different that you didn't share?

I'm expecting the power consumption to change depending on how many calculations I perform pr. time interval. No?

Not likely. Power consumption for a microcontroller is mostly determined by clock speed, operating voltage, and how many peripherals are powered up (A/D, timers, etc.) It doesn't matter so much what those peripherals are doing, just whether or not they are enabled.

Now for modern CPU's that do power scaling/throttling/etc. you will get varying power consumption as your code does more or less "work", but not for an AVR.

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, light sensor, potentiometers, pushbuttons

With modern PC processors the power consumption will vary with what its presently doing. I can't see an 8 bit micro-controller having the power management circuitry built into the chip to do this. Theres a big difference between a PC processor consuming a few tens or even a hundred watts or more (they blow out warm air for a reason :wink: ) and a micro-controller using a few tens of milliwatts........

I agree, the AVR is always running at full speed in some loop or another no matter what the code is performing so I would think the average DC current consumtion would be steady as long as it's not been placed in some kind of sleep mode.

Lefty

Hello everyone.

Thank you for all the input. Much appreciated.

I have different sensors:

  1. Proximity sensor
  2. Phototransistor
  3. Light dependant resistor
    4 ....

How would I go about measuring the power consumption of those? I would like to calculate an estimate of how long the device will be able to run a battery.

Thanks