measuring mAh consumption over two weeks? - Page 1
Forum section: electronics / projects

author: incf
author_rank: Frequent Contributor
timestamp: July 22, 2025, 11:53:46 pm
content: I've got a battery powered product where measuring the average current consumption under normal operation would require a two week test cycle.I've got a joulescope, and it is great and possibly could do it. But it would be really nice to have a piece of standalone equipment that could be put somewhere out of the way and run on its own undisturbed by people jostling cables, and undisturbed things like PC reboots or PC out of memory errors.Does anyone have any recommendations about how to approach this?We can easily measure and estimate what the mAh consumption should be piecemeal (in small short duration chunks), but calculations can be incorrect and real measurements often catch unexpected issues.

author: radiolistener
author_rank: Super Contributor
timestamp: July 23, 2025, 12:11:51 am
content: To measure mAh accurately, you should connect the battery to the load through an ammeter and a voltmeter, and record their readings at fixed time intervals - such as every 60 seconds or every 3600 seconds - depending on the desired precision. Then, compile all these measurements into a table and integrate the current over time using a tool like Octave to calculate the total charge consumption. This approach provides a reliable, data-driven estimate beyond simple calculations.It is important to maintain precise intervals between measurements or to record the exact timestamp of each measurement. This accuracy enables proper integration of the battery capacity over time and allows you to construct accurate battery discharge curves.

author: incf
author_rank: Frequent Contributor
timestamp: July 23, 2025, 12:24:26 am
content: One snag, it consumes power in 100 microsecond blips.My bench meter only does an approximate and variable ~2.11 samples per second (probably less, and more variably, if logging over the network via script, which could be timestamped and post processed)I feel like I'd need a large LC filter to get the bandwidth of the measurement well below 1Hz to make that sort of thing work.sidenote: still interested in hearing peoples' opinions about standalone battery simulator test equipment

author: radiolistener
author_rank: Super Contributor
timestamp: July 23, 2025, 12:33:26 am
content: If your device draws 100 µs current pulses, you ideally need to sample much faster than that, at least 10 samples per pulse, to capture the true consumption accurately. Alternatively, adding a low-pass filter to smooth out the current draw can allow you to measure the averaged consumption with standard, slower equipment, without directly capturing each pulse.However, if your goal is to measure the actual battery capacity, it’s generally better to discharge it through a constant load with equivalent average power, rather than using the pulsed load directly. If you specifically want to characterize the device’s real consumption, then a different measurement approach is required, tailored to its pulsed operating mode.

author: incf
author_rank: Frequent Contributor
timestamp: July 23, 2025, 12:42:09 am
content: Hmm... low pass filtering to produce a sub 1-Hz bandwidth with a ESR of 10 ohms or less and a leakage current of 1uA or less looks expensive. Possibly more expensive than a battery simulator, or the time it would take to fiddle around with a dedicated PC setup with a USB connected joulescope or similar.

author: radiolistener
author_rank: Super Contributor
timestamp: July 23, 2025, 01:10:40 am
content: You don’t necessarily need to filter all the way down to a 1 Hz bandwidth. A low-pass filter with a 20-30 Hz cutoff, combined with a 1000 Hz sampling rate, can still effectively smooth out the 100 µs current pulses and allow meaningful measurements - without requiring exotic components. At this sampling rate, it’s best to directly integrate the current over time for accurate results.Just to clarify, is your main objective to characterize the device's actual power consumption profile, rather than measure battery capacity?

author: SiliconWizard
author_rank: Super Contributor
timestamp: July 23, 2025, 01:18:37 am
content: I don't know any fully standalone equipment that will do this properly. If you have a Joulescope and are happy with its performance, I would stick to that. Use a laptop on AC, its battery will cover occasional power cuts, place the whole thing in a segregated area, add a large sign saying "DO NOT TOUCH" with huge letters, and hope for the best.

author: johansen
author_rank: Super Contributor
timestamp: July 23, 2025, 01:59:21 am
content: why not run it from a smaller battery that has a known milliamp hour capacity.

