Jump to content

Cheap LiFePO4 BMS?


jetzi

Featured Posts

6 minutes ago, Tony1 said:

 

I've previously misunderstood the way fuelling works on these narrowboat engines. 

My understanding was that the amount of fuel used depends entirely on the position of the throttle.

So at idle, I had thought it always had the same amount of fuel to consume, regardless of what the alternator was trying to do. 

 

If you run the engine at idle, it might run at 800 rpm. If you then "start" your DC/DC charger such that your lithiums start to draw power, you will find that the revs drop.

 

When moving, this means that you need "more throttle" in order to maintain a particular speed.

 

and so on.

Link to comment
Share on other sites

Just now, MtB said:

 

No. It's much more sophisicated than that. The "throttle" (a misnomer - it isn't a throttle) is actually an "engine speed selector". There is a mechanical governor which increases the fuel injected if the engine is running slower than selected on the speed control, and vice versa.

 

So it you load the engine with an alternator, it slow down and more fuel gets injected to compensate.

 

 

 

Thanks MTB, I get the idea now

 

 

Link to comment
Share on other sites

Just now, Tony1 said:

 

Thanks MTB, I get the idea now

 

Old skool petrol engines have a throttle, as by changing the airflow, the amount of fuel sucked in using the Venturi effect changes too. On a diesel there is no throttle, a full cylinder of air gets sucked in on every induction stroke, and the amount of fuel injected is varied by the injection pump instead. 

 

It has to be this way or there would not be enough air in the cyl to compress to get up to ignition temp. The petrol engine ignites with a spark plug! 

Link to comment
Share on other sites

33 minutes ago, Richard10002 said:

 

If you run the engine at idle, it might run at 800 rpm. If you then "start" your DC/DC charger such that your lithiums start to draw power, you will find that the revs drop.

 

When moving, this means that you need "more throttle" in order to maintain a particular speed.

 

and so on.

The revs drop but the fuel flow increases, even before you move the throttle. Because it’s a governor, not a fuel flow selector.

Link to comment
Share on other sites

4 hours ago, Richard10002 said:

 

I have the Valences and it also grates me when the "monitoring system", is described as a "management system".

 

Connect a bank to a laptop with the software, you can "monitor" everything to your hearts content, but there is no "management" going on.

 

In my experience, (backed up by the T6 forum), to use the balancing facility, a battery/bank needs to be connected to a computer with the software, and the computer must be on and awake.

 

The few times I have tried this for a few hours, the actual balancing that takes place is minimal. Maybe it would be effective if you could do it for several days. Peter says that he balanced his when he got them, and I think he has mentioned days, rather than hours. I'm not sure whether he has spoken about the need to have the computer on and awake.

 

With the valences, we are pretty much stuck with management at the battery level, and not at the cell level. A hands on approach is pretty much necessary when charging reaches a bit above the knee. If I am charging to 100%, I watch the software quite closely when the cells are approaching 3.6V/3.65V.

 

Having said that, 100% is only necessary when wanting to reset the monitor, (BMV712S in my case). Other than that, I tend to use between 80/90% and 20%.

I did balance them over a few days Richard,  but in reality when I connected the puter they were well balanced, so the last bit was just to get the batteries to register 100% soc. On an individual basis 

Link to comment
Share on other sites

I've drawn out a diagram of my plan for the Arduino-based BMS to try to identify the bits I still need to obtain. I have most of it lying around already from little experiments, going to order the other bits now.

 

The MOSFETs I've settled on are these: https://uk.rs-online.com/web/p/mosfets/6887175

They turn on at Vgsth = 1-3V (Vgs max=16V), so the Arduino must be able to drive them at 3.3V. They rated at 86A continuous / 340 pulse so they should be more than good enough to handle the Tycos. The maximum drain/source voltage is 55V, which should be able to handle any surges or fluctuations. The Rds(on) is only 8mΩ which also seems very low. They're marketed as "Automotive MOSFETs" which also makes me feel confident in my choice.

 

