Li ion balancer idea - Page 1
Forum section: electronics / projects

author: ambrozy
author_rank: Contributor
timestamp: March 26, 2022, 05:37:54 pm
content: Does that idea make sense?1. for voltage measurement, optocouplers are driven by uc one by one with khz frequency square wave and voltage is measured by the uc on the secondary winding.2. for balancing optocouplers corresponding to higher voltage cells are turn on for longer time so resistors are drawing some current to slow down charging of a particular cell a little.The point is to make a measuring and balancing circuit that is very cheap for a large number of cells connected in series." alt="" class="bbc_img" />

author: pqass
author_rank: Super Contributor
timestamp: March 26, 2022, 06:23:41 pm
content: The diode bridge is likely too much to overcome for the tiny voltage generated in the secondary; consider a precision rectifier + peak detector as input conditioning to the MCU.Alternatively, have a look at this thread:https://www.eevblog.com/forum/projects/diy-bms-for-measuring-the-voltage-of-individual-cells-in-a-pack/msg3897641/#msg3897641It uses a current sink (or optocoupler; my take) to address an individual cell that then converts the cell voltage to a current onto a common bus. The current can be turned back into a voltage with a resistor at the MCU (which shares GND with the first cell). Another current sink (or optocoupler) can be used to turn on a local resistor on an addressed cell. Just high-voltage transistors, resistors, diodes or optos are needed.

author: Siwastaja
author_rank: Super Contributor
timestamp: March 26, 2022, 06:29:43 pm
content: Transformers and optoisolators? Very cheap?Look at any multi-cell balancer/BMS IC. They handle the level shifting by simple integrated active semiconductor circuitry. Low cost.

author: ambrozy
author_rank: Contributor
timestamp: March 26, 2022, 07:00:17 pm
content: Quote from: Siwastaja on March 26, 2022, 06:29:43 pmWhat would you suggest? It has to work with 15-60S batteries and can balance on any voltage not just 4.2v.This is for one-off projects, I will make transformers myself.I'm mainly asking if this idea makes sense from an electrical standpoint, I'm not at all an inductor expert so I'm not sure if something "weird" will happen here if I use the transformer this way.