author: incf
author_rank: Frequent Contributor
timestamp: July 23, 2025, 02:06:10 am
content: Quote from: radiolistener on July 23, 2025, 01:10:40 amYes.Quote from: johansen on July 23, 2025, 01:59:21 amI can't easily do that. Special battery, special chemistry. High ESR. Rare. (not really that special, but enough to be quite some effort to emulate without causing problems)Needs to be 3.6V-ish, tolerate 100mA pulses sometimes lasting a second several times in a row, and have a capacity of something like 10mAh to expire in a reasonable time frame.Edit: coin cell is interesting, but it looks like a ton of work to get an accurate measurement of capacity under pulse conditions. Capacity varies non-linearly with load, temperature, etc.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: July 23, 2025, 02:09:28 am
content: Quote from: incf on July 23, 2025, 12:24:26 amIf you want to log those blips with a 1% accuracy, you would need a 1Msps acquisition rate. This can still be done with a uC, but you will need a fairly quick one for the math. You can use a diode as current sensor. It's not very accurate (you can improve that by either putting it in an oven, or adjusting for temperature drift). The advantage of a diode is that it can be used as a current sensor over a very wide current range, from 10's of nA to A.The simplest way is to just use a small button cell that lasts about a week, and then time how long it takes to deplete it. You write you normally use some "special battery". But is it really needed to emulate that special battery? I assume that special battery is for an expected life of months or years, but for testing purposes a much smaller battery may be more suitable, and depleting it in a few days or a week may be an advantage.Slightly more sophisticated is to use two coin cells, and a level detector that switches to the spare battery when the main battery is depleted.Coin cells are cheap (20ct or so), so you can buy a batch, and drain a few to test for capacity and spread in capacity.Another (but similar) option is to use a capacitor with a charging circuit. When the capacitor voltage gets below 3.2V you charge it up to 4.2V. (Suitable levels for Li-Ion) And then you simply keep track of the charge cycles for the capacitor.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: July 23, 2025, 02:23:22 am
content: Quote from: incf on July 23, 2025, 02:06:10 amWhat is the difference? Power consumption is directly mapped to battery life expectancy. So of course it's not to measure "battery capacity", but you use a (any) battery of a known capacity, and can calculate average power consumption from when it's depleted.Lithium coin cells are the easiest, but you can also use LIR. (I.e. "LIR2032" instead of "CR2032") The rechargeable cells have a smaller capacity, but you can test, retest and verify it. You also don't have to charge them fully, but put in a defined amount of mAh for testing. (But do compensate (test for) battery efficiency. But ( think) battery efficiency is mostly determined by changes in charge / discharge voltage, and not by the amount of electrons that move though the battery).For a more complete measurement than the advise given here, you would effectively be building your own variant of the JouleScope. You can make it smaller if you have a smaller dynamic range, and it's not so difficult if you don't need much accuracy, but it would still be a fair amount of work to design the hardware and write the software.For better advise, describe your product better.What is the range of voltages and currents? (Coin cell, or grid battery?)How big is it? how big can the test equipment be?Another unknown is what you can use as the main power devise. Can your test equipment run from a separate power supply? (Mains, or a separate battery?)

author: incf
author_rank: Frequent Contributor
timestamp: July 23, 2025, 02:58:09 pm
content: Quote from: Doctorandus_P on July 23, 2025, 02:23:22 amIf a battery can last 40 years, I can't wait 40 years to see if there is a firmware bug.And other battery chemistries behave differently with respect to pulse loading. We probably have to measure current consumption, not time, to get a good idea of what to expect form it. I wish 10mAh batteries had good performance at 100mA.Quote from: Doctorandus_P on July 23, 2025, 02:23:22 amThose batteries do not characterize capacity under ~100mA 5 second and ~10mA 100 microsecond pulse conditions. It would not be accurate.Please let me know if I am wrong. But we need something like +/-25% measurement accuracy or better. Can a coil cell do that?Quote from: Doctorandus_P on July 23, 2025, 02:23:22 amDefinitely not doing that.Quote from: Doctorandus_P on July 23, 2025, 02:23:22 am3.6V, 3uA normally up to to 100mA for several seconds at a time.Small.A bench power supply is fine to emulate a battery.

author: voltsandjolts
author_rank: Unknown
timestamp: July 23, 2025, 03:44:21 pm
content: Quote from: incf on July 23, 2025, 02:58:09 pmExtrapolating from two weeks to forty years is a fool's errand, even if you are aware of self discharge, pulse loading effects, passivation, electromigration, dendrites, internal pressure changes...

author: incf
author_rank: Frequent Contributor
timestamp: July 23, 2025, 05:06:35 pm
content: That is why the thread is about measuring mAh, not time.We don't care about time, we care about total quantity of charge consumed.Proxy measurements using time are of little use if they cannot be made to accurately correspond to a given quantity of charge.

author: David Hess
author_rank: Super Contributor
timestamp: July 23, 2025, 05:46:17 pm
content: Quote from: incf on July 22, 2025, 11:53:46 pmThe Joulescope connected to an independent PC tucked out of the way and on a battery backup will be the easiest thing to do. If a Windows PC, then I would disconnect the network to prevent unintended updates which reboot it. A spare laptop might be ideal.QuoteA sample every 50 microseconds for 2 weeks is about 24 gigasamples, so possible but not really practical. That means doing what the Joulescope does and making short integrated measurements. The circuit to do this is not difficult, and could be combined with a DSO or counter, but this is just duplicating what a Joulescope does.I do no have anything like a Joulescope, but have made that type of measurement like I described. I integrated the signal into a custom but simple charge balancing circuit which then produced a pulse measured by a universal counter set to totalize mode. Calibrate it to measure nanoamp-hours or whatever. I guess the output from the counter could be logged by a PC to get some idea of what is going on over 2 weeks.With some care, accuracy could be 1% or better. Instead of integrating the output from a current measurement, use the charge balancing circuit to directly deliver charge to the load and count the charges. This reduces errors to charge injection and leakage, which can be on the order of picoamps, yielding dynamic range and resolution of 12 digits.