I'm sure this will need some tweaking and experimentation, but I thought I'd share what I have in mind so far anyway. Will update again in 3 weeks once I have it running!

 

 

image.png.7878164967f32269214530c33b336ccb.png

Link to comment
Share on other sites

Quite a lot to say about that! I don’t think there is a need to fuse every coil of every Tyco relay. The fuse is to protect the wiring and should be close to the source of power. I had just the one 5A fuse from battery + to the BMS, located at the battery, feeding the BMS and the relay coils. Software would need to ensure that only one coil was powered at any one instant.

 

But you do need to fuse the connections to each cell (near the cells), since a dead short even on 3.2v will generate a massive current.

 

Then we come to the way you are sampling the cell voltages. As I understand it those arduino “voltage sensors” are just potential dividers. And Gnd and - are connected together. You have therefore wired dead shorts across the cells! All the GND connections must be connected to battery -. This means you are spreading the entire battery bank voltage over the span of the analog input, severely reducing resolution and accuracy. However it might still be enough for over and under voltage detection. A bit of maths required to extract each cell voltage.

 

Battery temperature sensor need a pull-up to analog ref. I think, as far as I’m aware an analog input can’t measure resistance directly, only voltage. But in any case I’d use a one-wire digital sensor eg DS1822

 

Calorifier thermostat needs a pull down resistor unless this can be set up in the IO configuration, which I doubt.

  • Greenie 1
Link to comment
Share on other sites

3 hours ago, nicknorman said:

Quite a lot to say about that!


Thanks for putting me straight Nick! Luckily no comments on the MOSFETs or the switching, which is the bit that I was really thinking about. The rest I kind of chucked in to get an idea of what components I still needed to buy.

 

 

 

3 hours ago, nicknorman said:

I don’t think there is a need to fuse every coil of every Tyco relay.

 

I bought a bumper bag of fuses and holders and already built this part when I first installed. I figured that if I did fuse each coil individually, it would make it easier to see which relays and coils have a problem. Do you think that it's unwise to do this?

 

 

 

3 hours ago, nicknorman said:

But you do need to fuse the connections to each cell

Done.

 

 

 

 

3 hours ago, nicknorman said:

those arduino “voltage sensors” are just potential dividers. And Gnd and - are connected together. You have therefore wired dead shorts across the cells! All the GND connections must be connected to battery -.

You're dead right, I could in fact make my own here with a pair of resistors (which is how my experimental 1-cell voltmeter is working) but the prebuilt modules are so cheap and have nice screw terminals on them so will just make the installation easier. I have corrected the diagram. The 1, 1+2, 1+2+3, 1+2+3+4 sensors is exactly how much current per-cell monitoring is wired (ISDT-BG8S and the non-functional GWL CPM board).
 

 

 

3 hours ago, nicknorman said:

severely reducing resolution and accuracy.

 

That's a concern for me. Why does it reduce resolution and accuracy - because the accuracy of any cell is only as good as the weakest link? Or because of the sensitivity of the Arduino? I used an Uno because that's what I have, and the analog/digital converters are 10bit. I could get a different board like a ESP32 which has 12bit analog/digital converters, but I figured that 10bit would be good enough - maybe I should look into this more. It's no good relying on this system if it can't be accurate to at least 0.01V.

 

I'm taking pains to improve the accuracy with the addition of the LM4040 voltage reference, but since it only provides 4.096V do you think this is too far away to be accurate?

 

 

 

 

3 hours ago, nicknorman said:

Battery temperature sensor need a pull-up to analog ref. I think, as far as I’m aware an analog input can’t measure resistance directly, only voltage. But in any case I’d use a one-wire digital sensor eg DS1822

 

I've corrected it, didn't put any thought into that at all, just picked the symbol from the diagram maker and stuck it in anyhow! I have a LM35 transistor for this, I have corrected the diagram how I believe it should be connected, do I still need a pull-up / pull-down resistor?


 