author: pqass
author_rank: Super Contributor
timestamp: March 26, 2022, 07:25:33 pm
content: Quote from: ambrozy on March 26, 2022, 07:00:17 pmUse a simulator likehttp://www.falstad.com/circuit/circuitjs.htmlor LTSPICE to try out your ideas first.Or, bread-board a small piece of your circuit. eg. setup a function generator to pulse an opto with 100R, 10 wire loops on a toroid, and single cell in series. See what you get on your oscilloscope with 10, 100 loops on the secondary and which frequencies are best.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: March 26, 2022, 07:45:02 pm
content: Not really -- transformers aren't as ideal as we might like them to be.Also, the series connection is wrong, in that: if the transformerswereideal, no signal would be transmitted -- but this is easily cured by changing to a parallel arrangement, and then the sense sides can all be windings on a common core, no loss of inductance due to parallel wiring that way.The problems are:1. For a reasonable size transformer (say, a few to 10 mm across?), the core will be ferrite, and only useful at 10s, preferably 100s of kHz. So the sample rate is much too low for practical application.2a. Which has the knock-on effect: the optos are too slow. Typical PC817 etc. take >20us to turn off, and not much faster turning on. This can be sped up with a B-E resistor (when the base is pinned out, e.g. 4N35), but this greatly reduces CTR (current gain), exacerbating problem 3.2b. If not using min-cost transformers, then iron-core or even nanocrystalline cores can be used, with many more turns, and enough flux to yield a low sample rate, with regular optos. But as I've described -- these will not be especially cheap, unfortunately.3. Regardless of transformer type, the inductance is unavoidable. The effect is that, given an ideal switch at the primary, the current flow increases with time during the pulse. So the voltage drop across the resistance also increases, so the output voltage sags over time. You need to sample the voltage soon after switching -- but not so early that the level hasn't yet stabilized (initial risetime, and ringing if any).4. And with a non-ideal switch, the voltage drop is affected by its characteristics. Ideally the resistance is low, but a phototransistor will have an offset voltage Vce(sat) as well as appreciable resistance. (You also show external resistance, which works against this.) It also won't be able to handle much "on" current, another factor against long duration pulses.We might solve the resistance issue by calibrating for a known amount of droop -- it's a repeatable L/R time constant, so as long as L and R are known, and the time between turn-on and sampling is known, this can be resolved. (Preferably the time would be consistent so that calibration amounts to a fixed loss ratio per channel, and each channel has to be calibrated because in general there will be small differences in L and R between them.)Note I'm discussing in terms of sampling time; the most likely use case is an ADC reading the output, so the averaging filter shown would not be necessary. (You do suggest an MCU at least to drive the pulses, so this seems reasonable.) Now, the effect of the averaging filter, is to smear out the "sampling" over a spread of time, weighted according to the filter's impulse response (so, for a single RC, the weight goes as e^(-t/RC) for times before present). Which implies some independence in the timing of samples ("it's DC, just read DC!"), but misses the fact that such a signal includes ripple (the signal will unavoidably be bouncing up and down while the measurement is repeated) and, due to the weighting, includes errors due to risetime, droop, and fall time as well.Or maybe I've misread the intent with the output RC there; the ~1ms time constant and suggested ~kHz rate seems to imply more of an averaging effect. Maybe they're placeholder values, which might range from strong averaging at the high end (much larger R and C), to "taking the edge off" (say 1k + 1-10nF) to deal with ringing. The latter would likely be a fine addition for most realizations of this.Also, the FWB secondary will capture some flyback energy, which depends on inductance, primary voltage, and on time. This is probably best just dumped into a resistor or zener or whatever.Anyway, if the filter is changed to a peak detector, then the sample period is the crest just after turn-on, but may include some ringing, so you'd want to make sure the risetime is slower, or the impedance is matched, to achieve critical damping.Note that any rectifier at all, is bad news for signal purposes; we must then compensate for Vf, which depends on Ipk and temperature. Messy. Better to use a sampler to pick the value just after it stabilizes, and if we need an analog (DC) output, use a sample-and-hold circuit, or for an MCU just sample it with an ADC then and there. We can read the transformer secondary directly, just using like a series resistor and clamp to keep negative voltages away from our sensitive circuits (which also doubles as clamping for the transformer flyback).So that said, that's about as good as you can get with such a circuit:- Short pulses, with prompt sampling, to take advantage of cheapest, most compact possible transformers- Resistance and inductance will vary between channels (due to normal manufacturing variation); calibration must be done per channelNote that calibration is necessary, because we're talking more than 10 bits of accuracy here; presumably we want to know individual cells to single millivolts or so. Even 12 bits is kind of marginal (e.g. 1mV/LSB out of a 0-4.095V range), and more would be desirable. I think you'd have trouble getting better than 8, maybe 10 bits worth, without calibration. (Would be something to test though; maybe it turns out better than I think.)- I haven't included a solution for fast isolated switches, and I'm not sure that there's really a good solution here (low cost and complexity). Best case would be an IC, but I don't think such a thing exists.So I think that might be about as far as it goes, unfortunately. Which is to say -- it's a good idea, but not quite good enough to be commercially viable. Else they'd have already done it this way, eh?So we might keep thinking on it a bit. What if we transform inductors to capacitors? Parts can be cheaper, just ceramic chips say.Maybe we waive the isolation requirement, or do something a bit clever to reduce how much isolation is needed.Then we can use off-the-shelf muxes to select cell taps, and say, charge a capacitor between a given pair of taps, and then either shift that capacitor back down to ground (charge pump), or, dump it wholesale into a charge amplifier (integrator) to the same end.We can do sampling on the primary side, then use just a handful of isolators to communicate the state digitally -- we might need to add another MCU to the project, but that's much cheaper than a stack of optos and transformers. Now it's scalable to as many channels as we have in the mux, and isolation is simple and affordable -- maybe even off-the-shelf (e.g. one of those ISOxxxx digital isolators).Downsides include: leakage current in the mux bleeding away charge from the capacitor; dielectric absorption changing the capacitor's voltage between charge and sense; low current flow, which is a positive for sensing, but you could imagine also using a charge pump to actually deliver charge as well, and you wouldn't be able to do much this way, not without much larger capacitors, and muxes strong enough to handle it. Then again, some ~uA can still be enough to rebalance a pack over time, so maybe it would be useful that way too.Anyway, for topology, consider a stack of N-1 cells, so having N taps including GND. Wire two 1-of-N bidirectional (analog switch) muxes to the stack. The "flying capacitor" connects between the two mux commons. To charge it, set one mux to position n, and the other to n+1 (n = 0...N-1). To sense it, set one mux to position 0 (grounding the one side of the capacitor), and read the capacitor voltage.Probably best to read out the capacitor on an extra tap, so, the other mux should have a spare tap, and the stack would be N-2 cells for N-1 connections plus one sense tap, for 1-of-N muxes. Or, I can't quite think without drawing it out, if because of the offset, you get the free connection anyway. But yeah. Just a tap not wired to any cell, so that its voltage can be sensed.Then we can sample the capacitor voltage directly, and have a reading from anywhere along the stack, but sensed relative to GND. It's like climbing a ladder to pick a book from a tall library, then walking it back down to ground level to read it. Or, if you precharge it then put it back in place, you can deliver a small amount of charge -- hence why this can have application for actually doing the balancing itself, too.As for charge amplifier, that would be something like: an integrator circuit (so, op-amp with +IN = GND, -IN = input, with capacitor between OUT and -IN), with reset (analog switch across the capacitor, so it can be shorted to 0V before a measurement), and, when the mux connects to the input, it dumps the charge of the "flying" capacitor into the amp, which forces its input to 0V, in the process transferring that charge into the integration capacitor. Once the mux disconnects, the voltage sits there (moving only very slowly due to leakage current) and can be read at any time (even slow enough to use a DMM).With the charge amp, the circuit can be simplified even further: if just one mux is used, and the "flying" capacitor is just always wired common to the charge amp input -- then any step change in voltage at the mux side, causes a change in charge of the series capacitor, and thus a corresponding change at the output of the integrator. Simply set the mux to the highest tap (and now we can use the full N-1 cells with a 1-of-N mux), reset the integrator, then drop the mux to the next tap down. Charge flows out of the integrator, which is inverting, raising its output voltage. Sample. Repeat. Notice the series capacitor must be linear: type 2 (X7R etc.) ceramics are unsuitable here, but C0G ceramic and polypropylene film are well suited.Some protective elements are still missing (to limit inrush current through the series cap and mux; perhaps EMI filtering, in case the battery is in use while scanning it), but that would be the basic function of it. Note that analog switches must be supplied with at least as much voltage as they are switching; this is fine since not much current is required (mux is CMOS) and, well, the battery is right there.Tim

