## power meter?

12 posts / 0 new
Author
Message

hi everyone...

I'm interested in measuring the total power usage of my battery powered AVR creations, and I'm wondering what would be the best way to do that. Resolution and accuracy aren't all that important -- I just want to be able to predict roughly how long the device will run on fresh batteries. Is there a cheap/easy way to do this? I could do a bunch of guesstimating, but since it will be going into sleep mode often, I'd really like to get some real-world numbers.

Thanks!

I think its as simple as measure the volts and amps... example... 4 AA cells...4.8V gizmo draws .1A. 4 batteries in series ea 1000ma-hr, whole string is 1000ma-hr... gizmo will run for 10 hrs pullin .1A If it runs with a 10% duty cycle, then it will run 10 times the 100% time.

Imagecraft compiler user

well lets say you have a battery with a capacity of 1000mA. This also means 1000 mAhr which menas you can use 10 mA for 100 hours, or 100 mA for 10 hours, etc. to figure it out, the product of the mA usage and the time (in hours) has to equal 1000.

This would lead me to infer that if you have a meter to measure the power draw, then you just continuously take readings and integrate the power usage vs. time.

So if you want to reduce the 1000mAhr to something usable on a uC time scale. you could reduce it to 3,600,000 mAs. So when you intergrate you could subtract that away from the above. so if you use 10ma over 10s and 100mA of 20s it would come out to the same units becuase you would have used 100 mAs + 2000 mAs.

so then your remaining power would be:
3600000mAs - 2100mAs = 3597900mAs remaining.

Or I assume you could do the whole thing in units of WHr if you plan on using different voltages. If your running through a power regulator (ie. 7805 5v reg.) then you can stick with the approach of a constant voltage.

I have never attempted anything like this before so if any vets post after me please point out if I did anything wrong.

-John Gutmann

Measure the operating current and measure the sleep current. Once you know these, its just a matter of figuring out what proportion of time the micro will be doing either - this will give you the average current over X time. Work this into the mAH rating of the batteries will give you an reasonable estimate. The actual mAH rating of the battery depends on how much current you're pulling from it - less current = more energy harvested, more current = less energy as energy is lost by heating etc. Also as the battery ages, the amount of energy it stores will decrease. so run some numbers, and do some tests. You can always simulate a higher current draw and extrapolate your battery life from that.

The standard way to do this is to run all the current thru a very low ohm shunt resistor and measure the voltage across using an ADC after it has been suitable amplified. Atmel makes an AVR group with opamps built in specifically for this purpose and has ap notes on it.

Smiley

LT and Maxim have 'hi side current sensors' with a lo ohm R in series and an amp with gain to give a V out proportional to I

Imagecraft compiler user

Sense resistor and a good digital volt meter will work fine if it stays in each mode for more than a few seconds. But, then, most digital volt meters have ampere scales so why bother with the shunt; it already has one inside!

Jim

Until Black Lives Matter, we do not have "All Lives Matter"!

Kartman - thanks for the pointer on how battery life is affected by current draw. I could go through the process of enumerating all the states the device could be in, estimating the percentage of time it's in each state and determining the current consumed in each state, etc. etc., but I'd really like to just measure current used under some real-world conditions.

Smiley - are you talking about the atmega406? I'll have to look into that one.

http://buzzing.cs.berkeley.edu/~...

and it has a very interesting idea - use a sense resistor with a voltage to frequency converter. Supposedly it has "infinite resolution", so all those nanoamps the AVR spends in sleep mode will eventually get counted if you wait long enough.

I started reading that pdf file and an idea popped into my head.

Suppose you use a simple circuit that has a capacitor for storage of energy and use PWM to charge the capacitor to a specified voltage. Monitor the voltage and pulse when it falls below a threshold. I have some DC-DC converters that do this. Now count the pulses needed to keep the capacitor at that level. Take into account the leekage of the capacitor, actually you could make the system autocalibrate this over a time frame before connecting a circuit to the power supply.

My assumption is you don't have to measure the actual current because you know the time relationship and current needed to keep the capacitor at a specified voltage. A test circuit of a known resistance could be used to calibrate the initial numbers used for the conversion of number of pulses to energy units used.

Sound good?

If I understand what you're saying, you are proposing to measure current draw by keeping track how much work (in terms of charging impulses) you need to perform to keep a cap at or above a certain (fixed) voltage.

I think it should work, and it would be a simple feature to add to any uC-based DC/DC converter. Calibration would require a little careful thought, but still the integrated current should still be proportional to the number of charging impulses.

I think VFC's work pretty much the same way, perhaps with some roles reversed. For instance, have a look at the LM331 and in particular this app note:

http://www.national.com/an/AN/AN...

I've not done the analysis but I do use battery powered AVRs. In particular I use the Butterfly that has the mega169 chip. Lately they use the low power 169p chip.

When I'm programming it, I monitor the current draw to make sure I'm doing it right. It's important that the proper sleep level is being used and it's important that power hungry peripheral devices are disabled when sleeping.

To measure the current draw I use a DMM that has a 200 mv range. This can display volts to the nearest 100 microvolts. I put a 100 ohm resistor in series with the Butterfly, and measure the voltage across it. The DMM reading is then the current draw in microvolts. Some say it can't be done, but my experience shows that the Butterfly works fine this way. Amazingly I can also program it via the RS232 port when powered this way. The only thing that doesn't work is the on-board DataFlash.

My mega169 is sleeping most of the time in PowerSave mode. Once a second it gets an interrupt from the crystal controlled oscillator and updates the time of day.

In my application, every few minutes it will do an analog to digital conversion. It might then log the result to DataFlash, or send a signal to another device. As this happens so seldom, and so quickly, I am ignoring it.

I normally measure around 2 microamps when my application is running. There is a brief flash on the display once a second. The display usually shows around 12 microamps during that brief flash but I guess that reading is worthless. If I run the built-in LCD display I measure around 24 microamps. If I run the UART I need to use Idle mode sleep and it draws around 430 microamps. This is with the low-power 169p. When using the older 169 it shows around 9 microamps with nothing else running, and maybe 30 microamps with the LCD running.

I need to do no further analysis because the program that comes pre-installed on the Butterfly also updates the time of day and it will run several years on the built-in coin cell. I'm guessing my application will also get about the same battery life.

But if I wanted to see what the power consumption was during the once per second processing, I would try to do it this way. I would change the code so this normally once per second periodic processing would run continuously. I would then measure the current draw. Then I would count how many times this "periodic" processing occurred in one second. Now I just have to do the math. If I found this "periodic" processing ran 1000 times per second during the test I would know that each periodic processing took one thousandth of a second. Or to put it another way, the periodic processing normally runs one thousandth of the time. I would then divide the current draw I saw during the test by one thousand, add it to the 2 microamps drawn during sleeping, and that would be the average current draw.