3 hours ago, nicknorman said:

Calorifier thermostat needs a pull down resistor unless this can be set up in the IO configuration, which I doubt.

Corrected, currently I'm just using the digital thermostat as a thermometer so I know when I can start my shower, the relay is currently unused. I will take the signal from the arduino output then I think it doesn't need a resistor.

 

 

Here's the updated diagram:
image.png.245ee939fe59748ea2bb422015863dec.png

 

Link to comment
Share on other sites

Regarding the cell voltage monitoring, you could set up the potential dividers in a couple of ways. One way would be to adjust potential dividers to map each cell voltage onto the 4.096 reference. So for the first cell you are pretty much on a 1:1 mapping. You have a 10bit A to D so each of the 1024 counts would be 4mV per step which is OK. An A2D output of 0 would be 0, 1023 would be 4.096v.

For the 4th cell, it’s voltage, say up to 14.8v will have to be mapped onto the 4.096v, although I’m going to keep it mathematically simple by saying let’s use 4.096v/cell ie the max is 16.384v (4:1 mapping). Now the resolution is 16mV per cell and there will be at least 1 lsb of jitter), which is getting too much for the likes of balancing. But as I said, still ok for low and high alarms. There is no direct correlation between the AtoD output and the cell voltage, you need to know the cell voltages of the previous 3 cells to work it out, all of which can introduce further errors from lsb jitter etc.

 

Which reminds me, I would have a capacitor of say 0.1uF across each A2D input to reduce noise and spikes. You may want to oversample on the A2D to further reduce noise.

 

The normal way to do it would be to use an analogue multiplexer, which would charge up a tiny capacitor across the cell, and then switch both ends of the capacitor so it would be across analogue ground and the A2D input. Thus each cell voltage is mapped onto a 0 to 4.096v A2D input range. But that is quite complicated to achieve and why I used a dedicated chip that does all that for me, giving me a resolution of 1.2 mV on all cells.

Edited by nicknorman
Link to comment
Share on other sites

Other points: fuses. No particular opinion but every extra connection and item you add is a potential source of failure  so it should be kept simple unless the addition “brings something to the party”. You will be pissed off if after years  you finally have a genuine over or undervoltage event and the Tyco fails to open because the fuse blew last year, or the connections are corroded!

 

Temperature sensor. Yes that’s how it’s wired but when done that way, the minimum reading is 2C. Maybe that is good enough.

 

I don’t quite understand the bit about the thermostat, but the important point is not to leave an input floating (thermostat contact open) as it’s value is then undefined and could be anything.

Link to comment
Share on other sites

2 hours ago, nicknorman said:

For the 4th cell, it’s voltage, say up to 14.8v will have to be mapped onto the 4.096v, although I’m going to keep it mathematically simple by saying let’s use 4.096v/cell ie the max is 16.384v (4:1 mapping). Now the resolution is 16mV per cell and there will be at least 1 lsb of jitter), which is getting too much for the likes of balancing. But as I said, still ok for low and high alarms. There is no direct correlation between the AtoD output and the cell voltage, you need to know the cell voltages of the previous 3 cells to work it out, all of which can introduce further errors from lsb jitter etc.

Thanks for spelling it out, that makes total sense, that was also why I hoped I could use the voltage sensors like a "permanently attached multimeter" across each cell only. If I was to use a microcontroller with a 12 bit AtoD then I would end up with the 4mV you suggested for the 1st cell using the 10 bit. But I think I'm going to start with the Uno and see how I feel later.

 

 

 

2 hours ago, nicknorman said:

The normal way to do it would be to use an analogue multiplexer, which would charge up a tiny capacitor across the cell, and then switch both ends of the capacitor so it would be across analogue ground and the A2D input. Thus each cell voltage is mapped onto a 0 to 4.096v A2D input range. But that is quite complicated to achieve and why I used a dedicated chip that does all that for me, giving me a resolution of 1.2 mV on all cells.

