How to: power consumption of intermittent, spikey projects

Go To Last Post
39 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Seriously, how do y'all work out power consumption of interrmittent, spikey projects? I generally use one of two methods:

a) Measure the running current by disabling the sleep, measure the sleep by disabling the run, doing the math(s) according to the real run/sleep ratio.

b) Use my PC scope to record the voltage across a shunt, then using the RMS(IIRC) function.

 

Neither of these are ideal. Is there some specialist IC or circuit that does this sort of thing? Some sort of fast integrator or similar?

 

 

Quebracho seems to be the hardest wood.

Last Edited: Wed. Dec 6, 2017 - 11:49 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

John_A_Brown wrote:
Seriously, how do y'all work out power consumption of interrmittent, spikey projects?

That's a very good question which deserves splitting-out to General Electronics for a proper discussion ...

 

EDIT

 

Now split; it was originally here: http://www.avrfreaks.net/comment...

 

Last Edited: Wed. Dec 6, 2017 - 11:59 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

John_A_Brown wrote:

Seriously, how do y'all work out power consumption of interrmittent, spikey projects?

 

You buy a starter kit with on-board energy monitor and use it to monitor an off-board device...

 

https://www.silabs.com/community...

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:

John_A_Brown wrote:

Seriously, how do y'all work out power consumption of interrmittent, spikey projects?

 

You buy a starter kit with on-board energy monitor and use it to monitor an off-board device...

 

https://www.silabs.com/community...

Which appears to be doing pretty much the same thing as my PC scope method, but with a slower sampling rate, unless you know otherwise.

 

Quebracho seems to be the hardest wood.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As Brian says, many dev boards now include power measuring facilities.

 

I also tend to use the scope-and-shunt method - although I find that a current-sense amplifier is useful to get a cleaner signal for the scope.

 

This came from a thread about Dave Jones - he has a little unit:

 

µCurrent GOLD

https://www.eevblog.com/projects...

 

If you have £50k to spend, you could get one of these:

DC Power Analyzer Image

https://www.keysight.com/en/pc-1...

 

I don't have that sort of money, but have worked for a client who had one - it really is the Proper Way to do this!!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wrote:
many dev boards now include power measuring facilities

and it's not just the dev boards - they often include support in their IDE.

 

Keil is jumping on the bandwagon: http://www2.keil.com/mdk5/ulink/...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

what is your spike?

is it just in <run> or <sleep> or are there other levels?

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here's a fairly typical one:

 

That's a LoRa node

 

 

This one is GSM:

 

It's not simple!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have the Dave Jones current sense, thanks.

It's integrating the power consumption that interests me. I can't help feeling there's some analog way of doing it, but go ogling(as my smartphone writes it) says no.

 

Quebracho seems to be the hardest wood.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I upload the data from the scope (as CSV), and do it in Excel, or a Python script; eg,

 

 

This is the kind of thing that the tools I mentioned earlier do for you ...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

  I can't help feeling there's some analog way of doing it

For a fast way to get an idea of the power use I have used a big capacitor as a battery, and then see how long it takes for the voltage drop from let's say 5V to 4.5. And then scale it up. (make sure that the cap. can give the power for the high spikes).  

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Edison once asked one of his engineers to provide him with the volume of one of his light bulb envelopes, after watching him wrestle with the calculations of the odd shaped bulb for several minutes, Edison grabbed the bulb, filled it with water, then poured the water into a beaker and read the volume from the scale.....

 

Perhaps you could use one of the coulomb counting ic's and have it measure the current consumed over a fixed time interval.....

 

https://learn.sparkfun.com/tutor...

 

Jim

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes,  I've toyed with that as an idea - must try it some day!

 

But it doesn't help in analysing the power "profile" to see where it's going - and, thus, where to focus optimisation ...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

Yes,  I've toyed with that as an idea - must try it some day!

Yea, me too! So much to do, so little time!

 

awneil wrote:

But it doesn't help in analysing the power "profile" to see where it's going - and, thus, where to focus optimisation ...

Your correct, I wasnot thinking of optimization of functions (not sure what I was thinking!)

Time for more caffeine!

 

Jim

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wow, I like that Keysight instrument!

 

John, your two methods sound fine, but obviously each has trade offs.

You ought, I think, check the sampling rate on your O'scope's RMS function to see if it is sampling fast enough to catch the spikes your system generates.

If it is sampling too slowing and you miss a large portion of the spikes, then your reading will be in error on the low side, meaning you will over-estimate your battery life, (generally not a good thing).

 

The "problem" with the other method, of course, is evident when looking at the sample LoRa and GSM graphs.

You have to be able to accurately estimate the duty cycle for the various sub-systems.

 

Another option, with its own inaccuracies, is to build your own Keysight instrument with a couple of op-amps, (cost $5 vs $50K, with performance to match!).

Use the micro-current amplifier to feed an op-amp circuit set up as a voltage integrator.

The output voltage is then proportional to the current drawn, (and directly calculateable, although one would more likely just calibrate it for compensate for real world conditions).

 