author: radiolistener
author_rank: Super Contributor
timestamp: July 23, 2025, 09:20:47 pm
content: Quote from: David Hess on July 23, 2025, 05:46:17 pmYou don't necessarily need to store all high-rate measurement samples. Instead, you can integrate the energy consumption in real time and periodically log intermediate results for plotting or tracking trends. This significantly reduces data volume while still providing accurate long-term insights.

author: cunningfellow
author_rank: Regular Contributor
timestamp: July 23, 2025, 10:24:17 pm
content: Do you really need to measure current accurately for 2 weeks?Does each type of "event" have a fairly fixed power consumption? If it does I would just accurately record the consumption of each type of "event" and then log how many of each type of event happens in your 2 week test period.The changes you make to the firmware to log the event types/times will increase the power consumption over the two week period - but you don't care about that as you already recorded accurate power for each event before hand.

author: mtwieg
author_rank: Frequent Contributor
timestamp: July 23, 2025, 11:00:09 pm
content: Quote from: radiolistener on July 23, 2025, 09:20:47 pmYeah, this sounds like something one could whip together with an arduino and serial port without much trouble...You might look at specialized coulomb counter chips like the LTC2944. Its measurement is based on a true analog integrator, so it should be able to accurately meter charge even in very fast pulses. The arduino would then read it via I2C and print to serial.

author: Siwastaja
author_rank: Super Contributor
timestamp: July 24, 2025, 06:19:41 am
content: Quote from: incf on July 22, 2025, 11:53:46 pmThis part is trivial: just don't use Windows.Of course a full-blown PC is still not the most efficient solution (energy or unit cost or size wise) but the advantage of general purpose computer is the low setup cost (in time spent), you probably have some lying around already and can use scripting languages, keyboards, displays, networking, ssh, whatever, with minimum time invested. Nothing beats that convenience for one-off custom monitoring/logging needs.

author: MariuszD
author_rank: Regular Contributor
timestamp: July 24, 2025, 07:35:21 am
content: Quote from: incf on July 23, 2025, 12:24:26 amYou can make an RC filter <0.1Hz using resistors in the megaohm range and film capacitors with a capacitance of a few µF.You can use several RC circuits to increase the attenuation of higher frequencies.

author: tszaboo
author_rank: Super Contributor
timestamp: July 24, 2025, 08:08:49 am
content: Quote from: mtwieg on July 23, 2025, 11:00:09 pmIt's incredibly not trivial to measure power consumption on a device like this. Your measuring device needs to cover 7 orders of magnitude, and do that with range switching without UVLO to the DUT.Quote from: MariuszD on July 24, 2025, 07:35:21 amThis resets the device when that 100mA pulse happens.Quote from: incf on July 23, 2025, 02:58:09 pmI can appreciate this issue, as I often have to do similar lifetime estimations. There are 2-3 tools that we have in the office to do these kind of things.DMM6500 multimeter: Has fast 1MSPS sampling to capture peak current and accurate enough for sleep current. But not really suitable for this IMHO.Nordic PPK power profiler kit: Low cost device to measure these RF sensors. Unfortunately it's not very reliable, I found it often times to measure the current incorrectly, depending on what the DUT does. Since the FW guys love this thing it's very frustrating when it does that, leading to endless discussions for days, writing reports and so on. I don't think this can do measurements for weeks out of the box. Though it comes with a python library so maybe you can make some software for it to do that measurement and filter/decimate/average the data to manageable amount.Keithley 2280S: This is a precision power supply. It has a resolution of 0.1uA in it's 100mA range, and accuracy of maybe 3-4uA. I use it in trend plotting mode, and use the statistics to get an average current. It's a Keithley so it's almost good, but disappointing. When you are in statistics, it won't show you the number of points used for the statistics, or elapsed time. Also a 3000 EUR power supply with math functions somehow cannot calculate power. I don't think the statistics in this will go for weeks, you probably have to program it through SCPI and write your own code to calculate the average.I almost bought the Julescope, but honestly after buying several PPKs I don't think I want to have yet another disappointing USB gadget.

author: RoGeorge
author_rank: Super Contributor
timestamp: July 24, 2025, 08:26:02 am
content: Power the device from a small battery of a known capacity, or from a supercap, then write down the date/time when the device has stopped working.This way, you don't need to measure the energy at all, only measure the total time the battery lasted.After all, that's the most important thing to know, how long it takes until the battery gets exhausted. Then, by knowing the initial battery capacity and the running time, you can calculate the average current, too, if needed.

author: tszaboo
author_rank: Super Contributor
timestamp: July 24, 2025, 08:40:10 am
content: Quote from: RoGeorge on July 24, 2025, 08:26:02 amThe ESR of such battery is going to be so different that your measurement is completely wrong.Even if you would use a battery that is 1/100th of the capacity of the original (if it exists) then your measurement would take ~ half a year. The expected battery life is 40 years.