I don't understand this bit, so I think this is beyond me for the time being. Going to keep it simple for now and get it working even if the resolution is too low.

 

 

2 hours ago, nicknorman said:

Other points: fuses. No particular opinion but every extra connection and item you add is a potential source of failure  so it should be kept simple unless the addition “brings something to the party”. You will be pissed off if after years  you finally have a genuine over or undervoltage event and the Tyco fails to open because the fuse blew last year, or the connections are corroded!

That's a really good point that I hadn't considered, one fuse for all relays make some sense. Perhaps I should add a "blown fuse LED warning" that will alert me in this case.

 

 

2 hours ago, nicknorman said:

Temperature sensor. Yes that’s how it’s wired but when done that way, the minimum reading is 2C. Maybe that is good enough.

I'm not sure why it would be so low, the sensor is rated from -55 to 150 degrees centigrade, but I'll look into this more as I suspect it's to do with the mapping of voltage to temperature.

 

 

2 hours ago, nicknorman said:

I don’t quite understand the bit about the thermostat, but the important point is not to leave an input floating (thermostat contact open) as it’s value is then undefined and could be anything.

 

I see - thanks yes, I will use a pull down resistor then on the analogue input to ensure that it is not floating when the contact is open.

Basically I was just trying to put across that I'm using an external digital thermostat and hooking it into the BMS with the (currently unused) relay. The digital thermostat came with the immersion element I bought (which has a 600W 12V element and a 1kW 240V element). That relay is supposed to turn on the 12V immersion heater element but the current is rated far too low (10A I think) so I never used it, but I still installed it because it's nice to see the temperature display. Just thought it was an easy way to know whether or not to keep putting dump energy into the calorifier or not.

Link to comment
Share on other sites

Fuses: not quite sure how you can easily add a “fuse blown” led since you don’t know the fuse has blown until you turn on the FET and nothing happens!
 

Temp sensor: if you have a look at the data sheet, you’ll see that with no pull down resistor the min is 2C but you can add a pull down resistor to make it go lower, and change the mapping.

  • Greenie 1
Link to comment
Share on other sites

22 hours ago, jetzi said:


Thanks for putting me straight Nick! Luckily no comments on the MOSFETs or the switching, which is the bit that I was really thinking about. The rest I kind of chucked in to get an idea of what components I still needed to buy.

 

 

 

 

I bought a bumper bag of fuses and holders and already built this part when I first installed. I figured that if I did fuse each coil individually, it would make it easier to see which relays and coils have a problem. Do you think that it's unwise to do this?

 

 

 

Done.

 

 

 

 

You're dead right, I could in fact make my own here with a pair of resistors (which is how my experimental 1-cell voltmeter is working) but the prebuilt modules are so cheap and have nice screw terminals on them so will just make the installation easier. I have corrected the diagram. The 1, 1+2, 1+2+3, 1+2+3+4 sensors is exactly how much current per-cell monitoring is wired (ISDT-BG8S and the non-functional GWL CPM board).
 

 

 

 

That's a concern for me. Why does it reduce resolution and accuracy - because the accuracy of any cell is only as good as the weakest link? Or because of the sensitivity of the Arduino? I used an Uno because that's what I have, and the analog/digital converters are 10bit. I could get a different board like a ESP32 which has 12bit analog/digital converters, but I figured that 10bit would be good enough - maybe I should look into this more. It's no good relying on this system if it can't be accurate to at least 0.01V.

 

I'm taking pains to improve the accuracy with the addition of the LM4040 voltage reference, but since it only provides 4.096V do you think this is too far away to be accurate?

 

 

 

 

 

I've corrected it, didn't put any thought into that at all, just picked the symbol from the diagram maker and stuck it in anyhow! I have a LM35 transistor for this, I have corrected the diagram how I believe it should be connected, do I still need a pull-up / pull-down resistor?


 

