DIY circuit for measuring the voltage of individual cells in a pack. - Page 1
Forum section: electronics / projects

author: Refrigerator
author_rank: Super Contributor
timestamp: December 26, 2021, 08:50:24 pm
content: For a long time i wanted to make my own BMS. I want to be able to measure the voltage of each individual cell with a micro for some calculations and whatnot.It's for a personal project so there aren't any strict requirements other than i want it to be as cheap as possible (as i always do).Been exploring the possibilities in LTspice and came up with a promising(-ish) circuit.Basically it's a current controlled current source that uses the voltage of the cell as a reference.Add one of these for each cell and you get a way to multiplex cell voltages without needing SSR's or diff amps.Off-state current draw ends up being in the nano amps so it doesn't even burden the cells too much.I think there's still room for improvement in terms of accuracy.But i wonder what other ways there could be to do this.Perhaps it would be just better to choose a high accuracy ADC (16-bit and up?) and just use resistor voltage dividers to measure the cell voltage.But i would still have to multiplex the input to the ADC and it kinda snowballs.There's also the way of individual diff-amps for each cell but i don't really like that approach for some reason.I guess i just don't feel comfy using a diff amp to measure voltages right at it's supply rail.That and also the battery will be a 10S pack so finding diff amps (or opamps) that can handle such voltage is a bother as well.Anyways, what do you guys think of the circuit i came up with? The measured voltage is not constant because the NPN current rises with voltage.But i think swapping the collector resistor on the NPN transistor to the emitter would help make it more stable.This way the NPN transistor would use the voltage of the control signal (from microcontroller) as a reference and would create a current source of its own.And then it would be one current source activating another current source, which would be acting as a voltage to current converter, feeding current into a resistor, which then converts the current back into voltage.Edit: in the spice model voltage sources are the cells and the very first cell doesn't have a current source because it doesn't need it. I know it's messy but that's how it is when i'm in the heat of playing around in LTspicePs: in the second included pic the five pulses are the voltages of top five cells in a 6S pack.

author: Refrigerator
author_rank: Super Contributor
timestamp: December 26, 2021, 09:42:07 pm
content: Cleaned up my spice sim a little by placing the transistor mess into a sub assembly.This also lets me make changes easier because i no longer have to change every single one.After a few alterations i came to V3 of my "voltage to current converter".This one relies on diodes to set the current of the NPN transistor, which helps keep things more consistent across cells.Also without it the second cell from the bottom does not measure correctly so it was a necessary change anyways.Used the V3 circuit to measure a simulated 9S pack and the difference comes out at 31mV between top 8 cells, which is pretty good i think.The voltage difference across measured cells rises almost linearly and i think it can be calibrated out in code.Ps: the great thing about this circuit is that it is easily scalable, will always accept logic level input and can always produce a microcontroller friendly output. As the pack voltage goes higher only the transistors need to be changed for higher voltage ones appropriately.

author: Refrigerator
author_rank: Super Contributor
timestamp: December 27, 2021, 12:21:28 am
content: With SMD components the circuit comes out very tight even on a single sided board.Here's a test board i'll be making for a 4S pack.I've recently perfected toner transfer and can make PCB's with tracks down to ~0.3mm reliably (and probably 0.2mm as well), which is really nice.Here i used 0.4mm tracks, because there's no need to go any thinner.