author: RoGeorge
author_rank: Super Contributor
timestamp: July 24, 2025, 09:38:56 am
content: It doesn't say 40 years in the OP, but if that's the time range, then the Iavg becomes irrelevant.Unless maybe, you install the device on a satellite or something, but anyway.If I were to try to measure such a small quantity, then I'll probably do the other way around, by powering the device from a low leakage capacitor (a small enough one), and adding just the right amount of current into the capacitor (through a big series resistor and a constant voltage power supply). Then lower the current (increase the series resistor) until the device stops working in a day or so.The idea is to 'starve' the device until the added energy through the series resistor become less than the energy needed by the device. The capacitor is to average the voltage.Aside from that, I think the idea of improvising while doing such a delicate measurement (instead of just using the instrument that is already there) should be reconsidered. The point of spending money on lab instruments is exactly for situations like this, so to be able to measure reliably, and also to spare the time of trying (and failing) with all kind of improvisations.I'll use the existing lab instrument.

author: GigaJoe
author_rank: Frequent Contributor
timestamp: July 24, 2025, 09:58:44 pm
content: are we talking to use PC integrated sound card , and some basic circuit to make fit it for measurement ?? some has 96k sampling , and 2 channels ...software definitely existoops .. i forgot about input caps

author: Doctorandus_P
author_rank: Super Contributor
timestamp: July 25, 2025, 08:20:41 pm
content: This should work:https://www.tek.com/en/products/keithley/dc-power-supplies/2281s-series-battery-simulator-emulatorAnd it's relatively cheap too. If you want more expensive, you can dress out an LXI rack with the modules of your choice (and there is plenty of choice for that kind of money).

author: incf
author_rank: Frequent Contributor
timestamp: July 25, 2025, 08:51:01 pm
content: Quote from: Doctorandus_P on July 25, 2025, 08:20:41 pmThat is the sort of thing I was looking for - it fits the requirements. Although now that I see it, I do wonder if a cheap (Asian?) knockoff might exist. Unfortunately my non-english internet search skills are lacking. Not sure that I'd want to spend that much - although it certainly would get used.

author: tszaboo
author_rank: Super Contributor
timestamp: July 25, 2025, 10:32:06 pm
content: Quote from: Doctorandus_P on July 25, 2025, 08:20:41 pmI think the difference between the 2280 I mentioned and the 2281 is that the latter can discharge batteries, make a model, and simulate the ESR of a battery. I'm not sure paying almost 2x as much is really worth it.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: July 25, 2025, 11:55:15 pm
content: My mention of the keithley monster was not really meant to be taken seriously.I just had a short peek at the datasheet of the Joulescope and it has a sampling rate of 2Msps. Can it do that continuously?Well, apparently you're happy with your Joulescope, and you main concern was about the cabling mess. You could get a sturdy plastic box, or make a nice wooden box or attache case and mount all your parts inside, including a laptop, or maybe a small (linux) SBC of your choice. Apparently the Joulescope has Linux support.But the Elephant that is maybe missed here, is that maybe you should not be pulling such high current short pulses out of your battery in the first place. Putting in a quite large buffer capacitor (10mF or so, maybe a super cap) parallel to your battery (an inductor in between?) probably improves battery life, as the peak current for a battery usually diminishes when it's getting near it's end.And another aspect: How accurate do you really need to be? Does it matter whether your gadget lasts 30 years or 35 years on a battery? (Thats a 16% difference).First draining a battery down to 20% remaining capacity to test "end of life" is probably also not going to work very well. It's quite different from predicting how your battery is going to behave over 30 years.

author: tszaboo
author_rank: Super Contributor
timestamp: July 26, 2025, 09:14:38 am
content: Quote from: Doctorandus_P on July 25, 2025, 11:55:15 pmI mean all this equipment is expensive, sure. Compare it to the cost of a design that's doesn't meet specifications, and it's usually not that expensive anymore.It usually goes like this:1. I need X equipment to do my job properly2. Management decides it's too expensive, and we don't buy it3. We ship something that needs to be recalled or clients RMA it. The cost of this is an order of magnitude or two higher than the equipment4. We buy the equipment fix the issue5. Engineers get the blame for everything6. We have a "I told you so" meeting bringing up old decisions (usually with proof)7. Point 6 is forgotten in a week and engineers are still to blame.I'm not even salty about it anymore, I totally expect this to happen every single company, in every single country I work. I tell my managers to just blame me for everything on the meetings that I'm not attending, because I don't give a f about it anymore. I can't wait until CEOs realize that middle managers are the easiest to replace with AI because they don't add anything of value anyway. I mean an AI is probably easier to convince because it ahs better memory than a goldfish and better reasoning skills than a donkey.

author: mtwieg
author_rank: Frequent Contributor
timestamp: July 27, 2025, 12:42:09 pm
content: Quote from: tszaboo on July 24, 2025, 08:08:49 amWhat do you base this on? I don't see any detailed specs from the OP (current levels in the quiescent/pulsed states, frequency of the pulses, etc).

author: tszaboo
author_rank: Super Contributor
timestamp: July 27, 2025, 01:03:31 pm
content: Quote from: mtwieg on July 27, 2025, 12:42:09 pmOn experience.And this:Quote from: incf on July 23, 2025, 02:58:09 pmSo you have a device that drains uA normally, and 100mA sometimes. That's 7 order of magnitude.

