Author Topic: Metering both sleep and active current.  (Read 5339 times)

0 Members and 1 Guest are viewing this topic.

Offline hamster_nzTopic starter

  • Super Contributor
  • ***
  • Posts: 2803
  • Country: nz
Metering both sleep and active current.
« on: December 15, 2017, 10:18:37 am »
How do measure current usage in a microcontroller projects when designs bounce between deep sleep and active with relatively low duty cycles? The burden voltage  on the uA range on my meters causes brownouts when controller is awake.

At the moment I've got a mA meter and uA meter in series, with toggle switch in parallel over the uA meter. If I only open the switch when the controller is asleep I can measure sleep current without causing brownouts - as long as it doesn't wake up.

Is there a better (and equally inexpensive) way?
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline Gyro

  • Super Contributor
  • ***
  • Posts: 9480
  • Country: gb
Re: Metering both sleep and active current.
« Reply #1 on: December 15, 2017, 10:37:32 am »
Are you wanting to individually measure the active and sleep currents, or the overall operating current (for battery life prediction or whatever?

Depending on the duty cycle you ought to be able to get a pretty accurate overall current measurement by integrating the current - put a Large value (electrolytic) capacitor on the supply after the meter. Ramp up the supply gently so you don't risk blowing the meter fuse (or short the meter terminals while the capacitor charges).

Allow some lime for the leakage current of the capacitor to stabilise and measure it. Then connect your project across the capacitor. Once the reading has settled again, the additional current over the leakage current should be your project's overall current draw.

After disconnecting your project again, re-check the capacitor leakage current to be sure that it hasn't changed during the test time.
Best Regards, Chris
 

Offline Alex Eisenhut

  • Super Contributor
  • ***
  • Posts: 3335
  • Country: ca
  • Place text here.
Re: Metering both sleep and active current.
« Reply #2 on: December 15, 2017, 11:54:13 pm »
uA d'Arsonval meter with switchable shunt. I can measure the uA sleep current then I switch in (make before break) the shunt and I can measure the running current.
Hoarder of 8-bit Commodore relics and 1960s Tektronix 500-series stuff. Unconventional interior decorator.
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Metering both sleep and active current.
« Reply #3 on: December 17, 2017, 02:24:31 pm »
Very inexpensive way: craft two test firmwares, one that sleeps all the time and another that is active all the time. Measure them separately.

Which microcontroller do you use?
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16607
  • Country: us
  • DavidH
Re: Metering both sleep and active current.
« Reply #4 on: December 17, 2017, 03:39:57 pm »
I use clamped transimpedance amplifiers instead of current shunts so the burden voltage and shunt resistance are essentially zero.  Clamping prevents saturation of the low current range which would otherwise allow the burden voltage to become non-zero.  The tricky part then becomes driving the decoupling capacitance without instability of the transimpedance amplifier; this may require circuit modification.

 

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 895
  • Country: us
Re: Metering both sleep and active current.
« Reply #5 on: December 17, 2017, 05:44:12 pm »
I often need to measure average current on a wearable/BLE device that spends most of its time sleeping. We use a Keysight 34465A (with digitizing option) in series with the battery. The sample frequency is 10kHz and we do a 3-minute average with the firmware in a steady state. The meter has 6-digit precision so even on the 100mA range, we can get reliable results down to the uA. It's been interesting to track firmware changes that result in a difference of just a few uA. Burden voltage hasn't really been a problem, since we can adjust for it in the test setup if necessary.

Not the cheapest option for sure, but it's easy to set up and gives very consistent results.

 

Online Peabody

  • Super Contributor
  • ***
  • Posts: 1993
  • Country: us
Re: Metering both sleep and active current.
« Reply #6 on: December 18, 2017, 12:01:19 am »
This may sound crazy, but what if you put a very low value resistor in series with the supply to the Vcc pin, like one ohm or less, even a stretch of  thin wire, and then hook up your oscilloscope to measure the voltage drop across that resistor.  With some math, that would give you the current.  That would need to be your floating scope, not referenced to ground, or perhaps measuring 2-channel differential voltage.  If you could get that to work, it would give you a full picture of not only how the sleep and active currents compare, but the duty cycles as well.

I've done this on what I assume would be much higher currents than you're looking at, so it may not work for you.  And the scope leads might interfere with the processor or otherwise swamp the measurement.  But if you can make it work, you can see exactly what's going on.


 
The following users thanked this post: hamster_nz

Offline xani

  • Frequent Contributor
  • **
  • Posts: 400
Re: Metering both sleep and active current.
« Reply #7 on: December 18, 2017, 04:53:51 pm »
How do measure current usage in a microcontroller projects when designs bounce between deep sleep and active with relatively low duty cycles? The burden voltage  on the uA range on my meters causes brownouts when controller is awake.

At the moment I've got a mA meter and uA meter in series, with toggle switch in parallel over the uA meter. If I only open the switch when the controller is asleep I can measure sleep current without causing brownouts - as long as it doesn't wake up.

Is there a better (and equally inexpensive) way?

Simplest way to avoid brownouts would be to put multimeter between sense and out of a power supply but not many bench power supplies have that as separate output. You could probably breadboard a simple one with LM317 and some opamp.

Hell, you could probably just use an opamp itself (or with some extra transistor) if it is low enough current

Other, if you have uV range on your meter is to just put 1 ohm resistor, then 1uV = 1uA. Then you can connect 2 different meters just one in mV range, other in uV

 

Offline stmdude

  • Frequent Contributor
  • **
  • Posts: 479
  • Country: se
Re: Metering both sleep and active current.
« Reply #8 on: December 18, 2017, 06:59:08 pm »
My go-to tool for this is the Nordic Semiconductor "Power Profiler Kit".

Massive dynamic range, >=50Ksps, fairly accurate if you calibrate it yourself.

I think they cost about $70, and you'll need one of their nRF52 development kits as well (it uses the Segger JTAG on it to communicate with the PC). I think they go for about $50.

Works in Windows and Linux.

It's not as elegant as a >$10K Keithley, but it's cheap, and it definitely works.

Downside for some: It tops out at 70mA
 

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 2297
  • Country: gb
Re: Metering both sleep and active current.
« Reply #9 on: December 18, 2017, 07:46:28 pm »
Very nice of them to provide the Altium Designer files + PDFs.
There isn't a whole lot in the hardware, basically 2 switchable current shunts, a diff amp and an ADC in the micro which pumps data to the PC.
The screenshots of the PC software (python  :-+, but python 2) look OK, does the software work well?

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

Offline stmdude

  • Frequent Contributor
  • **
  • Posts: 479
  • Country: se
Re: Metering both sleep and active current.
« Reply #10 on: December 19, 2017, 07:02:49 am »
The screenshots of the PC software (python  :-+, but python 2) look OK, does the software work well?

The software has its quirks, but no more than your typical UI-for-an-instrument software.

It has a few dependencies (libraries, python modules, etc), but it comes with bat/shell files to install those, so overall I'd have to say it's quite good.

Oh, and another thing, as you can see in the schematics, there's not a lot of protection circuitry (understandable when doing low-current measurements), so if you mistreat it (short the outputs, etc) it'll start smelling funny. :)
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14445
  • Country: fr
