Go Down

Topic: Designing for battery power (Read 2707 times) previous topic - next topic

Forkbeard

I recently made a gadget using an atmega328p which had to run on battery for as long as possible.
Lots of help from Nick Gammon's excellent page and many articles on measuring low currents.
However, there was very little to be found on measuring actual power consumption while the processor was doing things.
Further investigation located a paper outlining a very elegant device, accurate and affordable which should be on the top of any battery powered project wish list.

https://journals.sagepub.com/doi/10.1177/0020294018794350

Brilliant, isn't it....
They have even used it to measure the difference the compiler makes to power consumption!

Has anyone ever seen anything like it - or where you can get one?



Paul_KD7HB

I didn't read the whole thing, but do they ever mention how the calibrate the device?

Paul

Forkbeard

#2
Jun 20, 2019, 07:55 pm Last Edit: Jun 20, 2019, 08:02 pm by Forkbeard
Didn't really answer my question but to answer yours,

"To validate the microwatt-meter design, a known resistor,RLoad=218Ω, is connected as a load resistance to the microwatt-meter. The capacitor array, C=0.125F, is charged to a known voltage, then discharged through RLoad for a known period of time using the microwatt-meter which then measures the voltage across the capacitor array. This process is repeated for different time intervals."

It's sort of empirical. The circuit shows three trim pots, one for the divider for the analogue input and two for the comparator.
The results they achieved were within 1.2%.

Paul_KD7HB

Didn't really answer my question but to answer yours,

"To validate the microwatt-meter design, a known resistor,
Validate is not calibrate.

Paul

Forkbeard

By the conservation of energy, known resistor, measure the voltage and time. Just hope your multimeter is reasonably accurate....

It's really quite an elegant solution if you read it

jremington

#5
Jun 21, 2019, 01:55 am Last Edit: Jun 21, 2019, 01:56 am by jremington
Quote
on measuring actual power consumption while the processor was doing things.
On AVR based Arduinos, the processor power consumption is constant while "doing things". For example, in a wait loop, the same amount of power is consumed as in doing a series of multiplications.

What do you really want to measure?

Forkbeard

#6
Jun 21, 2019, 08:53 am Last Edit: Jun 21, 2019, 09:15 am by Forkbeard
@jremington I want to measure the actual power the unit uses during an operation.
My question was essentially has anyone seen anything that will do that accurately?

Let me give you an example from my recent project. I needed to flash an LED once a second for a period of up to 30 mins. I was using an RTC (DS3231) waking the avr from sleep by interrupt.
Now how much power do I save by waking it,  flashing the LED, switching power to the RTC, using I2C to reset the alarm flag, and putting it all back to sleep till the next second - by comparison with the many other methods?
And do I run at low clock speed or get it all done faster?
And how do I estimate the battery life of a setup that wakes up and does some measurements, records them and then sleeps again, without knowing the actual power used during each operation?
The answer is I needed to be able to measure power consumption and it is not easy.
If you scope a resistor in series with the power supply you will see the current is far from constant!

The processor is only part of the unit. And although it's current is constant for a single type of operation, doing arithmetic with different variable types does not use the same power. So an average program is impossible to estimate. Even compiler optimisation affects the power used.





jremington

#7
Jun 22, 2019, 01:21 am Last Edit: Jun 22, 2019, 02:23 am by jremington
Quote
doing arithmetic with different variable types does not use the same power.
That is not true for the standard AVR-based Arduino.  Drop your incorrect assumptions and move on with the project.

If you know the current used by the various LEDs, sensors, etc. during wake mode, and they are all off in sleep mode, then it is no problem to estimate the average current usage by ratioing the on and off times. Covered in great detail here.

Forkbeard

Project is finished and in service but I am certain it is not optimised.
If one is being pedantic, energy is the correct term and not power. Just add time.

Maybe my question was wrong. I was hoping for someone to help with finding a tool to measure the energy used in battery powered designs. For a good design it would be a priceless tool to help decide if method a or b is a better solution at each part.
As credited in my first post, I read and took full notice of Nick Gammon's page.

