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

0 Members and 1 Guest are viewing this topic.

Online hamster_nz

  • Super Contributor
  • ***
  • Posts: 1485
  • Country: nz
Metering both sleep and active current.
« on: December 15, 2017, 09:18:37 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?
 

Offline Gyro

  • Super Contributor
  • ***
  • Posts: 3023
  • Country: gb
Re: Metering both sleep and active current.
« Reply #1 on: December 15, 2017, 09:37:32 pm »
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.
Chris

"Victor Meldrew, the Crimson Avenger!"
 

Online Alex Eisenhut

  • Super Contributor
  • ***
  • Posts: 1801
  • Country: ca
  • If you can buy it for 4$ on eBay, why design it?
Re: Metering both sleep and active current.
« Reply #2 on: December 16, 2017, 10:54:13 am »
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.
 

Offline ogden

  • Frequent Contributor
  • **
  • Posts: 727
Re: Metering both sleep and active current.
« Reply #3 on: December 18, 2017, 01:24:31 am »
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: 6504
  • Country: us
  • DavidH
Re: Metering both sleep and active current.
« Reply #4 on: December 18, 2017, 02:39:57 am »
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: 814
  • Country: us
Re: Metering both sleep and active current.
« Reply #5 on: December 18, 2017, 04:44:12 am »
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.

 

Offline Peabody

  • Regular Contributor
  • *
  • Posts: 225
  • Country: us
Re: Metering both sleep and active current.
« Reply #6 on: December 18, 2017, 11: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: 300
Re: Metering both sleep and active current.
« Reply #7 on: December 19, 2017, 03:53:51 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?

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: 436
  • Country: se
Re: Metering both sleep and active current.
« Reply #8 on: December 19, 2017, 05:59:08 am »
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: 482
  • Country: gb
Re: Metering both sleep and active current.
« Reply #9 on: December 19, 2017, 06:46:28 am »
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: 436
  • Country: se
Re: Metering both sleep and active current.
« Reply #10 on: December 19, 2017, 06:02:49 pm »
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. :)
 

Online SiliconWizard

  • Frequent Contributor
  • **
  • Posts: 398
  • Country: fr
Re: Metering both sleep and active current.
« Reply #11 on: December 20, 2017, 04:59:43 am »
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 20, 2017, 05:06:36 am by SiliconWizard »
 

Offline rsjsouza

  • Super Contributor
  • ***
  • Posts: 2131
  • Country: us
    • Vbe - vídeo blog eletrônico
Re: Metering both sleep and active current.
« Reply #12 on: December 20, 2017, 06:09:52 am »
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...
 

Online hamster_nz

  • Super Contributor
  • ***
  • Posts: 1485
  • Country: nz
Re: Metering both sleep and active current.
« Reply #13 on: December 20, 2017, 07:52:21 am »
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.
 

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 482
  • Country: gb
Re: Metering both sleep and active current.
« Reply #14 on: December 20, 2017, 08:24:26 am »
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: 3264
  • Country: gb
Re: Metering both sleep and active current.
« Reply #15 on: December 20, 2017, 09:14:19 am »
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