Re: Metering both sleep and active current.
« Reply #11 on: December 19, 2017, 05:59:43 pm »
One expensive way of doing this is using a Sourcemeter for powering your device (set as a voltage source/current measurement). Some have high dynamic ranges and built-in integration, such as the Keithley 2400 or newer 2450. I used that successfully in a few projects, but those sourcemeters are very expensive (over $4000).

Even if you solve the burden voltage problem, you will still have to deal with the huge dynamic range needed.

  • If you don't need to accurately measure the dynamic current profile but are more interested in accurately measuring the average current, like some have suggested, one low-cost trick I've seen and tried is using a shunt (the largest resistor value you can afford in terms of max burden voltage, thus max drop-out) with a large capacitor (in the order of thousands of µF) in parallel with this shunt, and then measuring the average voltage across this "RC" shunt (which will be a low-pass filtered version of 'Rshunt * I(t)'), that you can typically measure with a voltmeter. It's not quite "neutral" though, so may have some influence on the power draw of your circuit, but it's definitely low-cost. Try that, it might fit your needs. Attached is the LTSpice schematics to make things clear.
  • Another option would be to use a "coulomb counter"-type IC, such as the LTC4150 or TS1108. They are usually limited in accuracy for very low average currents, but that could be enough for your needs. You may also think of including one of those in your device as a "battery gauge" setup, while you are at it.
  • You could have a look at those very nice current probes: http://www.cmicrotek.com/uCP.htm. Not quite cheap, but still affordable.