author: Psi
author_rank: Super Contributor
timestamp: July 27, 2025, 01:13:45 pm
content: The JouleScope does have a USB API and some tools you can use to stream out the data yourself in python/C or to a CSV or whatever without needing the JouelScope app.You could make a small standalone test system with a Raspberry Pi or other SBC.That would solve the issue of not wanting to have something huge with wires everywhere for weeks that someone could mess with. If the entire thing is small you can lock it away.Two words of caution,I have played with the JouleScope API and it has or had some stability issues when I last used it. (Might have been my fault, YMMV)And the JouleScope can produce an absolute shit ton of data if you let it. So you'll need to decide just how much you want to log and have enough storage for that. You can log individual samples at whatever rate your hardware can handle, but you can also just log the running math averages which are probably more doable for 2 weeks of runtime. Otherwise you'd probably want a Pi5 so you can use a M.2 NVMe hat and throw a shit ton of storage into it.

author: incf
author_rank: Frequent Contributor
timestamp: July 27, 2025, 01:36:01 pm
content: Quote from: Psi on July 27, 2025, 01:13:45 pmThat is what I have observed - or at least inferred from interacting with it.Welp, I'm almost tempted to mark the thread as closed but not solved. Sounds like the problem space is pretty much exactly the same as I had expected it to be going into this. There are one or two models of dedicated test equipment that are somewhat pricey for my taste, and the joulescope which is "mostly adequate." (USB interface + it's Python based software is mediocre - I wish it was a wired Ethernet device, I wish they had a more rigorously correct/robust internal/library/gui software/firmware implementation in Rust)If I were doing this for fun rather than commercially I'd be half tempted to go off on a tangent. Reverse engineer it and put together my own software and/or PCB.

author: Psi
author_rank: Super Contributor
timestamp: July 28, 2025, 04:21:12 am
content: Quote from: incf on July 27, 2025, 01:36:01 pmI'm not sure if I'm happy that the issues weren't just me being stupid, or if I'm sad that the JouleScope API is unstable.

author: radiolistener
author_rank: Super Contributor
timestamp: July 28, 2025, 05:18:46 am
content: You can connect 1000 identical devices in parallel to significantly simplify the energy measurement process. This approach has several advantages:- It effectively spreads the current pulses over time, reducing the chance of synchronization and smoothing out the overall current profile.- The resulting aggregate current will be much higher and more continuous, allowing you to use less sensitive or lower-resolution instruments without missing the short pulses.- After running the setup for two weeks, you can measure the total consumed energy in mAh and simply divide it by the number of devices to get the average per-device energy consumption over that period.This method not only improves measurement accuracy but also averages out random variations between individual units. It helps eliminate the risk of underestimating energy usage due to atypical behavior in a single device (for example skipped operations or reduced activity during observation). With a large enough sample size, you obtain a robust and statistically reliable result.

author: Jeroen3
author_rank: Super Contributor
timestamp: July 28, 2025, 07:42:11 am
content: Quote from: Psi on July 27, 2025, 01:13:45 pmNo need:https://github.com/jetperch/pyjoulescope_examples/blob/main/bin/downsample_logging.pyGet an old laptop/pc, put linux mint with python on it, an you're set.You can use chatgpt for the shell commands to add it do systemctl if you want it to automatically restart after powerfailures and such.

author: tszaboo
author_rank: Super Contributor
timestamp: July 28, 2025, 09:28:51 am
content: Quote from: radiolistener on July 28, 2025, 05:18:46 amHow practical do you think this is? How much does it cost?You need the setup dedicated for engineering because you need to test every single firmware release.Even 10 devices can be highly unpractical to do.

author: mtwieg
author_rank: Frequent Contributor
timestamp: July 28, 2025, 01:08:39 pm
content: Quote from: tszaboo on July 27, 2025, 01:03:31 pmIt's not clear that the 3uA idle current actually contributes significantly to overall current draw. Depends on the average duty cycle of the higher current operation, which AFAIK isn't well defined yet. If that duty cycle is >0.1%, then the 3uA idle current basically becomes irrelevant, and much less precision in the current/charge measurement is required.Quote from: incf on July 23, 2025, 05:06:35 pmJust curious, why do you care about measuring charge when, as you correctly stated, effective battery capacity can change greatly when the load is pulsed? Therefore whatever average current you end up measuring will not be useful for predicting battery life.