author: ambrozy
author_rank: Contributor
timestamp: March 26, 2022, 08:30:36 pm
content: Thanks a lot Tim! I'll respond in a moment

author: twospoons
author_rank: Frequent Contributor
timestamp: March 26, 2022, 09:10:20 pm
content: Not sure if you have checked TI's offerings, but they have Li-Ion monitor/balance/protection chips that will do up to 14S , and are stackable with some extra hardware. The chips cost between $2 and $8, depending on which you pick. Is going to be pretty hard to beat the price and functionality with a discrete solution.Linear Tech also have some interesting offerings. I built an active balancer with one of their chips - uses one transformer and two MOSFETs per cell, and lets you shuttle energy between cells instead of just dumping excess as heat. Their silicon is a bit more pricy though.

author: moffy
author_rank: Super Contributor
timestamp: March 26, 2022, 09:48:08 pm
content: As T3sl4co1l has mentioned pulse transformers are probably not the best device for this application. They are great where high isolation and fast driving is necessary, like driving IGBT's etc but not so much for lower frequencies, because that invariably increases the size of the core, as lower frequencies require a higher primary inductance. That means more turns, a higher Al(a measure of the inductance per n2) etc.A 50Hz transformer, for the same voltages and current ratings, will be much larger than the equivalent 100kHz transformer.Frequency with regard to a pulse transformer is measured in how long the pulse is applied rather than its repetition, as long as it has time to recover between pulses. Each pulse transformer has a constant V.us(Volts times micro seconds) before the core saturates.