author: pqass
author_rank: Super Contributor
timestamp: December 27, 2021, 07:24:20 pm
content: Thanks for the idea.I was thinking about how to monitor a 6S 8V lead-acid bank but came up with a much more complicated circuit.However, I've substituted an opto-coupler to turn on each module instead.See below.EDIT:I've now included an independently switched 2.5A load for each battery.http://www.falstad.com/circuit/circuitjs.html?ctz=CQAgjCAMB0l3BWcMBMcUHYMGZIA4UA2ATmIxAUgoqoQFMBaMMAKADcRsEUpPuQmYHlSoAWKsWhIRUKSwDuIUWEIgUKUXx7rNkBUpWdsqrj2zGoLAA4HVO20dUQRLAC5qEdjNs9qNvJjVRaDRiPEgEBG9CQjBIpAYYeAQ4sLBvBHDmcQgwOBAAEzoAMwBDAFcAG1cWACc1bz9NUybePPg6zjQGny9hZHg9RQYNKntR1r16kfEKIQEJzxlzPQ4W5jN+GTEqDCleETkbZRMLE6VRPHAD-RbRS4d7q71sDCoZsQePuZ5nS3rsN1sHhNChfMDdAMOvVMGYLC1zKoqO04G4PCYQejHAFcoRoG9iDFCMYwsT-IlYHBCJEwcQUngEMo8NgyANCiUKtV9N9EUEqLy9O4wapRISsU8cSA9qFwt4MuJXgkkogwPd6aI3qIEMRIBq2UUylUagDuqK7L4zW1BkMtBRCGJDEtLMdDBLzk6-noAOa2p0tKJIyxrfj2dbzGSzSTSA5yGGNCV3B7IwbciYStNJ1OzXnfCV6Y7hAQbJSFj03RTu+0l2hVm3few8iz5ovEHgpHhMV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t2vAyiVB4XQFg6UsLFmkXRHY1BephTYVKCwedMHcJuDYPAS9izaM0GKNy-UdHzDwT-SiRj9GqFMdbdC9RMFUEwRA7OLBiiJS6iogB2gjzQEICwAAHuAcwdprw40SukJQagqAAAUAByUSAA6ABHAAslEgAygAQVbPE+JAA7AA8lEgAKvkpJySADCRTCA5NyQAIQyUUopSS8AADV4k8MqHQUoBQGClAAMYAEsCgABp2lgHCBkgAFv4xKxJAmaGsRTcgEcQAxIAGIAFEmmJIAJKpQADKpTrqIGZmRjKqk0FAhIqoICgk0Bshg+z8kZIACIzMIHgbKqpyAgi+UtTQhgAAUAB7XJdB2kAFtgUFCqOCnhPDJnAvkLkgAlDM1UjcmDKE4BgL5wIIn+HqY0jZqUACa7Tkn5JiTskpqV0VcFmRADutkPnLMiSADJrhXD9MmWMhAGT2l9MmaUWoXo6C1Haf02owL4XtLoLk1wAzahwp4dyvpABrdprhJnyshaCgZrhgUSvETy9pAAjUoXLxUAE9oA1J2cUSVuTrXmsta4G17SBk8PacCtg4r2kkIQC00ZPDyjiPaQ8p5rytXAvNeUWouS5V+L6XQeF0AWD4qoGsv4wVrb7ECC04F1RShiozVcRu2beC5ptgWot3LS34vUCASthskA1ogIW4tDaIJIBbVKfY7aQCdvrRI-Fnzm05oHfmjtdaS2jquHgcgfbq3TqHbO7t+5e2Trbau4dc6WBAA

author: SuzyC
author_rank: Frequent Contributor
timestamp: December 27, 2021, 10:29:23 pm
content: Monitoring the voltage of each cell of a battery pack is very easy using the A/D inputs with a cheap MCU, just connecting each cell's terminals to a voltage divider at the MCU A/D input pin(and if the circuit is permanently part of the battery pack then do use an opto-isolator that is turned on and connects the voltage divider top resistor at the MCU when a measurement is wanted.)Easy to find a cheap PIC/AVR 28-pin MCU that has enough or more 10-12 bit A/D inputs pins. Measuring the battery voltage is then simple, subtract the bottom of a cell's voltage meas. from the top. You don't need all those extra transistors and resistors, just one resistor and one opto per battery terminal except only one opto for the bottom-most cell in the pack.

author: pqass
author_rank: Super Contributor
timestamp: December 27, 2021, 11:58:58 pm
content: Quote from: SuzyC on December 27, 2021, 10:29:23 pmPer cell, we're only interested in the voltages between approx. 7.7V and 8.5V (a delta of 0.8V, after resting) as that is the 0..full range of an 8V cell. For a Lion cell, it's between approx. 3V and 4.2V (a delta of 1.2V).We don't really care about anything outside that range so we'd like to concentrate all 10bits of ADC space in that delta. If we just subtracted previous cell voltage from next cell voltage, we'd need much more ADC bits to get the same level of detail in the ranges we're interested in.Besides, you'd need a unique ratio for each cell's divider to map into the Vref space of your ADC.

