Measuring wide range current draw of micropower applications - Page 1
Forum section: electronics / projects

author: Amper
author_rank: Frequent Contributor
timestamp: October 30, 2019, 06:53:06 pm
content: Hi!I just had a little bit of time continuing my geiger counter power supply project (https://www.eevblog.com/forum/projects/low-quiescent-standby-boost-regulator-3-3-500v/), which now is working pretty much as i want it to but i ran into a new problem.To summarize: The current state of the project is a Attiny13 controlling a boost converter feeding a cocroft walton multiplier boosting the voltage up from 3.3V to 500V. It charges up a 1uF storage cap so the multiplier, diodes and voltage divider go to sleep after a charge cycle. A new cycle is triggered either by watchdog timer or a certain number of pulses detected corresponding to a known discharge of the storage cap.This results in a current draw of roughly 6uA while sleeping and 20-50mA for a few milliseconds recharging which happens at least every half hour by watchdog. The amount of energy pumped will depend on the depletion of the storage cap by detection, moisture or just loss in parts.Until now i measured the average current draw by supplying the entire thing with a set of two 25F 2.5V capacitors in series and measuring the drop over a longer period of time. This worked nicely but has a set of annoying drawbacks, its labor intensive, the voltage is not constant, the capacitors have a voltage dependent capacity, a lot of tolerance and unknown self discharge which is also dependent on charge state, time, settling time and so on....I now reached a current of 50uA using this method but i feel like this is the end of what is reasonable this way.Now my question is, how do i o it better without having the dedicated professional instruments?Sadly i dont have a bench meter with a modern logging function and the hp3457a only supports gpib which i dont have any hardware for.How do i get the huge dynamic range required and the sampling rate needed for including millisecond pulses every few hours?cheers!

author: iMo
author_rank: Super Contributor
timestamp: October 30, 2019, 07:48:51 pm
content: Sense a shunt with a logarithmic amplifier and ADC it with say 12bit adc at 10k samples per second. You may be logging the data on an SPI sdcard.. $10 hw solution..

author: Amper
author_rank: Frequent Contributor
timestamp: October 30, 2019, 08:41:24 pm
content: mhoh, log amp is a nice idea, this way i could even do the math on the uC and record just averages and peaks.

author: OM222O
author_rank: Frequent Contributor
timestamp: October 30, 2019, 08:58:52 pm
content: you can use a universal shunt that has different ranges (I have a general purpose one that goes from 1ohm to 100kohm in 6 steps, where each step increases resistance by 10x) (you can look up ayrton shunt as well) and combine that with an ADC that measures the voltage across the shunt resistor. then you can dynamically switch the shunt resistance when the voltage goes too high / too low. a simple ADC + micro sd card should be easy enough to finish the task. I can draw a full schematic if you want but parts count is less than 20 and it's a fairly trivial task , so you should be able to do it yourself.edit: I have a made a milliohm meter using that exact same technique, you can copy the universal shunt and the ADC sections directly and use them. just add a SD card reader to the MCU for logging over long periods. see the attachment for the schematic.

author: Amper
author_rank: Frequent Contributor
timestamp: October 30, 2019, 09:31:15 pm
content: Thats actually also something thought about but i didnt know how to bridge the resistors fast enough to catch millisecond pulses. Just having one shunt and multiple amplifiers and DACs could work too i guess just doing the switching over purely in software as the ranges are overrun.One thing i just noticed is that basically i could just have the logger measure the high pulses and times between them as the low state is pretty much 6uA unchanged and i can measure that using the 3457a. Then its just a question of sampling rate and enough resolution to integrate the pulses, a cheap stm32f103 could probably do that (they have pretty fast adcs iirc). Of cause its only suitable for this particular case but it may e the smallest effort.

author: ogden
author_rank: Super Contributor
timestamp: October 30, 2019, 09:42:50 pm
content: Quote from: Amper on October 30, 2019, 09:31:15 pmYour high pulses most likely are unchanged as well. You need to measure consumption and pulses for max/min voltage. Then you just need to count pulses per period (day or few?) which can be done using whatever you have on hand - PC, rPI or MCU board with small software. Everything else can be calculated.

author: Amper
author_rank: Frequent Contributor
timestamp: October 30, 2019, 10:05:05 pm
content: Sadly no, the pulses are the variable. They depend on all sorts of factors like humidity, temperature, supply voltage, discharge rate of the geiger and so on. Just as an example: The storage cap is 1uF charged to 500V, im measurng the voltage through a 100GOhm Resistor wich already doubles the amount of discharge. I once had the tube supply wire touch a dry rag and it caused a five fold current increase.... Talking 10s of micro amps on the primary corresponds to insane and ridiculous problems on the secondary wich is all the reason for me having to measure it precisely so i can compare different parts and climate conditions.

author: OM222O
author_rank: Frequent Contributor
timestamp: October 30, 2019, 10:06:36 pm
content: Quote from: Amper on October 30, 2019, 09:31:15 pmjust use some comparators instead of doing it via the MCU. You still need to connect the MCU pins to the mosfet gates, but as inputs to know which range you're measuring. any cheap comparator can switch withing a few uS, let alone mS. fast ones can switch over in 2 or 3 nS if you want insanely high switching speed

author: Amper
author_rank: Frequent Contributor
timestamp: October 30, 2019, 10:17:57 pm
content: Yes, the sensing and logic is pretty straight forward. I just never realized that i could drive the fets this way just having the source vary by shunt voltage. I guess thats because i always use them in power electronics where i want the best ground path i can get...

author: Brutte
author_rank: Frequent Contributor
timestamp: October 30, 2019, 10:35:08 pm
content: You could use a bipolar current mirror. The Vbe is a logarithm of current. So the bjt transistor becomes a shunt. With 0.4V you get 1uA, with 0.5V you get 10uA, 0.6V with 100uA, 0.7V with 1mA etc. (just to show the idea). These are < 0.1$ a piece, typically available in SOT23-4.

author: ogden
author_rank: Super Contributor
timestamp: October 30, 2019, 10:43:06 pm
content: Quote from: Amper on October 30, 2019, 10:05:05 pmI see. Then perhaps 10$ solution is to buy MSP‑EXP430FR2433 which is cheapest ready to use wide dynamic range MCU power measurement toolone can buyknown to me. Those who will jump-in with "but msp430 is not Tiny13" can cool down because standalone tool work w/o connection to msp430 as well.

author: OM222O
author_rank: Frequent Contributor
timestamp: October 30, 2019, 10:50:15 pm
content: Quote from: Amper on October 30, 2019, 10:17:57 pmThose specific fets are logic level fets. if you drive them with 5V, the source can be as high as 2V and the fets are still fully on! However I would worry about more important things if you have 2V across your shunt

author: Amper
author_rank: Frequent Contributor
timestamp: October 30, 2019, 11:02:33 pm
content: The ti board looks really nice, if it can do this it will be worth it just for this meter function on its own...

author: jbb
author_rank: Super Contributor
timestamp: October 30, 2019, 11:17:44 pm
content: Yes, wide dynamic range measurements are a problem. I’m grappling with it at work...I see three options:Spend lots of money on really expensive kit. Keysight would be very happy to help you spend some tens of thousands. Joulescope might be workable.Arrange your measurement to work on the ‘active’ current only, and just assume the ‘low’ current is 6uA. You could also calculate an expected ‘sleep’ current using data sheet values.Split the current into 2 channels: one for the boost converter input and the other for everything else. This would divide up the big dynamic range problem into two easier problems.[\li]

author: SiliconWizard
author_rank: Super Contributor
timestamp: October 30, 2019, 11:30:43 pm
content: This has been discussed in several threads before. You'll probably find most practical solutions in them.Eg:https://www.eevblog.com/forum/projects/measuring-small-current-complicated/https://www.eevblog.com/forum/testgear/battery-energy-consumption-how-to-measure-it/https://www.eevblog.com/forum/testgear/high-dynamic-range-current-vs-time-measurement-at-low-cost/https://www.eevblog.com/forum/oshw/metering-both-sleep-and-active-current/

author: Amper
author_rank: Frequent Contributor
timestamp: October 31, 2019, 07:51:04 am
content: Well thats embarrassing, usually i search before posting...Thank you for the links however, some of the stuff is very interesting.

author: magic
author_rank: Super Contributor
timestamp: October 31, 2019, 08:29:11 am
content: Without reading those other threads I would say:Use a few ohm shunt to maintain reasonably low burden voltage at full load and provide as many parallel amplifier-ADC paths with different gains as you need. That's probably going to be 2, and only the low gain one needs to be fast and only the high gain one needs µV precision, which isn't even the worst situation it could be.Say, ATtiny13 + trimmed OP07 + dunno, maybe even NE5534?, whacked together on a perfboard.

author: Amper
author_rank: Frequent Contributor
timestamp: October 31, 2019, 08:49:30 am
content: Yes, thats one of the considerations ^^Having 1V drop@ 20mA would give me a 50Ohm shunt, .3mV@ 6uA. Not really any problem but in this case building the auto ranging shunt would not be so much more of a work.

author: SiliconWizard
author_rank: Super Contributor
timestamp: October 31, 2019, 05:40:03 pm
content: Quote from: Amper on October 31, 2019, 07:51:04 amThere are probably yet others. But no problem, that happens to everyone. This is actually a recurring topic, as it's a very serious need these days, and not many solutions out there, especially if you can't afford expensive lab stuff.One question would be: over how long a period of time do you need to average the current draw? Obviously, many options will fall short for long periods as they will accumulate error over time.

author: Amper
author_rank: Frequent Contributor
timestamp: October 31, 2019, 08:28:58 pm
content: Yes, all this micro power stuff is an entire rabbit hole on its own. The more you try the more problems you discover and the solutions are sometimes unconventional or just plain ridiculous.For now i guess a full log of 5-10h would be nice since every period will take up to an hour (heavily depending on tube and capacitor choice). So 10h should give me roughly 10% accuracy if i miss one charge cycle. Though from there on it would be pretty simple to just add another layer of averaging. Since im only interested in the average its no problem to throw away all the measurements and just log a single value every hour or so. That should also give opportunity to log changes due to environmental changes like slow humidity or temperature change.

author: splin
author_rank: Frequent Contributor
timestamp: October 31, 2019, 11:36:48 pm
content: Quote from: magic on October 31, 2019, 08:29:11 amBut make sure you clamp the high gain amp to prevent it saturating if the overdrive recovery time could seriously impact the accuracy. ([EDIT 3] For example, the 2MHz auto-zero MCP6V26 has a recovery time of around 50us). How big a problem that is depends on the threshold level where the high gain range becomes active and the frequency that the range changes. In cases, such as IOT applications, where an MCU spends much of its time, op-amp saturation wouldn't be much of a problem as the recovery time is insignificant compared to the total time spent in sleep mode.This single shunt / multiple amp scheme works well for capturing rapidly rising current levels however. Ultimately the dynamic range will be limited by the maximum shunt voltage that can be tolerated and the noise performance of the highest gain amplifier. Assuming 100mV max shunt voltage and a very low noise amp, LT1028, is used. Further, assume a measurement bandwidth of 20kHz for which the amp noise is around 700nV peak to peak. The dynamic range is 100mV/700nV = 143,000:1 giving a resolution of 7uA for a 1A max current range.Of course you can drastically reduce the noise bandwidth if the measured current remains in the low range for relatively long periods by using dynamic filtering in the MCU. The limit then would be the amp's flicker noise - 35nVpp for a single LT1028 0.1 to 10Hz, or 350nV resolution for 1A max. Further improvement could be achieved by paralleling op-amps or using very low noise bipolar transistors such as the ZTX951. Fortunately, the relatively high current noise of bipolar amps isn't a problem in this application with the very low source resistance of the shunt. Thermal EMFs of the shunt and the connections to the amplifier, probably of the order of a few uV/C, are more likely to be the main limitation to dynamic range unless you have some way of calibrating or offsetting them out which is tricky, if not impossible.[EDIT 2] Self heating of the shunt can be a significant additional error source depending on how long the current spends at higher levels, but at least you have the option of arbitrarily increasing the thermal performance of the shunt and selecting a shunt with very low temperature coefficient.

author: NiHaoMike
author_rank: Super Contributor
timestamp: November 01, 2019, 01:15:21 am
content: An active IV converter with multiple ranges (lower current ranges bypassed with diodes) will work nicely. Digitize all ranges at once and then use a simple sensor fusion algorithm (if low range out of range, use higher range) to merge the data together.

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 01, 2019, 03:41:58 pm
content: Quote from: Amper on October 31, 2019, 08:28:58 pmOne question to ask yourself is, what exactly are you expecting from all those measurements?1. If you're after a realistic average power draw in "typical" conditions over a significant period of time, one of the simplest approaches, not extremely accurate, but closer to what you'd expect to get out of it, would be to let your device run on a given battery, the capacity of which you have first assessed with a simple setup. Then let it run on the battery fully charged until its voltage gets down to the cut-off voltage you've used to assess its capacity. Done. You can rinse an repeat several times to get a realistic average figure and most of all verify that you get reproducible results.2. If you additionally want to know the max current peak, you could use a simple setup with a small shunt and an oscilloscope/acquisition board that would trigger on the rising edge of the current draw with a threshold significantly above the idle current. Enable statistics on the given channel, and you'll get your min/max/average. This won't be very accurate, but good enough IMO to get stats on the peak values. Knowing about the peak values would further help you select an appropriate battery.

author: Amper
author_rank: Frequent Contributor
timestamp: November 01, 2019, 07:53:17 pm
content: Sadly that will not work, as said previously the drain of these batteries depends heavily on current draw and outside influences, so its not really possible to carry results from a small battery to a bigger one. As im aiming for a run time of more than a decade and even on a cr2032 it should last for more than a year i have a limited number of tries in my lifetime...

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: November 01, 2019, 08:48:34 pm
content: To measure the sleep mode energy more accurately you can always put 10 or 20 or 50 devices in parallel and divide. Patch the software so that it won't trigger any high current spikes.To measure the current spikes, the software could set a gpio to trigger the logger device in advance so that it can sample and integrate as fast as it can but only when it's needed.Or perhaps, use a gpio to signal what shunt to use, because the software knows what it's doing/going to do next => what's the best suited shunt.

author: magic
author_rank: Super Contributor
timestamp: November 01, 2019, 09:04:08 pm
content: Quote from: splin on October 31, 2019, 11:36:48 pmFor this application, low current range bandwidth is sub-1Hz and high current events occur extremely rarely. The MCU could sample the high current channel at 100kHz or so to catch wakeups reliably and only probe the low current channel once per a few seconds and discard the sample when a high current event has been registered within its vicinity.Just the lowest possible effort to get this particular measurement done and forget about it.