Note that in practice you would need a good op-amp, rail-to-rail, with a bi-polar supply for good linear operation near the 0 V input range, and an op-amp with a very low input offset voltage spec.

The higher the signal from your current amp, the less the small errors in the op-amp matter.

 

One would usually use a micro to set the "gate interval", the "on time" during which the instrument is measuring the current flow, and then using an I/O pin to turn on an NFet to short out the cap to zero the system and start the next measurement interval.

 

An Atmel Butterfly, (micro, display, joystick, etc.); a breadboard, and a couple of op-amps and you're golden!

 

JC

 

Edit: Typo

 

Last Edited: Wed. Dec 6, 2017 - 04:11 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:

Wow, I like that Keysight instrument!

 

John, your two methods sound fine, but obviously each has trade offs.

You ought, I think, check the sampling rate on your O'scope's RMS function to see if it is sampling fast enough to catch the spikes your system generates.

If it is sampling too slowing and you miss a large portion of the spikes, then your reading will be in error on the low side, meaning you will over-estimate your battery life, (generally not a good thing).

 

The "problem" with the other method, of course, is evident when looking at the sample LoRa and GSM graphs.

You have to be able to accurately estimate the duty cycle for the various sub-systems.

 

Another option, with its own inaccuracies, is to build your own Keysight instrument with a couple of op-amps, (cost $5 vs $50K, with performance to match!).

Use the micro-current amplifier to feed an op-amp circuit set up as a voltage integrator.

The output voltage is then proportional to the current drawn, (and directly calculateable, although one would more likely just calibrate it for compensate for real world conditions).

 

Note that in practice you would need a good op-amp, rail-to-rail, with a bi-polar supply for good linear operation near the 0 V input range, and an op-amp with a very low input offset voltage spec.

The higher the signal from your current amp, the less the small errors in the op-amp matter.

 

One would usually use a micro to set the "gate interval", the "on time" during which the instrument is measuring the current flow, and then using an I/O pin to turn on an NFet to short out the cap to zero the system and start the next measurement interval.

 

An Atmel Butterfly, (micro, display, joystick, etc.); a breadboard, and a couple of op-amps and you're golden!

 

JC

 

Edit: Typo

 

I'm fairly sure the sampling rate is not high enough, but, as always, there is a trade-off. If I set the sampling rate to be high, the period over which I can monitor gets shorter.

I was thinking of an op-amp as integrator. What put me off was not being able to find any examples of such for this purpose on the web. That led me to believe the idea was flawed.

Maybe I'll do a bit of research.

 

 

@Jim, I looked at the coulomb counter. The device itself seems to take more current than the sort of device I'm wanting to test. I skimmed the datasheet in vain to look for a clue as to the sensitivity, i.e. the lowest current that would register. I usually find I need to factor in sub microamp currents.

 

 

Quebracho seems to be the hardest wood.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In addition to the Silabs kit that was already mentioned, Nordic Semi also has an inexpensive Power Profiler Kit. It is intended to support development with their Bluetooth chips, so the sampling rate is high enough for such spiky consumption. IIRC it has three shunt resistors and a fast enough 'auto-scaling' to cover a <1uA - ~50mA range.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just read your comment in the other thread about an 'accumulated power mode'. I'm using the Nordic PPK for this kind of battery life estimation.

 

The kit sends the measured values to a PC over USB, where a Nordic-provided display application makes a graph out of it. You can get short term averages directly from the display app, but for longer times the amount of data gets too large quickly.

The app is written in python and source is available, so I modified it to log accumulated power. I can now leave a device running for hours in some typical use case, and get an average power figure. I intended to add a histogram as well to verify sleep/awake ratios, but I haven't gotten round to doing that yet.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mrono wrote:
 Nordic Semi also has an inexpensive Power Profiler Kit.

Power Profiler Kit

https://www.nordicsemi.com/eng/Products/Power-Profiler-Kit

 

They've also been working with Sony Mobile Research and Incubation to turn it into a standalone instrument:

https://devzone.nordicsemi.com/blogs/1058/new-power-optimization-tool-called-otii-that-runs-/

https://www.qoitech.com/

 

and there's the Atmel Power Debugger:

http://www.atmel.com/tools/atpow...

 

That started off as part of the SAM L21 XPlained-Pro:

Atmel SAM L21 Xplained-Pro board

Xplained Pro Analog Module (XAM)

They gave me one to try a couple of years ago.

Sadly (but not untypically) they hadn't got the support for it at that point:

http://blog.antronics.co.uk/2015/04/23/new-tricks-for-lower-power-from-atmel/

 

 

There's Bay Libre's ACME:

http://baylibre.com/acme/

Although I also have doubts about the sampling rate of that for this kind of application.

The software was rather disappointing.

 

EDIT

 

ST have recently announced the X-NUCLEO-LPM01A  - STM32 Power shield, Nucleo expansion board for power consumption measurement:

http://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/stm32-nucleo-expansion-boards/x-nucleo-lpm01a.html

I don't know how tied-in that is to jut ST products ...

 

 

#PowerMeasurement