author: Refrigerator
author_rank: Super Contributor
timestamp: December 28, 2021, 12:59:04 am
content: Quote from: pqass on December 27, 2021, 07:24:20 pmI played around with optos a little but i don't like that it takes at least 1mA to activate it.But the thing i didn't like the most is that there's a certain saturation voltage in the BJT and it's not strictly defined.Also they cost much more and take alot more space on the board than regular BJT's.And there's no point in their isolation voltage because the PNP current source transistor needs to be able to handle the voltage of the entire pack regardless.I tuned my circuit a little and can get the on state current draw below 60µA.It's very close to 50µA so with a little tuning i think it could be lowered even more.I'm very focused on keeping the current draw low to not burden the cells because i want to not only balance them but also measure during their operation.When charging the charging current is orders of magnitude larger than the current draw of the balancing circuit so the current drawn by the balancing circuit doesn't matter.But my circuit will be feeding off the battery when it's not charging so i don't want it to drain the pack too quickly.Currently the circuit consumes about 2.6µA on average when measuring for1ms500µs at 10ms period, which would take 96 years to discharge a 2.2Ah lithium cell.There will be microcontrollers and other stuff on top also but it's nice to have one less thing burdening the pack.

author: pqass
author_rank: Super Contributor
timestamp: December 28, 2021, 03:05:40 am
content: Refrigerator,I was just thinking about lowering the BOM quantity; not power consumption or costs. Your choices are understandable.Also, instead of one central BMS board, I was thinking in my case, each cell (8V battery) would have their own module. Then a couple of wire pairs from each would be star terminated on a central controller a couple of meters away at most. System controller power source would be the first battery. At 180Ah, there's no danger of draining it.See below for a prelimiary schematic.

author: not1xor1
author_rank: Frequent Contributor
timestamp: December 28, 2021, 08:15:07 am
content: Quote from: Refrigerator on December 26, 2021, 08:50:24 pmI think the accuracy of your circuit (including temperature drift) is likely much less of that of a microcontroller with multiple ADC inputs... so just use precision (i.e. low temperature drift) resistors dividers, calibrate and compute the voltage differences

author: Refrigerator
author_rank: Super Contributor
timestamp: December 28, 2021, 11:47:50 am
content: Quote from: not1xor1 on December 28, 2021, 08:15:07 amJust out of curiosity i simulated a -10oC to 40oC sweep and got a voltage drift of about 1.2% in the entire sweep.The circuit is kind of self temperature compensating to some degree.As the diode at B- heats up its voltage drops and reference current drops.As the PNP transistor heats up its voltage drops and the reference current increases.So the two balance out but not perfectly.I might try substituting the diode at B- for a BJT that's used as a diode.

author: Refrigerator
author_rank: Super Contributor
timestamp: December 28, 2021, 12:24:11 pm
content: Replaced the diode on B- with a BJT connected as a diode and got the V4 of the voltage converter circuit.Now between -10oC and 40oC the output current only changes by 0.32-0.31%, which i think is a great improvement.Also the chosen temperature range is completely arbitrary, i sort of estimated what temperature the lithium pack might be subjected to in an outdoor environment.

author: Refrigerator
author_rank: Super Contributor
timestamp: December 28, 2021, 12:51:11 pm
content: Oops i used a 2N3904 (instead of BC546) as the diode out of habit.This is only relevant for keeping the BOM lower, otherwise any BJT can be used because the BJT diode will only ever see a voltage as large as the cell it's connected to.Substituting the 2N3904 with a BC546 increased the temperature drift to 0.45% over the -10oC to 40oC range.Also now that the voltage drop on the BJT diode matches the VBEon the PNP transistor almost perfectly the output voltage of the circuit is only dependent on the emitter resistor on the PNP BJT and the output resistor on the collector.And it's a direct ratio: VCELL*(Rcollector/Remitter) = Vout