author: tszaboo
author_rank: Super Contributor
timestamp: July 28, 2025, 01:15:20 pm
content: Quote from: mtwieg on July 28, 2025, 01:08:39 pm3uA doesn't sound like much. I have devices that operate also mostly in this low power state. When you are calculating the battery life, you have to calculate with the temperature of the device and "integrate" somehow the usage. So high current at low temperatures are going to drain the battery more than room temperature. At high temperature the self discharge of the battery is higher, could be higher than your sleep current.If you have high current pulses, and nothing in-between, your battery might be in a passivated state that it cannot even supply that high current. Passivation is good because it reduces the self discharge, bad because ESR might become hundreds of Ohms.It's a very complicated topic. Not just multiplying the average current with the time.

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: July 28, 2025, 01:21:26 pm
content: Hi group,Take a look at the LTC3335:Link:https://www.analog.com/en/products/ltc3335.htmlIt is a buck-boost power supply with a Coulomb counter built in.Also look at the user guide, there is a GUI available.Link:https://www.analog.com/media/en/technical-documentation/user-guides/dc2343afb.pdfThis should give you a low-cost solution.Regards,Jay_Diddy_B

author: BILLPOD
author_rank: Frequent Contributor
timestamp: July 28, 2025, 01:28:24 pm
content: Good Morning Incf, I found this on another thread:https://www.westmountainradio.com/product_info.php?products_id=cba5Would this work for you

author: mtwieg
author_rank: Frequent Contributor
timestamp: July 28, 2025, 01:34:35 pm
content: Quote from: tszaboo on July 28, 2025, 01:15:20 pmThe OP stated they are not interested in measuring/calculating battery life.

author: incf
author_rank: Frequent Contributor
timestamp: July 28, 2025, 03:40:49 pm
content: Quote from: radiolistener on July 28, 2025, 05:18:46 amThat is clever, I had not thought of that. However, I fear it is impractical. The devices are not standalone, but rather components of a communications network. That would be really expensive and I'd still be faced with the prospect of accumulating accurate current measurements over a two week span (my battery can't supply 100mA to 1000 devices at the same time, so it would have to be via bench supply and measured like before)Quote from: mtwieg on July 28, 2025, 01:08:39 pmThe the 3uA idle current does in fact contribute significantly to overall current draw. It is idle the vast majority of the time to achieve low consumption from the battery.It is more useful of a measure than you might think. We deal with that years later with modeling.We care about measuring charge consumption because it is the only thing we can measure and model. We can't measure time in this instance. We don't really care about time in this instance (except as an approximate proxy for charge). So instead we measure charge. We care about and model using charge consumption because all other measures and models appear to be impractical.Quote from: BILLPOD on July 28, 2025, 01:28:24 pmThat's the inverse of what I'm after. That discharges a battery and measures capacity. I'm looking to measure consumption from a supply emulating a battery.Quote from: Jay_Diddy_B on July 28, 2025, 01:21:26 pmThat is a 'slick' component. But I probably won't engineer a custom test stand around it, not worth it compared to buying equipment or making do without. I would question its accuracy at Iout=3uA and suspect it would require a bit of engineering to make it accurate to within +/-25%.

author: incf
author_rank: Frequent Contributor
timestamp: July 28, 2025, 03:58:26 pm
content: Quote from: Psi on July 28, 2025, 04:21:12 amI'm stuck on old versions of the software for "reasons" (related to their python build system and library version mismatches) and suspect that maybe newer versions might be better?Some day I'll have an opportunity to test the latest and greatest.

author: mtwieg
author_rank: Frequent Contributor
timestamp: July 28, 2025, 04:06:29 pm
content: Quote from: incf on July 28, 2025, 03:40:49 pmOk, then you do need some highly specialized equipment for this measurement.QuoteCan you actually measure it though...?QuoteIt's hard to think of an easier thing to measure precisely than time....QuoteI guess I still don't understand how you intend to use the charge measurement result. It's a very difficult measurement to do accurately, and it throws away all the details of how the charge was delivered.

author: tszaboo
author_rank: Super Contributor
timestamp: July 28, 2025, 04:11:56 pm
content: Quote from: incf on July 28, 2025, 03:58:26 pmLearn something called venv.https://python.land/virtual-environments/virtualenvI know it looks scary, but it's useful for situations like these.

author: incf
author_rank: Frequent Contributor
timestamp: July 28, 2025, 04:18:47 pm
content: Quote from: mtwieg on July 28, 2025, 04:06:29 pmWe can't wait 40 years to measure how long the battery will last.And time doesn't tell us anything about how much charge it consumes when different events occurs - time would not tell us what we need to know since every product operates under different conditions (ie. every product is subject to a different random sequence events in the field that consume known amounts of charge).

author: incf
author_rank: Frequent Contributor
timestamp: July 28, 2025, 04:19:58 pm
content: Quote from: tszaboo on July 28, 2025, 04:11:56 pmIt depends on a different much newer version of libc than my system has. I'm not sure that it's a venv type problem.I think I'd have to custom compile a new libc and use LD_PATH= to make it work.

author: radiolistener
author_rank: Super Contributor
timestamp: July 29, 2025, 01:40:38 am
content: Quote from: incf on July 28, 2025, 04:18:47 pmyou can significantly accelerate the testing process by connecting 40 identical devices in parallel to the same battery. This effectively compresses the time scale - if all devices consume power independently and evenly, the battery will deplete roughly 40 times faster, giving you a reliable estimate of long-term consumption in just 1 year.This technique preserves real-world conditions while allowing for faster validation, and the results will be statistically more robust due to averaging across multiple units.

