Battery Tester - Page 1
Forum section: electronics / projects

author: ColdKeyboard
author_rank: Contributor
timestamp: November 12, 2018, 03:47:51 am
content: Hey everyone, I'm working on a project where I would like to build a piece of a "equipment" that I can use to test Lithium Ion/LiPo batteries.Testing would be basically loading the battery with constant current (maybe vary it over time) and log how does the battery voltage change over time.Also as an auxiliary feature, it could be used to test battery charging circuits (use the constant current to act as a load on USB battery charger).And the third feature would be a built in battery charger, so you can discharge the battery through the board, then charge it and log the curves.Components that I have in mind are; 2.048V voltage reference, 12bit DAC, MCU with 12bit ADC and Op amp + passives and mosfets.Here is the list of components I'm thinking about using (have them laying around):STM32F103MCP1501T-20E 2.048V voltage referenceMCP4726A1T 12bit DACTLV4376I Quad op amp(?) N-MOSFET for load(?) Battery charger(?) Sense resistor(s)What I have in mind for now is to have a micro (currently thinking about STM32F103) that would control a DAC to set the voltage on the input of theop amp that is driving the N-MOSFET (load). DAC would have external vref from 2.048V FVR IC to improve it's accuracy. Microcontroller will also use it's 12bit SAR ADCto measure battery voltage (through voltage-divider + op-amp as buffer) as well as to measure voltage on sense resistor (load) plus voltage on second sense resistor (battery charger).Idea is to have MCU hooked up to your PC (or maybe chose a preset through PC) and control what is the load current, maybe even vary it over time to emulate more realistic load and logwhat is the battery voltage, current drawn. When the battery gets depleted, MCU will kick off a charging cycle where we measure charge current and battery voltage.This would be initially fed back to PC over UART but maybe I could even add a SD card so it gets logged. Also RTC can be leveraged to offer timestamps for various events.Now this is something that I'm designing for myself, since often I have a need for a device like this that I can tune through PC (set profile) or change few passives to modify the operating range.I would really love to hear your opinion on; would this be useful to anyone else other than me, what other features of this device would be nice additions and etc.Also if you have suggestions/examples for parts of the circuit (constant current load, conditioning sense resistor voltage reading for ADC, and so on)Thanks in advance!

author: ColdKeyboard
author_rank: Contributor
timestamp: November 21, 2018, 04:47:50 am
content: Okay, maybe it would be easier if I asked one thing at a time...If I wanted to do A-2-D conversion of voltage across a sense resistor, would MCU's ADC be good enough choice or should I go forstand alone ADC to have better accuracy, signal to noise ratio and etc.?Currents that I plan to measure are from few uA up to 300-500mA (at max), so what value of Rsesne would you recommend and what configuration of op-ampsand ADC would give best results?

author: thm_w
author_rank: Super Contributor
timestamp: November 21, 2018, 11:20:10 pm
content: Quote from: ColdKeyboard on November 21, 2018, 04:47:50 am2uA to 500mA, that is one in 250,000. The STM32 12-bit ADC would only be capable of 4,096 steps of resolution.So either need to change your spec to have less resolution, have different shunts/current ranges, or use an external 18-bit+ ADC. Some of the microchip ADCs are nice, but slow sample rates.Personally I am using "LiitoKala lii-500" type charger to determine capacity of 18650 cells. But it offers no PC control or any advanced features you suggest.ideas:https://www.eevblog.com/forum/repair/part-identification-150w-constant-current-electronic-load-60v-10a/https://www.eevblog.com/forum/projects/diy-electronic-load-project-thread-d/https://hackaday.io/project/1912-smart-battery-testerhttps://hackaday.io/project/162343-variable-load-for-constant-currentpower-discharge

author: ColdKeyboard
author_rank: Contributor
timestamp: November 24, 2018, 11:05:07 pm
content: Wow, that's really exhaustive review or LiitoKala. Awesome job!So if I wanted to measure these ranges, would dynamically switching the sense resistor work?For example if I have three sense resistors in series, 1K, 100R and 1R, I could short 1K and 100R if I'm measuring higher currentsand use 1K for low current and so on. Would this work? Does anyone have a suggestion on how to build the circuit so that the switch'sresistance doesn't affect the reading too much?Also would there be any significant benefit from using a dedicated ADC vs. using the one that is built in the MCU?Which one would give me the best accuracy?

author: spec
author_rank: Frequent Contributor
timestamp: November 25, 2018, 04:15:13 pm
content: Hi ColdKeyboard,What fun- can you build two and let me have one.Just been looking at your requirement and would like to ask a few questions:Will you want to fit just one LiIon/LiPo battery at a time?How do these full scale ranges, for charging and discharging, grab you: 100uA, 1mA, 10mA,100mA, 1A? Taking the 1A range as an example, a 12 bit ADC would have a resolution of 200uA.Just to clarify, would you be happy sourcing and programming a 3V6 MCU with a 12 bit ADC?.Can I assume an ADC input range of 0V to 3V6?