author: ambrozy
author_rank: Contributor
timestamp: March 26, 2022, 09:53:45 pm
content: Quote from: T3sl4co1l on March 26, 2022, 07:45:02 pmAll those windings suppose to be on one core, its just drawn wrong here (I didn't have transformers with more than two windings in my drawing software)QuoteYes I would have to go with a little bigger transformer with more turns to make this work, I would like to aim for 20-30khz range but as you said optos are too slow.QuoteNeed for calibration per each channel is not a problem in my case.QuoteThis part is a placeholder, I didn't decided how exactly I will measure voltage on the secondary, it will be of course done by adc, your suggestions are very helpful!QuoteWon't this resistor divider behind the bridge rerctifier handle it?QuoteI see that design of that measurement part is not exactly straightforward, but also I don't need absolute measurements, relative differences between each cell are enough because I can just measure voltage of the whole battery pack and infeer absolute values for each cell from that.QuoteThat's true, I need quite high resolution for that.I was thinking of different designs for example whole MCU switched by "something" between cells so that it is powered by cell which is currently measuring and digital data is transfered through some isolation to the another "grounded" MCU.One feature that is important to me is that the balancer can be permanently connected to the battery, but at the same time it can be easily turned off so that it is not drawing any power from the battery, also as I said earlier has to be able to handle packs of let say 60 cells in series ~250v.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: March 27, 2022, 12:35:12 am
content: Quote from: ambrozy on March 26, 2022, 09:53:45 pmOh right, there is a note to that effect. Nice!QuoteA separate path I should say; although, it's also well correlated to the input, so probably doesn't matter after calibration.QuoteDifferences would be nice; a little amplification and you need far fewer bits.Using the charge amp mechanism, you could have two muxes and sense caps, going to a common charge amp; to take the difference, switch one mux to tap n and the other to n+2, zero the charge, then switch them both to n+1. I don't think you can do it with a single mux. Note that the caps need to be very well matched in this case, which is, uh... not a good prospect, unfortunately! And with just the one measurement, you can't calibrate them separately.So, for this case I think you'd be better with a good old fashioned mux and voltage divider. Use nice tight resistors and just do whatever differential arrangement you like.>=12 bit ADCs aren't hard to come by so it might go either way. That is, doing it with one mux and good precision, versus two muxes and even tighter precision in the dividers but less needed in the ADC.QuoteWould be amusing to have it climb the pack itself... two muxes (might have to be DC SSRs at this point?) and don't you ever let them turn off at the same time, or go to the same slot, or slots too far away...Tim

author: ambrozy
author_rank: Contributor
timestamp: March 28, 2022, 09:24:27 pm
content: I added a transistor "power stage" so I can sink more current and have more consisten behavior overall probably than with optocoupler alone. Now measurement works by sending one impulse and measuring peak of that on the secondary, I did some simulations in ltspice and I see that it is very sensitive to impulse rise time, maybe I should add RC filter before transistor base to make it a little slower but also more consistent, or RC filter before the first opamp will do the trick?

author: ambrozy
author_rank: Contributor
timestamp: March 28, 2022, 09:30:49 pm
content: Quote from: pqass on March 26, 2022, 06:23:41 pmI like that circuit, should be way easier to make it work reliably that my idea, but it can't sink current from the cells by itself so in the end complexity is much higher for large number of cells and then you also need high voltage transistors for it.

author: pqass
author_rank: Super Contributor
timestamp: March 28, 2022, 09:58:52 pm
content: Quote from: ambrozy on March 28, 2022, 09:30:49 pmThe thing with transformers that I'm not sure of (until I test it for myself) is how linear it would be to transmit 10mV level differences in cell voltage levels (given excitation frequency variation).If you see my message (reply #3) with the falstad simulation, it's just 2 resistors, a transistor, and an opto (with its own resistor) for each cell. It just needs to be turned on briefly; enough for the current bus to settle (maybe 1ms). So monitoring every cell once per second won't consume much of a cell's capacity. The complaint by others in the thread was that the opto is too slow and expensive. So instead of the opto, you can enable voltage-to-current transistor (at the cell) via the current sink (transistor, 2 diodes, 2 resistors) (reply #1) which is more parts, but overall cheaper. Checking digikey.ca I found MSB92T1G which is 22cents in qty10 for 300Vce. There is even a 500Vce transistor but at 56cents. You can stack a lot of cells to make 500V.Also, power for the monitor circuit doesn't have to come from the first cell. The monitor can have its own power source; it just has to share the same GND as the first cell.You can simplify the sink by replacing the 2 diodes with a single jellybean transistor (see below).

author: T3sl4co1l
author_rank: Super Contributor
timestamp: March 28, 2022, 11:06:52 pm
content: Quote from: ambrozy on March 28, 2022, 09:24:27 pmMaybe. Note that turn-off hasn't been improved, it's slower if anything: a B-E resistor is needed to discharge the junction, otherwise it keeps on drooling for an electronic eternity (~20us; about like the phototransistor, matter of fact, wonder why that might be).Exact waveshape depends on transformer parameters as well as transistors and drive current; you need to enter something representative there. Note that a nonideal model (or coupled inductors) ignores stray capacitance (or higher order / transmission line effects), and may have unrealistic values (especially if you just set k=1).Consider the 2nd order transformer model:(LL can be converted to k: k = sqrt(1 - LL/Lp). Depending, you might lump the series elements together (rather than either side of the transformer), or use an ideal transformer and specify its magnetizing inductance with an explicit Lp or Ls. Note this formula uses the primary-referred leakage, i.e. secondary shorted.)With this model in mind, and perhaps some external capacitance or inductance to tweak the waveform, you can get well a damped response. Specifically, what you're adjusting is Rs and/or RL with respect to the characteristic impedance of the transformer (sqrt(LL/Cp) or thereabouts).You'd likely not use a TL072 in a real BMS, but as long as it's wired properly in the sim, that's fine. (Note that there's a 3- and 5-pin model, the former being an ideal (linear) version that will happily generate kV at its output if wired incorrectly. The latter models supply voltage limits and clipping (nonlinearity), and needs to be powered accordingly. +/-12V supplies being typical for this type.)I think the cheapest transformer you'd find is a one of those common-mode chokes for data line use; a little SMT brick type, like a ferrite bead but with many more turns and four terminals. These have low isolation voltage, under 100V, so won't be safe for just anything. But you won't find anything cheaper. Next step up is a limited variety of pulse transformers for a buck or more each. Let alone doing it by hand, it'll take some minutes per winding, plus tinning the wires, using fixtures if applicable, etc...Tim

author: ambrozy
author_rank: Contributor
timestamp: March 29, 2022, 01:11:57 am
content: I don't really care about slow turnoff, measurements will be taken during the pulse and pulses will not be more frequent than every 500us. I'm somewhat aware that transformers are usually far from ideal model, I used ideal transformer in my simulations because I don't have any specific transformer in mind right now and speaking of transformers, I don't know much about core materials, I have some toroidal cores (painted yellow, metallic under the paint) from atx psus laying around, would they be suitable for a quick and dirty (like my ideas) prototype?There is a problem with supplying opamps, ideally I would like to power it from 0 - 5v like mcu but standard opamps will not work like that, but speaking of not to use tl072 you also have something else in mind? because I have those laying around alsoOf course I would power them properly for the prototype.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: March 29, 2022, 03:07:59 am
content: What, TLV2372 isn't standard?Or maybe more like MCP6V76 since it's precision. Or a zillion OPAxxx. Lots of good choices for low voltage RRIO amps.You still want the B-E resistor to reduce leakage. The opto isn't particularly low (dark current) to begin with. Basically you're making a Darlington between internal leakage/dark photocurrent, the phototransistor and the external one. Turn up the temp just a little bit and you can be sinking whole mA easily, and then it runs away and catches fire... Well, probably not catching fire with the modest value load resistor in there still, but yeah, it's not going to be balancing in the direction you wanted it to.Yellow/white (#26 powdered iron) is wholly unsuitable, yeah. But you're not far off: the EMI filter cores do make good pulse transformers. Common mode chokes don't make great pulse transformers as-is, as the leakage inductance is rather high in the side-by-side winding arrangement -- instead, use twisted pair. Though, since you don't need much bandwidth here, maybe you'd use them verbatim anyway?The data line type CMC, of adequate value (100s uH to ~mH), is commonly used with CAN transceivers; I suppose if you're not in the habit of tearing down automotive modules, you wouldn't have many of these, though. You see similar parts in USB devices too, but they're much too small (~uH).Or uh, Ethernet transformers are in ample supply, but they're too small for this (signal levels of ~1V and 100s kHz).Tim

author: uer166
author_rank: Super Contributor
timestamp: March 29, 2022, 04:53:56 am
content: Very cool idea, this makes me think that a nano crystalline toroid might work pretty okay here. You can make the single secondary TEX-E while all primaries are wound on top of each other.I'm not sure if you'd want to go beyond 6 windings or so though. The number of digital isolated channels you'd need for this is equal to # of cells though, which is not a very good use of it.If you want to keep the transformer theme going, why don't you trigger some FETs on the stack side with pulse transformers? So you'd have one big multi-winding job for the analog data, and a whole bunch of small 1:1 trigger pulse transformers.While cool, I am certain that this solution would be more expensive than off the shelf stack monitors, but hey it's fun and you can multi-source all the parts.Don't forget the flyback clamps as Tim said, any transformer has leakage and the energy has to go somewhere.

author: DavidAlfa
author_rank: Super Contributor
timestamp: March 29, 2022, 05:26:39 pm
content: What about using general optocouplers in active region?This picture is from an audio amplifier, but the idea is the same.

author: ambrozy
author_rank: Contributor
timestamp: March 29, 2022, 05:32:09 pm
content: I found this core, have no idea of its origin, it has sharp edges not ideal for enameled wire, AL value around 1700nH

author: ambrozy
author_rank: Contributor
timestamp: March 29, 2022, 05:45:30 pm
content: Quote from: DavidAlfa on March 29, 2022, 05:26:39 pmYou mean to transfer analog voltage back? current transfer ratio of standard optocoupler is not linear and not stable in any respect as far as I know. There are "linear" optocouplers with two matched photodiodes instead of phototransistor and they work by controlling its led by feedback from one of photodiodes, so they need some opamp on the "primary" side and are veery expenive as far as I know.

author: mikerj
author_rank: Super Contributor
timestamp: March 29, 2022, 05:45:54 pm
content: Quote from: DavidAlfa on March 29, 2022, 05:26:39 pmThe current transfer ratio of regular optocouplers is non-linear, often has part to part variation and typically degrades over life. Special optos with two photodiodes are available (e.g. IL300) which allows you to use one for negative feedback to linearise the transfer function and compensate for aging.

author: DavidAlfa
author_rank: Super Contributor
timestamp: March 29, 2022, 06:06:04 pm
content: Didn't knew about the aging. Yes, I know they arent very linear, but you might adjust the gain to get the most in the range you're interesed in.This is a simulation, although not perfect, has a decent linearity between 3-4.2V. (Yellow=input, blue=output)I don't think you get matching characteristics in these normal optocouplers, so it might a nightmare to calibrate 60 of them!