« Last Edit: December 19, 2017, 06:06:36 pm by SiliconWizard »
 

Offline rsjsouza

  • Super Contributor
  • ***
  • Posts: 5985
  • Country: us
  • Eternally curious
    • Vbe - vídeo blog eletrônico
Re: Metering both sleep and active current.
« Reply #12 on: December 19, 2017, 07:09:52 pm »
My go-to tool for this is the Nordic Semiconductor "Power Profiler Kit".

Massive dynamic range, >=50Ksps, fairly accurate if you calibrate it yourself.

I think they cost about $70, and you'll need one of their nRF52 development kits as well (it uses the Segger JTAG on it to communicate with the PC). I think they go for about $50.

Works in Windows and Linux.

It's not as elegant as a >$10K Keithley, but it's cheap, and it definitely works.

Downside for some: It tops out at 70mA
I was thinking about a similar solution as well, but EnergyTrace from TI. It has lower specs (2kSPS) but it goes from hundreds of nA to about 100mA.

For CortexM they have an add on pod that goes from 1uA to 800mA at 256kSPS.
Vbe - vídeo blog eletrônico http://videos.vbeletronico.com

Oh, the "whys" of the datasheets... The information is there not to be an axiomatic truth, but instead each speck of data must be slowly inhaled while carefully performing a deep search inside oneself to find the true metaphysical sense...
 

Offline hamster_nzTopic starter

  • Super Contributor
  • ***
  • Posts: 2803
  • Country: nz
Re: Metering both sleep and active current.
« Reply #13 on: December 19, 2017, 08:52:21 pm »
So currently on the output of the power source I've got a 1k0 Ohm shunt, with two diodes over it, and then a 1 Ohm shunt in series.

When currents are low, I get 1mV/uA over the 1k0 (as the diodes are cut off). When currents are high I get 1mV/mA over the 1 Ohm/

If just has a 'fuzzy' point where I can't get meaningful measurements, between about 0.8mA and 1.5mA, The voltage over the 1 Ohm shunt is low, but the diodes haves started to pass current around the 1k0 making that useless too.

As luck would have it, this area is of minimal interest - active current is > 30mA, sleep current < 200uA.
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 2297
  • Country: gb
Re: Metering both sleep and active current.
« Reply #14 on: December 19, 2017, 09:24:26 pm »
OK, well, that makes it easier if you can stand the diode drop.
But if you can tolerate that much, why not just use a 10 ohm shunt alone - good enough for uA measurement and 'only' 300mV drop at your 30mA draw?
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8637
  • Country: gb
Re: Metering both sleep and active current.
« Reply #15 on: December 19, 2017, 10:14:19 pm »
I was thinking about a similar solution as well, but EnergyTrace from TI. It has lower specs (2kSPS) but it goes from hundreds of nA to about 100mA.

For CortexM they have an add on pod that goes from 1uA to 800mA at 256kSPS.
If you think the sample rates of those 2 are comparable, you should re-read what Energy Trace is. It will give you are FAR more accurate picture of energy consumption in bursty applications.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf