# Logging lithium battery discharge: why this curve?

I'm using Arduino to log the discharge curve of a 5V battery pack (usb type for smartphone recharging). Using Arduino I read the voltage every second and I save it to a log file. Arduino is powered by an external source, the battery pack is connected to a 4.8 ohm resistive load to have about 1 ampere of draining.

simulate this circuit – Schematic created using CircuitLab

I'm using the volt divider because arduino Analog pin has 0-5v range, so I read 2.5V and then I multiply it by two.

But I have an issue: as you can see the discharge curve go up, and down, and up again and then it stop with a value that is high. I check the battery and is empty, but I don't know how I obtain this discharge curve instead of something like this:

• You are not measuring the discharge curve of the battery. You are measuring the output of a boost regulator that raises the battery voltage to 4.8 V or so. Aug 27, 2015 at 19:23
• Try searching for "lithium ion battery discharge curve." You will see that it starts at around 4.2V, declines rapidly at first, then very slowly, then rapidly again at the end of discharge. I don't know why the regulator in your test setup goes to a slightly higher voltage near the end, but it is a very small difference, and I would not worry too much about it. Aug 27, 2015 at 19:25
• So my measurement are ok. Is only the sony battery pack that has a circuit that try to boost the output keeping it constant. Aug 27, 2015 at 19:27
• @DigitalNinja I think in the powerbank, is a commercial Sony 5V USB powerbank for smartphone... Aug 27, 2015 at 19:27
• @RobertoPezzali If you are writing a mass publication, I would recommend treating it seriously, and perhaps getting a serious tool. For example, a Battery Analyzer like this one. Aug 27, 2015 at 20:06

First:

There are many reasons why your voltage would go up. As suggested by @jippie it can be heating in the boost converter in the pack. It can also just as easily be heating in your resistors, causing them to increase resistance and as such reduce drained current.

What's worse, slight imbalances between the two resistors' values will cause slight heating differences, which will cause bigger differences due to different heating, causing bigger differences in heating, etc etc, cause larger and larger measurement inaccuracy.

As @NickAlexeev suggests, if you are writing this for a mass-read publication you need to take this seriously or not do it at all. You will either mislead a large group of people with your findings or be quickly debunked by any one of "us professional EE engineers" living in your country. Best case scenario it's all wasted effort, worst case you're helping the world to yet more misunderstandings about EE and batteries and there are already way too many.

You need to:

1. Keep the current controlled and constant, so you can rely on your data and know that for every single measurement you can rely on it, exactly and accurately. Research current sink circuits and if you need ask more clarification later. The best solution will be one that either doesn't get hot at all (heatsink+fan), or one that is compensated for heat. Or preferably both.
2. Preferably measure back that current accurate to a percent or better (which in this sense is less than one percent), since a 1% error in your current will easily build up to a decent skew in your data. But at least, if it's fixed and controlled, you can know that all your measurements will be skewed the same.
3. Measure the voltage with a reliable set-up, if you want you can do it with an Arduino, but not using your load as a divider. That's basically pointless. You need the voltage to be reliable as well, that goes for the one you measure and the one you measure against. Which is either a decent reference, or a very stable and reliable power supply. Most people choose the reference, but it's not unheard of to make a 0.5% stable and repeatable 5V supply for something like this, but it's harder. The Arduino (Atmel MCU) has internal references, but also a pin that you can connect a reference to. I suggest the external option, since the internal one isn't very much more accurate out of the box than its supply voltage from a linear regulator.
4. Make sure you have a very accurate time-base. There are arduinos that use the internal RC oscillator of the processor: these are not in any way, shape or form accurate. You need one with a Crystal Oscillator that is capable of keeping decent time.

Once you've done all that, if your time also happens to cost something, you are going to have spent much, much more in materials, tests and research than the \$199 for the battery tester that Nick linked in a comment, so you may as well go for that.

And you need to, but this is when you buy the tester as well:

1. Read up a lot about how these packs work (what's a boost converter? how efficient are they on average?), what the batteries do and what the risks are with low grade electronics or batteries, because for a good, or even decent, article you will need to explain this well and clearly to your readers. Plus it helps you understand what you are actually measuring. Oh, and don't forget to think about what the mAh rating means and how that relates to the boosted voltage. the "mAh" number that's printed (on usually the more crappy ones) is for the internal battery, which is rated at 3.7V, not the 5V output. That's a free-bee you get from me.

As mentioned by many other posters, a voltage regulator in the recharging device is probably the cause for your odd discharge curve. That said, I had several comments regarding your methods that are too long to fit in a comment.

I would caution against your method of testing for two reasons:

1. As mentioned in the comments, a resistor cannot change to accommodate terminal voltage dropping as the battery is discharged. This is crucial because:
2. You do not appear to be controlling for a specific C-rate. A complete battery specification will advertise battery capacity at a given C-rate and lifetime in cycles for a fixed depth of discharge.

If you are "willy-nilly" discharging these batteries at 1 amp then you could absolutely going to find that some batteries are dramatically over/under rated compared to others. Discharge current causes $I^2R$ losses in the battery, with $R$ being the battery's internal resistance. I would personally perform testing at a C/10 or C/20 rate.

While I understand 1 amp would be the C/20 rate for a 20Ah battery mentioned in comments, OP has not specifically stated C rates anywhere in the question and has clearly made no effort to control the C rate.

As a last point regarding your testing - your "milliamphours" line on your plot is perfectly linear. It would appear that you've just multiplied the "1 amp" you are dissipating by the time step. As mentioned many times now, you are clearly not discharging at exactly 1 amp.

If you're not going to adjust resistance to draw current correctly, you should at least correct the capacity measurement based on the current you're actually measuring. You should measure the resistor's exact value, then use Ohm's law ($I = V/R$) along with the voltage you're measuring to calculate the exact current that's flowing through the resistor (and, from Kirchoff, the current coming out of the battery), and multiply that by the time step to get a better capacity measurement.

• In the case of a USB battery pack, it's probably sensible to ignore C rates and measure at constant currents of 500mA, 1A, and/or 2.1A, corresponding to common USB charger draws. A smaller pack will be discharged at a larger C fraction, but that's consistent with real-world use. Aug 28, 2015 at 3:43
• Real-world use maybe, but a battery is rated for capacity at a specific C rate. If OP is doing an article for a major publication, then he/she should test capacities at their rated discharge rates before commenting on how the manufacturers are cheating. I agree about the USB battery pack statement, but OP commented that there are 20 batteries to be tested. Aug 28, 2015 at 11:29