Metering both sleep and active current. - Page 1
Forum section: electronics / general

author: hamster_nz
author_rank: Super Contributor
timestamp: December 15, 2017, 10:18:37 am
content: 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?

author: Gyro
author_rank: Super Contributor
timestamp: December 15, 2017, 10:37:32 am
content: 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.

author: Alex Eisenhut
author_rank: Super Contributor
timestamp: December 15, 2017, 11:54:13 pm
content: 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.

author: ogden
author_rank: Super Contributor
timestamp: December 17, 2017, 02:24:31 pm
content: 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?

author: David Hess
author_rank: Super Contributor
timestamp: December 17, 2017, 03:39:57 pm
content: 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.

author: andyturk
author_rank: Frequent Contributor
timestamp: December 17, 2017, 05:44:12 pm
content: 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.

author: Peabody
author_rank: Super Contributor
timestamp: December 18, 2017, 12:01:19 am
content: 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.

author: xani
author_rank: Frequent Contributor
timestamp: December 18, 2017, 04:53:51 pm
content: Quote from: hamster_nz on December 15, 2017, 10:18:37 amSimplest 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 currentOther, 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

author: stmdude
author_rank: Frequent Contributor
timestamp: December 18, 2017, 06:59:08 pm
content: 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

author: voltsandjolts
author_rank: Unknown
timestamp: December 18, 2017, 07:46:28 pm
content: 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

author: stmdude
author_rank: Frequent Contributor
timestamp: December 19, 2017, 07:02:49 am
content: Quote from: voltsandjolts on December 18, 2017, 07:46:28 pmThe 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.

author: SiliconWizard
author_rank: Super Contributor
timestamp: December 19, 2017, 05:59:43 pm
content: 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.Attachedis 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.

author: rsjsouza
author_rank: Super Contributor
timestamp: December 19, 2017, 07:09:52 pm
content: Quote from: stmdude on December 18, 2017, 06:59:08 pmI was thinking about a similar solution as well, butEnergyTrace from TI. It has lower specs (2kSPS) but it goes from hundreds of nA to about 100mA.For CortexM they have anadd on podthat goes from 1uA to 800mA at 256kSPS.

author: hamster_nz
author_rank: Super Contributor
timestamp: December 19, 2017, 08:52:21 pm
content: 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.

author: voltsandjolts
author_rank: Unknown
timestamp: December 19, 2017, 09:24:26 pm
content: 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?

author: coppice
author_rank: Super Contributor
timestamp: December 19, 2017, 10:14:19 pm
content: Quote from: rsjsouza on December 19, 2017, 07:09:52 pmIf 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.