However the real answers are far more involved than you appear to intimate. And in battery use, every little counts. If you are not convinced, this paper actually quantifies some of the issues and produces some very interesting results.

Thanks anyway for your time.


https://www.researchgate.net/profile/Mohammad_Al-Shorman/publication/332539387_Toward_Energy_Efficient_Microcontrollers_and_IoT_Systems/links/5cbadf7c92851c8d22f7b76d/Toward-Energy-Efficient-Microcontrollers-and-IoT-Systems.pdf


jremington

#9
Jun 22, 2019, 06:44 pm Last Edit: Jun 22, 2019, 06:44 pm by jremington
Quote
However the real answers are far more involved than you appear to intimate.
How true! Just to pick two random examples, battery type and quality matter a great deal.

6v6gt

Well, if you are looking for a tool, the quoted Nick Gammon page has an example of a meter which can measure down to picoamps. https://simonselectronics.co.uk/product/ucurrent-gold/
Integrate current with respect to time ( picoamp hours) and multiply by voltage to get energy over the measurement period.

There is a limit to the benefits of optimization. For one of my atmega328p projects with a transmitter and IR leds, I am likely to have to replace the batteries ( 2 AA cells) , not because of the current consumption of the circuit, but because of the age of the battery, it's internal discharge rate and the risk of chemical leakage.


Forkbeard

#11
Jun 23, 2019, 07:09 pm Last Edit: Jun 23, 2019, 07:50 pm by Forkbeard
Quote
Integrate current with respect to time
Indeed.
I couldn't find a simple way.
My digital scope gives a lovely trace, sampled at tiny intervals but the data isn't available to do the calculation. And it's quite a complex waveform if you're waking up, doing some I2C etc.
Measuring the area under the curve (also integration) is pretty tricky.
I thought of building something to sample the output of a current to voltage converter (like the one you mention) but to get anything like an accurate answer, you need some serious electronics.
There's a nice box at https://www.qoitech.com/products but it's about $600

Using a big capacitor E=1/2C(V2 - V1)² seems a much simpler method and you don't have to measure microamps.

Maybe that has to be the next project....

wvmarle

This method relies on measuring the voltage of a capacitor to estimate the power used. Therefore, to work, there must be a significant change in the voltage of the capacitor.

That is a problem as the power consumption of microcontrollers and even the I2C bus depends on the supply voltage (lower current through the pull-up resistors as the voltage drops).

Now if you really want to optimise power consumption in I2C communication, make sure all unused bits in your data are 1s, not 0s. Transmitting a 1 takes less power than a 0. Of course minimising the amount of data transmitted helps as well, probably even more.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Forkbeard

#13
Jun 24, 2019, 01:22 pm Last Edit: Jun 24, 2019, 01:59 pm by Forkbeard
Quote
That is a problem as the power consumption of microcontrollers and even the I2C bus depends on the supply voltage
The Jordanian solution was quite elegant in this respect as they topped up a secondary capacitor from the primary one to provide a fairly constant voltage supply. This is what the comparator is doing.

Thanks for the challenge on the I2C bus!!
The time the system is awake for is a big factor too. So tight coding, good compilers, variable types, good use of registers and timers are all relevant. Reducing the awake time from 10ms to 9ms is a 10% improvement - one could get obsessive...

There are so many things that can affect the energy used in small periods of activity with external sensors, data transmission and storage etc. that it will be great to have a box with a display that tells you whether your 'improvement' really was or not. I long to get rid of the 'probably' factor!

I'm working on it....

srnet

#14
Jun 27, 2019, 09:09 am Last Edit: Jun 27, 2019, 09:09 am by srnet
Maybe my question was wrong. I was hoping for someone to help with finding a tool to measure the energy used in battery powered designs. For a good design it would be a priceless tool to help decide if method a or b is a better solution at each part.
A compare and contrast method of working out the amount of power different project setups use is fairly trivial.

See this report on how much power various combinations of GPS and antenna use;

GPS Performance


Note that the amount of mAhr a particular GPS uses is a real world value, not calculated or extrapolated from restricted measurements.

http://www.50dollarsat.info/
http://www.loratracker.uk/

Go Up