Corrected, currently I'm just using the digital thermostat as a thermometer so I know when I can start my shower, the relay is currently unused. I will take the signal from the arduino output then I think it doesn't need a resistor.

 

 

Here's the updated diagram:
image.png.245ee939fe59748ea2bb422015863dec.png

 

 

You might also want to consider having clamp diodes at the output of each FET (assuming the relays don't have internal ones); if they turn off quickly (which is likely) the stored energy in the relay coil could easily exceed the breakdown voltage of the FETs. Depending on the energy and voltage you might be fine forever, or one might die after some time under repeated stresses, or one might go phut the first time you turn a relay coil off -- and FETs mainly fail short-circuit, which will then kill the relay...

Link to comment
Share on other sites

On 18/10/2021 at 16:10, jetzi said:

I don't understand this bit, so I think this is beyond me for the time being. Going to keep it simple for now and get it working even if the resolution is too low.

 


Just FYI, and not because I think you need to do it, this is an explanation of what I was waffling on about. See my crappy diagram…

4C1C7C43-65F6-4021-B2EC-55B0E2855F34.jpeg.90423bf62de2087f29b8abb1df9aa5e3.jpeg

 

The things in circles are an analogue switch, double pole changeover. These things are MOSFET based and switch analogue voltages, as the name suggests, controlled by a digital input. So in the position shown, the capacitor is connected to the top cell (as an example). So it has 9.9v on 1 pin and 13.2v on the other, ie it has 3.3v across it, storing the corresponding charge which maintains 3.3v across it (for a few moments) even if it is disconnected. Now the switches flip (break before make) and the bottom end is connected to analogue ground. The other end, because no charge has flowed in or out, is still at 3.3v above the other pin, ie 3.3v relative to its other pin which is now at analogue ground. Connect that to A2D input, and now the A2D is performed over the span 0 to 4.096v and the result is as accurate as it reasonably can be. Repeat for other cells.

 

In reality one would use an analogue multiplexer, which is just a fancy name for a multi-way analogue switch, eg you’d want to be able to connect each capacitor pin to one of the 4 cell terminals and then the A2D input

 

Obviously this requires a fair bit of hardware and wiring so in my case I chose to use a single IC which did all that (including 12bit A2D) and much more, autonomously, and sends its result to the micro over SPI.


Im not familiar with the Uno but with a decent embedded A2D converter you don’t have to use 0v and the reference voltage as the span. You could use say a reference voltage of 2v for the lower, and one of 4.096v for the higher, thus the 10 bit span is over a shorter voltage range (2.4096v) and thus resolution, over the bit you are interested in, is increased by nearly x2.

 

Edited by nicknorman
Link to comment
Share on other sites

It is a rather distant connection. (See wot I did there).

 

Amphenol ( a specialist manufacturer of high quality plugs and sockets AKA interconnects but not to be confused with cell-to-cell interconnectors) are saying that electric car makers need specialised connectors to suit their production designs and techniques, including the connectors needed for battery monitoring and management systems,  and that the connector makers are responding to the EV makers requirements and  can supply what they want.

 

Ground breaking stuff.

 

N

  • Haha 1
Link to comment
Share on other sites

  • 3 weeks later...

Small update, I'm making reasonable progress with the Arduino based BMS.

It's reading my four voltages and the MOSFETs are driving the Tyco relay effectively. I still feel a few months away from an install though. "Productionising" this into a full system that doesn't have wobbly connections, is physically robust and stable, and has all 4 relays / 8 MOSFETs as well as all the other good stuff I have planned is going to be quite something, you can see how tangled the wiring is already.

 

A bigger problem is that the voltage readings don't seem to be stable. They will be fine for a while, then all of a sudden they start misbehaving, I think it might just be a wobbly connection. See the below log of my serial monitor.
 

Cell 0: 3.30  Cell 1: 3.30  Cell 2: 3.18  Cell 3: 3.32  
Cell 0: 3.30  Cell 1: 3.30  Cell 2: 3.18  Cell 3: 3.32  
Cell 0: 3.34  Cell 1: 3.30  Cell 2: 3.16  Cell 3: 3.32  
Cell 0: 6.90  Cell 1: -0.30  Cell 2: 3.18  Cell 3: 3.34  
Cell 0: 5.88  Cell 1: 0.74  Cell 2: 3.16  Cell 3: 3.34  
Cell 0: 7.48  Cell 1: -0.88  Cell 2: 3.18  Cell 3: 3.32  
Cell 0: 3.34  Cell 1: 3.26  Cell 2: 3.18  Cell 3: 3.34  
Cell 0: 3.96  Cell 1: 2.66  Cell 2: 3.16  Cell 3: 3.34  
Cell 0: 3.28  Cell 1: 3.30  Cell 2: 3.18  Cell 3: 3.34  
Cell 0: 3.28  Cell 1: 3.30  Cell 2: 3.18  Cell 3: 3.34  
Cell 0: 3.28  Cell 1: 3.30  Cell 2: 3.18  Cell 3: 3.34  

 

The voltages seem fairly accurate but there's enough play to concern me, and I think I may need to upgrade from the Uno to a microcontroller that has a higher than 10bit analogue/digital converter resolution.

 

image.png.1e88e13d18cca051bddb89466a74307a.png

Edited by jetzi
Link to comment
Share on other sites

Noticable that with the faulty rows, the total still adds up to around 13.1v. Maybe bad wiring but also possible a code glitch whereby you are not converting the cell you think you are converting  / misapplying the algorithm to get voltage out of the A2D result.

You need to experiment with a PCB design programme and send some boards off to China for manufacture, like I do!

Link to comment
Share on other sites

On subject of Arduino cell voltage monitoring, my system uses the simple and obvious method of measuring the voltage WRT ground at each cell junction using potential dividers.  I divide the voltage by 6 and use the built-in 2.56v band-gap analog reference in the microcontroller. That gives a range of 0 to 15.36 volts and a resolution of 15mV at the least-significant bit for the 10 bit ADCs in the Arduino. By oversampling I get values which are accurate (or at least consistent) to within about 25mV in practise. Individual cell voltages are obtained by subtraction, in the obvious way.

 

This all works fine, but I'd say the resolution is only just good enough. If I was starting again I'd use a microcontroller with a 12-bit ADC.

 

Beware of the specs on the microcontroller for the maximum voltage at an input pin. This is normally given as Vcc plus a small margin. Since I'm dividing the voltage by six, and using 5v Vcc, all is fine as long as the Arduino is powered up. If it's off and Vcc is zero the input pins are still connected to the voltage dividers and the maximum voltage above Vcc spec is wildly violated. You can probably rely on the chip's built-in protection diodes if the potential divider resistors are high enough (and you want them to be high to avoid parasitic discharge) but to be sure I added discrete 1N4148s from each cell voltage input pin to Vcc. They are normally reverse biased, so have no effect, but when the Arduino is off and Vcc is low they conduct and limit the pin voltage to Vcc+0.6, which is safe.

 

I bought 0.1% resistors for the voltage dividers, but they still need calibration factors to be added in software to get readings which agree with my multimeter. (The multimeter ain't necessarily that accurate, but it can be assumed to have consistent errors, so I trimmed the calibration so the cell voltage read by the Arduino agreed with the multimeter for each cell.)

 

MP.

Link to comment
Share on other sites

Well if this is a show and tell, I selected a purpose built IC that measures the voltages of up to 6 cells, with built in multiplexers and 12 bit AtoD spanned over 1 to 5 volts giving a resolution of 1mV for all cells, and an absolute accuracy of about 2mV over a reasonable temperature range. Also has level converters to drive balancing mosfets. Tell it to convert all cells, go away for 1mS or so, come back and read the answers over SPI. Simples! Also has analogue inputs for thermistors to measure cell temperatures, but I prefer the 1-wire digital temperature sensors. Digital is so much easier!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.