author: ArdWar
author_rank: Frequent Contributor
timestamp: July 29, 2025, 02:04:43 am
content: In the end you really have to cut some corner(s) and put some measured assumption into your test. You can't just get all of your cakes and eat them at once.With the way you (appear) to approach this situation if you want *real* battery and *real* load behavior with no compromises you really need to wait for the whole life of the battery. Otherwise if you put smaller battery and/or more load for your test then you could always argue that it wouldn't be *exact* representation because the battery and load would certainly behave slightly differently with different source impedance, loading situation, discharge rate etc.

author: incf
author_rank: Frequent Contributor
timestamp: July 29, 2025, 04:24:20 pm
content: Quote from: radiolistener on July 29, 2025, 01:40:38 amThe battery ESR cannot handle more than one device. Capacitors can't cover it either. It would be very impractical (and more expensive than other paths) for a bunch of reasons outlined in previous posts.

author: incf
author_rank: Frequent Contributor
timestamp: July 29, 2025, 04:28:44 pm
content: Quote from: ArdWar on July 29, 2025, 02:04:43 amI don't care about real battery performance or real battery life.The compromise is measuring total charge consumed using a cheap (~$1000) and slightly flaky instrument like a joulescope or one of the more expensive (and presumably reliable) standalone instruments referenced in this thread.

author: mtwieg
author_rank: Frequent Contributor
timestamp: July 29, 2025, 05:10:57 pm
content: Do you need to do this charge/current measurement with a specific battery as the source? Or can it be with any arbitrary DC source?

author: Doctorandus_P
author_rank: Super Contributor
timestamp: July 29, 2025, 07:14:58 pm
content: Quote from: incf on July 29, 2025, 04:28:44 pmYou've got a very fine edge between what you do and do not want to measure.It's quite simple to make an apparatus that charges a reference capacitor with a known current, and between two reference voltages. It's simple, easy to DIY, it's reliable and accurate. It's very similar to the dual slope conversions as used in the 7+ digit DMM's from years gone by.This thread is becoming quite long (and a bit tedious), and as far as I can see you have not even considered this method seriously.It can even be simplified further: You don't need accurate voltage references, only an accurate current source, and then either measure the recharge time accurately, or just give it fixed charge pulses, that boost the capacitor voltage by a volt or so (I.e. from 3V2 to 4V2). And then you simply count charge pulses.

author: incf
author_rank: Frequent Contributor
timestamp: July 30, 2025, 05:44:25 pm
content: Quote from: mtwieg on July 29, 2025, 05:10:57 pmAny source like a DC bench supply.Quote from: Doctorandus_P on July 29, 2025, 07:14:58 pmOkay, that is a new idea. Previously discounted due to temperature dependent capacitor leakage current being on the same order of magnitude as the idle current of the product. (Idle being 3uA and capacitor leakage being a variable ~3uA)I suppose you are right, it likely could measure charge to within 25% accuracy without too much hassle.I wonder if this could this be done via LXI scripting of a multi-meter and a bench power supply.Have a bench supply with 1N4148* output diode and 30F capacitorSet the current limit of the bench power supply to 10mA and 4.0VMeasure the voltage once per second using LXI. If below 2.9V turn on PSU output start charging. If above 3.0V turn off PSU output to stop charging. (It takes about 6 minutes to charge 0.12V)Record the state of the system (PSU on or off, and optionally voltage) with timestamp once per second in a logTotal charge consumed is just the number of seconds the power supply spent charging the capacitor times a constant, right? (assuming it is in current limiting mode, assuming a certain output current limit accuracy)https://www.tecategroup.com/products/data_sheet.php?i=TPLC-3R8/30MR10X16*or BAT43/BAT41 for lower Vf

author: David Hess
author_rank: Super Contributor
timestamp: July 30, 2025, 06:36:15 pm
content: Quote from: incf on July 30, 2025, 05:44:25 pmThat is known as a current balancing ADC. My suggestion above was to use a charge balancing ADC where the reference current and time is replaced by a voltage and a capacitor to dispense charge.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: July 30, 2025, 07:40:34 pm
content: A 20F capacitor may have a lot of leakage, but a lot of them are made for backup applications.But I was thinking more like a 100uF film capacitor. These cost a few EUR, and can be of good quality. Plenty of choice.With your 3uA standby current, it will drop 1V in 33 seconds.With a 10mA current, it will drop 1V in 10ms.So you have to recharge your capacitor every 10ms to 30s.It's easy to measure time intervals with much better then micro second resolution so accuracy is not much of a problem for this part of the circuit.But overall you're giving us very little information. It's still not clear how high your current peaks are, and how long their duration is approximately. There is only a mention that the 3uA stand by current is a "significant portion" of the total current consumption.If you want a steady output voltage, you can add a voltage regulator after the capacitor, but it does need to have a very small quiescent current.And it's still not clear to me what you actually want to measure. The ability of your battery to deliver the peak current may be a mayor factor, but that is usually mitigated with some decent sized bulk buffer capacitors.

