Jellybean Li-ion capacity tester - Page 1
Forum section: electronics / projects

author: cellularmitosis
author_rank: Unknown
timestamp: July 21, 2022, 07:49:18 am
content: Hey folks,I recently got interested in Li-ion cells, so I threw together a capacity tester / logger out of junk-box parts. It appears to work!It is a basic constant-current load controlled via an Arduino Pro Micro PWM output. The Arduino spits out CSV data, which is captured by a laptop and later graphed in google sheets.In other news, Li-ion cells from ebay perform about as expectedSchematic and an example run attached.

author: cellularmitosis
author_rank: Unknown
timestamp: July 21, 2022, 08:14:57 am
content: Initial firmware and scripts:https://gist.github.com/cellularmitosis/7b20eb22d93b7383ea7adb42cca22cbf

author: cellularmitosis
author_rank: Unknown
timestamp: July 21, 2022, 03:50:13 pm
content: I also had a few of these Ultrafire 26650 cells from eBay. These tested at about 1792mAh.

author: ledtester
author_rank: Super Contributor
timestamp: July 21, 2022, 04:56:23 pm
content: Nice project!In your source code I saw these comments:Code:// 230: 1389 mA (oscillation)// 240: 1445 mA (oscillation)// 250: 1496 mA (oscillation)In a lot of electronic loads there is a small valued capacitor between the output of the op-amp and the inverting input whose purpose is to quell oscillations. For instance, see this discussion:https://www.eevblog.com/forum/beginners/problem-with-diy-cc-load/msg4041931/#msg4041931

author: free_electron
author_rank: Super Contributor
timestamp: July 21, 2022, 05:45:00 pm
content: you have a measurement error. the base current of the 3055 is flowing through the sense resistor. use mosfets instead of bipolars.

author: cellularmitosis
author_rank: Unknown
timestamp: July 21, 2022, 06:18:05 pm
content: Quote from: ledtester on July 21, 2022, 04:56:23 pmThanks!I'll give the capacitor a shot, but I suspect this is just the natural result of the LM358 being pushed too close to its positive supply (5V).When I look at the scope, there is naturally a small 490Hz sine wave due to the filtered PWM from the Arduino. As I get up near 1200mA or so, you can see the waveform start to get distorted, as the 358 nears its limit. As you push it further, that distortion then becomes a small, then a larger oscillation.Of course it is inevitable that the 358 will run out of room, as increasing load current causes the sense resistor to float the transistor up, the op amp output must also rise, until it runs out of room. Resizing the sense resistor would give a trade-off of increased load range vs decreased resolution.(though I am curious if I could squeeze just a bit more range out by dropping the op amp output resistor from 10R to 1R).

author: cellularmitosis
author_rank: Unknown
timestamp: July 21, 2022, 06:23:32 pm
content: Quote from: free_electron on July 21, 2022, 05:45:00 pmAh, actually I think the only error current is through the 2N3904 base, from the op amp, and that should only be a few milliamps.

author: mycroft
author_rank: Regular Contributor
timestamp: July 21, 2022, 08:48:13 pm
content: Quote from: cellularmitosis on July 21, 2022, 06:18:05 pmYou can get 0.5 Volt changing the 2N2904 to a 2N2906 (Darlington -> Sziklai) and complementing the PWM signal.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: July 24, 2022, 06:02:30 pm
content: Total HFe of 2n3904 and the 3055 darlington is probably around (or above) 1000, so about (or less) 0.1% error, so it's pretty much below an ADC count and negligible, and you can get an order of magnitude better by calibration. I'd say, do not measure the resistance of your shunt directly, but put a DMM in current mode in series with the battery and use that to calibrate the current.I don't like the dotted blue lines much. Just the big fat captions are clear enough, and the dotted lines add too much time for maintenance during modifications. It's really a bad idea.And there are indeed plenty of examples of stabilizing a circuit like this.Also:In KiCad V6 you can assign net classes to nets in the schematic. You can also change the color of wires and make them thicker, just by labeling them into a properly set up net class. That looks much better then your coax cables on the output. The setting is in:Schematic Editor / File / Schematic Setup / Project / Net ClassesIt's also a bit naughty to discharge your batteries to 2.5V. It's much easier for them if you don't go below 3.2V and it won't matter much for your measurement either.

author: cellularmitosis
author_rank: Unknown
timestamp: July 25, 2022, 06:47:37 am
content: Interesting to hear what's available in recent Kicad, I'm on the 2013 version and have no plans to upgradeThanks for the feedback about discharge level, I was curious what the standard discharge voltage is.

author: ledtester
author_rank: Super Contributor
timestamp: July 25, 2022, 09:59:12 am
content: Quote from: cellularmitosis on July 21, 2022, 06:18:05 pmSounds like you're using the default Arduino PWM frequency. Here's a blog post on how to increase it -- a faster PWM frequency should decrease the ripple.https://nerdytechy.com/how-to-change-the-pwm-frequency-of-arduino/