Last Edited: Thu. Dec 7, 2017 - 08:58 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think I might have a go at marrying up my Dave Jones uCurrent sense(that I have) with an LTC4150 coulomb counter. Looking at the datasheet, I can't see why this wouldn't work. Maybe I'll order one of the Sparkfun clones. I'm not sure how easy it will be to disconnect the Vdd from the current sense(which I think will be necessary). Depends on the PCB layout.

 

Actually, looks like it may be nigh impossible, I think the track is directly under the chip. Maybe I'll find a 10 pin MSOP breakout PCB instead.

Quebracho seems to be the hardest wood.

Last Edited: Thu. Dec 7, 2017 - 08:38 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Current controlled oscillator. Count the cycles

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
Current controlled oscillator. Count the cycles

 

Isn't that pretty much what the coulomb counters do? Maybe you could enlarge on that idea?

Quebracho seems to be the hardest wood.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Probably. The ‘obvious’ method is to sample at a reasonable rate using an adc - but there’s the issue of dynamic range etc. Using a current controlled oscillator, hopefully the dynamic range is better than the average adc and you just count clocks which is dead easy on a micro. You might be able to use a 555!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
there’s the issue of dynamic range etc.

Indeed there is.

 

Using a current controlled oscillator, hopefully the dynamic range is better than the average adc and you just count clocks

It would have to be a pretty fast oscillator in order to get a reasonable number of cycles to count during the brief current pulses typical of stuff like BT ...

 

And it would have to be able to change frequency very fast.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
Current controlled oscillator. Count the cycles

 

Interesting idea.

 

TI have an app note, AN-240, which has a number of circuits built around an LM331 V-F chip. FS is 200uA for one of the circuits shown and goes down to 20pA!

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wonder what time resolution you really need. Is the battery going to ‘see’ microsecond pulses?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
I wonder what time resolution you really need. Is the battery going to ‘see’ microsecond pulses?

 

I guess it depends a bit on the size of any bulk capacitance.

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Kartman wrote:
I wonder what time resolution you really need. Is the battery going to ‘see’ microsecond pulses?

I would have thought so. If not, you've discovered over-unity energy...

 

Quebracho seems to be the hardest wood.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:

Kartman wrote:
Current controlled oscillator. Count the cycles

 

Interesting idea.

 

TI have an app note, AN-240, which has a number of circuits built around an LM331 V-F chip. FS is 200uA for one of the circuits shown and goes down to 20pA!

Interesting app note.  20pA might be underkill...

 

Quebracho seems to be the hardest wood.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

John_A_Brown wrote:

Interesting app note.  20pA might be underkill...

 

Couple one of those with a small AVR, a couple of button and an LCD display and you'd have an interesting useful product.

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
 Is the battery going to ‘see’ microsecond pulses?

​Well of course it is - it's all energy consumption, and that energy has to come from the battery!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:
TI have an app note, AN-240

John_A_Brown wrote:
Interesting app note.  

Indeed: http://www.ti.com/lit/an/snoa594b/snoa594b.pdf

 

Only skimmed it, but did note that they make the point of having a high frequency.

 

cool

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
and there's the Atmel Power Debugger:

Power Debugger

Analog Hardware

http://www.microchip.com/webdoc/GUID-EAD481FD-28E6-4CD5-87FB-5165E7687C12/index.html?GUID-F0E592FF-579E-4828-92FA-D5699D9F5F4F

62.5Ksps

An assumption is the samples from the XMEGA128A1U are stored in the UC3A3's attached SDRAM.

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

gchapman wrote:
An assumption is the samples from the XMEGA128A1U are stored in the UC3A3's attached SDRAM.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can anyone explain to me how the circuit in figure 2 on AN-240 works?  I'm guessing the opamp is working as an integrator, as it has that cap in the feedback loop, the diodes on the input clamp the voltage to near zero, and the diode on the output stops it from going negative. But if the inputs are near zero, where does the current for the DUT come from?

 

Excuse my ignorance, analog stuff is black magic to me.

 

Quebracho seems to be the hardest wood.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

John_A_Brown wrote:
Can anyone explain to me how the circuit in figure 2 on AN-240 works? 

maybe someone on a TI analogue forum ?

 

you might even find the author over there ...

Last Edited: Thu. Dec 7, 2017 - 02:48 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

John_A_Brown wrote:

...where does the current for the DUT come from?

 

I think that it gets it externally from its power supply with the DUT ground lead feeding into the circuit in fig 2.

 

I think the circuit works like this...

 

the incoming current is integrated across Cf. At a certain voltage, fed into the LM331 on pin 7 a comparator will fire and the capacitor will be discharged via pin 1. Rinse and repeat. The frequency at which the discharge happens is proportional to the input current.

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, Brian. Makes a bit more sense to me now. Still not sure what part completes the current path to ground, the cap, the diode or the opamp?

 

Quebracho seems to be the hardest wood.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

At a quick look, pin 1of the lm331 is the current source. The other hint is the arrow.
Sounds like a good project for someone......

Last Edited: Thu. Dec 7, 2017 - 10:03 PM