author: Refrigerator
author_rank: Super Contributor
timestamp: December 28, 2021, 01:03:16 pm
content: Here's a quick drawing to illustrate what i'm talking about.

author: strawberry
author_rank: Super Contributor
timestamp: December 29, 2021, 04:57:20 am
content: better

author: Refrigerator
author_rank: Super Contributor
timestamp: December 31, 2021, 08:01:30 pm
content: Built the V3 circuit on a PCB and it works very well.Was a bit of trouble getting it to work at first mainly due to human error.For example i mistakenly soldered NPN transistors for both current sources, but replacing them with PNP's was easy enough.Also forgot i left the boards in the etchant and they over-etched and some tracks had breaks in them.But none of that had anything to do with my circuit design.After fixing the little bugs everything works perfectly fine.Some differences between cells show up but that might be down to my el-cheapo resistors.But the divider ratios all come in within 0,5% of each other on a 4S pack.With Rref= 100k and Rout= 47k, i get a division ratio of around 0.4604.Which is ok considering that this is the V3, which doesn't have the benefit of the BJT diode.Breathing hot air onto the circuit only changes the output by ~1mV.So i count this as a great success.I do have a bunch of BC557/547 transistors, which can handle up to 60V so i might use them for my 10S pack.Unfortunately they're in the TO-92 package, which is very bulky compared to SOT-23.

author: Shock
author_rank: Super Contributor
timestamp: December 31, 2021, 08:26:30 pm
content: Seen the SKYRC IMAX B6? I've got the B6AC V2 (has an AC brick in it and an updated version) the original version I think had community made open source firmware. Aside from it not be an overtly complicated circuit it's feature packed. Balanced charging and discharging, series charging, cycling, many supported cell types. It's been reported to get about 0.01mV accuracy on voltage sensing which is quite good, just got to use lower tolerance resistors than SKYRC put in. The shipped firmware for the B6AC V2 has a PC software interface as well which has a lot more potential than they have utilized.Not sure if this is the genuine one but this is whats inside. I think Dave did a video a while back as well.

author: Refrigerator
author_rank: Super Contributor
timestamp: January 01, 2022, 12:14:59 am
content: Quote from: Shock on December 31, 2021, 08:26:30 pmLooks like i forgot to mention the B6 in my first post.B6 uses four separate diff amps for the top four cells but i can't do that on a 10-cell pack because the voltage is too high.Here i found theschematic.But i think the circuit i came up with is pretty good, especially since i can scale it up as high as my transistors will allow.The 4S circuit i made can be scaled up to 10S by just choosing higher voltage transistors.And as far as i'm aware nobody else has come up with this yet(?).But i can be wrong like i've been with my three transistor buck converter, which i've upgraded and turned into a two transistor buck converter with more than 90% efficiency.I see alot of promise for this circuit and i also like that it can be used to multiplex or break out every cell individually.PS: and most importantly it consists of only the most basic and easy to get components.

author: Shock
author_rank: Super Contributor
timestamp: January 01, 2022, 03:14:11 am
content: Was sort of saying it's probably the circuit to beat/improve on. Those enclosures would be cheap and easily sourced as well to put an improved design in.Are you intending to trickle balance cells? I've not used the B6AC V2 on a balanced pack yet, but unless I'm mistaken there is no NiMH balanced charging. It seems to support 1-6 Li-ion/Lipo, I read they balance by loading the high cells down.Multiple balanced NiMH would be nice, perhaps it's a charging termination issue or they didn't foresee utility of it.

author: doktor pyta
author_rank: Frequent Contributor
timestamp: January 01, 2022, 10:59:27 am
content: Interesting thread.Thanks, Refrigerator.

author: Refrigerator
author_rank: Super Contributor
timestamp: January 01, 2022, 12:17:37 pm
content: Quote from: Shock on January 01, 2022, 03:14:11 amThe plan is to build a BMS not a charger so the B6 upgrade/mod path isn't very enticing.My plan at first was to just use resistive loads on each cell and connect the load when a cell is high with either a FET or an optocoupler, to balance the cells.But right now i'm playing around with my own version of active cell balancing, because i don't like resistive cell balancing that much.