Battery life calculator - Page 1
Forum section: electronics / projects

author: ebogdum
author_rank: Newbie
timestamp: October 18, 2023, 09:09:35 am
content: Hi everyone,First of all, nice to meet you all. I've always admired this field but I never thought I have the capacity to actually do anything in it. That being said I started learning stuff with the pandemic cause I had the time and yeah ... it's even more amazing now.That being said, one of the biggest issues I've encountered was the battery life calculation. I mean, so many components go on a PCB and some have also specific states, like the ESP32 microcontroller, it's using way much power for the time it's sending a message than for the time it's just sitting around (maybe in sleep) or reading a sensor via I2C.Cause my background is mostly in IT, hardware and software I've decided to make an app that can help with that.My question is: would you guys see yourselves using such an app?The main attraction for it, is that you can add a battery of a known capacity, add components and if the case need be the states for those components and run times for those states, at the end the app will basically calculate how much time your device/board whatever will run for, like an hour, a day ... maybe a month or a year.Anyway, any feedback would be appreciated.Thank you.

author: Ian.M
author_rank: Super Contributor
timestamp: October 18, 2023, 09:28:26 am
content: No. Its difficult to put an app under source control, vs a spreadsheet, and the spreadsheet can handle other design calculations. Also its far easier to validate the calculations in a well set up spreadsheet vs an open source app, and if its closed source, just forget about it.Also, how do you plan to handle the battery's discharge curve, and its effect on total load current over time, which will differ depending on whether the load has a linear regulator, a switching regulator or runs direct from the batterey, and for the latter will also be highly dependent on the type of load and what its actually doing? e.g. an ESP8266 will have less WiFi power at lower VCC so near the router in a strong signal area its power consumption is likely to decrease, but in a weak signal area, it may well increase due to the number of retries increasing. There are plenty of other types of load that are highly non-linear with respect to supply voltage.A complex design may well have some combo of the above. Then you get in to designs with rechargeable batteries + energy harvesting or solar cells, where you have to consider localised seasonal variations in the energy source and varying efficiency of the battery with ambient temperature, to ensure you have enough stored energy to ride out an extreme winter storm (e.g. a 10 year event) and enough energy input to recover in the interval between storms.

author: ebogdum
author_rank: Newbie
timestamp: October 18, 2023, 09:36:27 am
content: Thanks for the feedback.I do agree with the things you said, but at the same time, I couldn't find any other tool that would come close to any reasonable calculation/estimation.The main idea of this battery life calculator that tells you the run time, isn't to map the entire worlds physics, but to give you a more in depth view of what run time you can expect from your future project without actually building it.The example with the ESP32 being closer or farther away from the router, is the best example that even build you can't really know the run time, unless you measure it constantly.As far as the load usage goes and other battery characteristics, probably in time I would add those to, but that would be a massive undertaking as each component affects the load in a certain way. Not to talk about the percentage of accuracy between components, like resistors, where it's hard to find two of them alike.In other words I'm not striving for 100% accuracy here, I'm just trying to make something that would be in the 90 - 95% range of accuracy.

author: Ian.M
author_rank: Super Contributor
timestamp: October 18, 2023, 09:53:03 am
content: So you measure (or look up) the average on state current, off state current, + any low power state currents, and multiply each by the duration of that state per hour, day or whatever, and scale the result to get the Ampere hours per <period>. Multiply by the number of <period> min. operating life required and you get the required battery capacity. Anyone who knows the math can knock out the numbers fairly quickly for simpler cases with just a four function calculator + pencil and paper. When it gets more complex, one writes a spreadsheet. Most of the tedium is researching the source data, digging through data sheets, then maybe finding they don't give 'typ.' values so scouring the web for anyone who's measured it before you, assessing if their setup is sufficiently similar, and if not, resigning yourself to building and measuring a prototype.An app brings very little to the table and obscures the source data. Yes it may help you determine the influence of component B drawing 235mA for 139 seconds per day on your expected battery life, but when you need to verify that 235mA figure without measuring it, how difficult is it going to be to determine where the app got it from?

author: mjs
author_rank: Regular Contributor
timestamp: October 18, 2023, 05:09:31 pm
content: I have done quite a few energy budgets for battery operated devices. Depending on the case, there may be a few different parameters or specialties which are trivial for a spreadsheet, but might be complex to add to an specialized application. In more complex cases, I'm doing a Monte Carlo simulation for a population of devices using Python.