author: Audioguru
author_rank: Super Contributor
timestamp: November 25, 2018, 04:43:17 pm
content: Why do you want to see the voltage dropping on a charged Li-Po battery that has a load? The datasheet shows it andwww.batteryuniversity.comalso shows it.As the battery "wears out" the voltage drops quicker when loaded and the maximum current will be less.It is obvious when my Li-PO batteries are wearing out and when they do not produce enough power or cannot be used for a long enough time per charge.

author: spec
author_rank: Frequent Contributor
timestamp: November 25, 2018, 05:12:30 pm
content: Your comments could apply to any test.The OP wants to measure the characteristics of his individual battery, which seems very reasonable to me.Do you have a circuit for the OP like he asked?

author: mark03
author_rank: Frequent Contributor
timestamp: November 25, 2018, 05:34:29 pm
content: A key insight re: the ADC might be, that although you want to measure currents as low as a couple of uA, you don't need uA resolution when measuring in the hundreds of mA. In other words, 12 bits may be entirely adequate; you just need to use a logarithmic function in the analog domain. This could keep your costs and complexity down. Of course, you will need to plan for calibration and storing a look-up table, but that is probably a good idea anyway.I'm a big fan of exploiting the STM32 ADCs to their full potential, but do be aware that the "effective number of bits" (ENOB), after accounting for noise and other defects, will be somewhere between 10 and 11. This is on the STM32L4 series which I am more familiar with. You can look it up under "ADC characteristics" in the datasheet for your part. Usually the ADC has built-in support for very crude oversampling (filter with an N-point boxcar -> sinc response, then decimate by N). As a rough estimate, you get one extra bit for every factor of four oversampling. This helps noise but not other issues like nonlinearity, so for DC measurement applications like yours one must be careful not to rely on it as a panacea.

author: ColdKeyboard
author_rank: Contributor
timestamp: November 25, 2018, 06:28:23 pm
content: Quote from: spec on November 25, 2018, 04:15:13 pmThe plan is to make it, and same as with every other project I've done (for myself) make it open-source and open-hardware. So technically everyone will get one.Yes, I would like to just test one battery at a time.For charging and discharging, even 50uA to 500mA would be enough I guess. Reason for having such wide range is to make this tool useful in more than one case;Basically by having a wide range from very low current to a reasonably high current, you can test how your battery would behave and how much juice you can get out of itby emulating different states.Also I plan on adding a charging circuit, so you can charge&discharge your battery, get the V-I curve for different ranges. One additional cool feature that I want to givea try is connecting your outside load to the battery, and this tool would "record" how does your load behave over time and then you can store it in a profile and laterhave it playback that profile to the battery under test. Basically have this tool emulate the load and keep repeating through cycles...For the MCU, I would really like to use one of the STM32's or some similar micro that open-source community has already grabbed onto.For example a very popular STM32F103 is dirt cheap (look for BluePil dev board), even the Nucleo board is dirt cheap, programmer clones are cheap... and it's a reallygood MCU.Quote from: mark03 on November 25, 2018, 05:34:29 pmYou've hit the nail on the head! Maybe logarithmic scale with lookup tables is overkill (?) but how about having a circuit that would add/remove sense resistorsfrom the current sense path? Like analog switch that shorts or opens certain sense resistor in the string of sense resistors. Would you recommend going for an IC ormake it with discrete components?I assume some multimeters use some kind of switching circuit to measure a value, if it's OL then switch to higher range...To be honest I've found several IC's and by reading their specs you get to that "This should work... right?" point and since I know you guys herecome from all kinds of different backgrounds, built and worked on all kinds of projects; That's why I'm asking you for recommendations on best practices,how to avoid some pitfalls that are not that obvious and how to do component selection (basically looking for feedback "I've used this IC and it's great for whatyou are looking for or don't go for this IC, it looks great on paper but it's garbage")Also thank you all for taking the time!

author: electrodacus
author_rank: Super Contributor
timestamp: November 26, 2018, 08:41:54 am
content: You can check my SBMS (open source) as a starting point for what you want. It is based on STM32F373 and so it has 16bit ADC with differential inputs.Here is the link touser manualand links for HW and SW files are on last page.If you want the low cost SBMS0 you can get one trough my lastKickstarter

author: thm_w
author_rank: Super Contributor
timestamp: November 26, 2018, 11:05:40 pm
content: Quote from: ColdKeyboard on November 24, 2018, 11:05:07 pmUser Lygte on this forum, not me, I wouldn't have the patience.Yes thats right about switching resistance. You could calibrate out the switch resistance, or measure it roughly and have software compensate. I think Dave had a video about the 121GW low burden circuit, can't seem to find it at the moment.Dedicated ADC will give you better accuracy, at the cost of space, complexity, $, etc.

author: spec
author_rank: Frequent Contributor
timestamp: November 27, 2018, 03:18:57 pm
content: Attached is a concept schematic for a battery tester, intended to meet your stated requirements.It provides both battery charging and and discharging and monitoring of the battery under test (BUT) terminal voltage and charge and discharge currents.There are five current ranges: 100uA,1mA, 10mA, 100mA, 1A. More current ranges can be added if requiredEvery circuit function is controlled by the MCU, so it would be good fun writing the firmware.