author: incf
author_rank: Frequent Contributor
timestamp: July 30, 2025, 09:50:53 pm
content: Quote from: Doctorandus_P on July 30, 2025, 07:40:34 pm3uA standby, 100mA for 5 seconds (it's buried in the thread), and lots in-betweenI only care to measure an absolute quantity of charge consumed within 25% accuracy (preferably 5%) over several weeks (without trying up too much space, without the test flaking out, without needing too much babysitting, etc.) for modeling purposes.All other parameters have been covered, the battery is up the the task. We've used, modeled and characterized the battery over long periods of time so we know exactly how it behaves. We also have a good idea of the transient behavior of the product thanks to having a joule-scope. What we don't know is the long term aggregate behavior. The product does certain "work/events" on very long cycles on a network with multiple devices that can take weeks to complete.If I have to (and I really don't want to) I could make a jig with custom circuity. But would rather cobble together something from existing bits of test equipment rather than build or buy since the price/effort/leadtime range for both is more than I care for at the moment.

author: Psi
author_rank: Super Contributor
timestamp: July 30, 2025, 11:14:34 pm
content: You can use supercaps to measure a pulsed load over time, but as Doctorandus_P said, the leakage is an issue you have to deal with. The leakage is high near max volts and practically constant at a fraction of max voltageSo one way you can do it is to put many supercaps in series so each is at a very low voltage vs their max for the entire test.This spreads your span for total min V vs total max V across all caps so each one only see's a tiny voltage change and at a low voltage. This usually makes the leakage practically constant and easy to factor in unless your caps are total trash.You simply do a no-load leakage test and then factor that constant in when you run the test and process the results.One word of warning, there are lots of supercaps on the market labelled 'hybrid' or have 'Li' in the name. That are actually a hybrid between a cap and a lithium cell. Don't use those, they have the same min discharge voltage as lithium batteries. You want a real supercap.

author: incf
author_rank: Frequent Contributor
timestamp: July 31, 2025, 01:02:16 am
content: side tangent observation: many 3.8v supercaps seems to have "minimum working voltage" of around 2.2V. I'm not sure what happens below that voltage.

author: Psi
author_rank: Super Contributor
timestamp: July 31, 2025, 08:41:45 am
content: Quote from: incf on July 31, 2025, 01:02:16 amThat's exactly what I'm referring to.If it has a min voltage it's a hybrid between a supercap and lithium cell, not a normal supercap.It isn't always obvious that's what it is from a quick look at the datasheet. Hence the warning.

author: mtwieg
author_rank: Frequent Contributor
timestamp: July 31, 2025, 03:11:27 pm
content: Quote from: incf on July 30, 2025, 05:44:25 pmQuote from: incf on July 30, 2025, 09:50:53 pmSee, if what you say here is true, I still don't understand why you think you need to measure average current over weeks.The main thing that makes such a measurement difficult is the 3uA idle current. But if you know a-priori that the idle current is ~3uA, then you don't actually need to measure it accurately in your experiment. Your setup needs to only determine that the device is idle, in which case you just assume the current draw is 3uA (if you want to account for temperature drift in the idle current, then model that in a separate experiment, then use temperature measurements during the long experiment to account for that effect).Basically, divide an conquer. Characterize the device's current draw in all known states (should take minutes for each state, using a basic DMM), then do a long experiment in which you only merely measure the time spent in each state (perhaps by measuring approximate supply current, or by some debug output from the device, etc). Then just combine those results to calculate average current over the long experiment.

author: incf
author_rank: Frequent Contributor
timestamp: July 31, 2025, 03:39:06 pm
content: Quote from: mtwieg on July 31, 2025, 03:11:27 pmWe need to see if we missed anything. Divide and conquer is error prone, and what we already do with varying degrees of success and accuracy. By measuring the total we actually know with some certainty that everything is good. It is very expensive to be wrong in this application.

author: mliberty
author_rank: Contributor
timestamp: August 04, 2025, 08:55:02 pm
content: I am a little late to this, but we have many customers who have used Joulescopes to log months of data using thedownsample_logging.pyscript mentioned. The nice thing about the downsample_logging.py script is that it has a resume feature in case your host computer shuts down or reboots. Customers have also created custom automation and test systems using Joulescope statistics and the Python API.You do need to prepare your host computer for long-term stability. I recommend a UPS and a dedicated small-form factor computer. People use Raspberry Pis successfully, but I tend to recommend NUCs (ASUS, formerly Intel) as they seem to have fewer mechanical and electrical stability issues.For best results, you need to configure the host computer to disable all power management, disable anti-virus, and disconnect networking. If you need networking, you need to be very careful to prevent updates, backups, and other things that may stall or reboot the host computer. We have a brief guide forWindows. Linux is usually easier to make more reliable, but you need to be familiar with Linux. A mac Mini with macOS is another option.I don't normally monitor this forum, but someone mentioned this thread to me. If you try using your Joulescope and run into any issues, please post over on theJoulescope forum. We monitor the Joulescope forum regularly and are happy to support!DISCLAIMER: I am the creator of Joulescope