diy solar

diy solar

Taves BMS

@Cal, over the next few days I will create a proper itemized cost for the 4x cell board. However, I am still hoping to hear other's opinions on what V measurement accuracy is required for this application. I totally get that 12 bits is better than 8, but 16 is better too. Where is the cut off for useless additional accuracy?

The ADC1115 will not tolerate a V differential higher than 5V, right? So your design is using resistors to divide the voltage of cells 1, 2, and 3 down to within 5V of cell 0, right? So those resistors introduce new variables with respect to measuring cell V differences, right?

Also, maybe I missed it, but did you confirm that you must assign different addresses to the 4x cell boards in order to make a BMS handle more than a 12V pack? And did you understand a nice solution to that would be to use 1 attiny per 4x cell board so it can do the serial communication with the controller?

In other words, is our best current idea for a higher precision solution with the all-boards-identical requirement as follows:
1 attiny getting it's V off of cell 0.
2 ADC1115. 1 will be used to measure the V of the 4 cells. Where cells 1, 2, and 3 have resistors to divide their V down to a tolerable value for the ADC. 1 ADC will be used to measure thermistors on each cell (again, not terribly important).
 
Does "eek out more capacity" mean anything different than "maximize capacity available"?

Well, I understood that as "throw away more capacity"... Sorry but I'm not an english native speaker and while I understand most abbreviations, acronyms, non-official words, etc... there's some that I don't know, so avoiding unusual words would help a lot for comprehension.


How do I generate an app to display data on an i-pad?

Simplest would be to not do an app but a webpage served by the ESP32, so you don't have anything to develop on the tablet (and it's compatible with iOS, Android, etc...) and unless I'm wrong it's already what he has done ;)


However, I am still hoping to hear other's opinions on what V measurement accuracy is required for this application. I totally get that 12 bits is better than 8, but 16 is better too. Where is the cut off for useless additional accuracy?

Warning: personal opinion ahead. I'd say anything with more than +/- 20 mV accuracy is not worth using, +/- 10 mV is barely ok, +/- 5 mV is good, +/- 1 mV is great, +/- < 1 mV is super nice but not really needed. So my answer to the actual question would be somewhere between 1 and 5 mV ;)

I use a 16 bits ADC because I need the accuracy and resolution for the current measurement. A 12 bits one would be enough (if it's correctly implemented and if it's a decent ADC, i.e. not one integrated to a basic MCU). If you do everything perfectly and if you use a really nice ADC then a 10 bits one could be enough, but given the very small price difference with a 12 bits one you're better just using a 12 bits one. You can also do a lot of oversampling + averaging to increase the ENOB but the trade-off is more CPU time needed and more time per measurement too.


The ADC1115 will not tolerate a V differential higher than 5V, right? So your design is using resistors to divide the voltage of cells 1, 2, and 3 down to within 5V of cell 0, right? So those resistors introduce new variables with respect to measuring cell V differences, right?

Yep, but 0.1 % resistors are affordable (even 0.05 % ones are too) and you forget that initial accuracy is nice but tempco is more important here. And any initial error on the divider ratio can be calibrated in software very easily.


2 ADC1115. 1 will be used to measure the V of the 4 cells. Where cells 1, 2, and 3 have resistors to divide their V down to a tolerable value for the ADC. 1 ADC will be used to measure thermistors on each cell (again, not terribly important).

Or one ADC and a MUX as it's probably less expensive, and you can use an ADC with only one input (so less expensive again) ;)
 
What about this Apple app?
I would not touch that with a 10ft pole.

It is very important that you comprehend everything that is executing on the ESP. You cannot have anything that will stall, use interrupts improperly, etc. If any code gets in a stuck place, you are not properly checking status and controlling relays to stop charging.

For example, I will shortly be implementing a timer that will shut everything down. That timer will be killed and restarted every time the status is checked and relays are set. If the next status does not happen before the timer goes off, something went wrong.

There are 2 CPUs on the ESP32, and I have not yet taken advantage of the second. I will be putting the status stuff on one CPU and the wifi stuff on the other.

I plan on testing my timer by making some web client step take many seconds. I hope to show that when I move it to the other CPU, even a stalled web request does not stop the status from happening.
 
For example, I will shortly be implementing a timer that will shut everything down. That timer will be killed and restarted every time the status is checked and relays are set. If the next status does not happen before the timer goes off, something went wrong.

Yep, that's called a watchdog and there's a great article on the subject here: http://www.ganssle.com/watchdogs.htm (and a small update here: http://www.ganssle.com/articles/watchdogsredux.htm ) ;)


There are 2 CPUs on the ESP32, and I have not yet taken advantage of the second. I will be putting the status stuff on one CPU and the wifi stuff on the other.

Good idea ;)
 
@Cal, over the next few days I will create a proper itemized cost for the 4x cell board. However, I am still hoping to hear other's opinions on what V measurement accuracy is required for this application. I totally get that 12 bits is better than 8, but 16 is better too. Where is the cut off for useless additional accuracy?

There's more that comes into play with regards to accuracy than just # adc bits. Since price difference isn't that huge, I would go with 16 bits.

@Cal

The ADC1115 will not tolerate a V differential higher than 5V, right? So your design is using resistors to divide the voltage of cells 1, 2, and 3 down to within 5V of cell 0, right? So those resistors introduce new variables with respect to measuring cell V differences, right?

That's correct. I'm using the internal voltage reference of 2.048V and voltage divider of 0.5, 0.25, 0.167 and 0.125. It's not yet resolved if the voltage subtraction method is accurate enough. I still need to work out a thermal correction factor. There will be a bit of calibration involved (resistor divider, offset, thermal) to get it going. I'm working on it, but will also try the isolated adc method.

@Cal
Also, maybe I missed it, but did you confirm that you must assign different addresses to the 4x cell boards in order to make a BMS handle more than a 12V pack? And did you understand a nice solution to that would be to use 1 attiny per 4x cell board so it can do the serial communication with the controller?

In other words, is our best current idea for a higher precision solution with the all-boards-identical requirement as follows:
1 attiny getting it's V off of cell 0.
2 ADC1115. 1 will be used to measure the V of the 4 cells. Where cells 1, 2, and 3 have resistors to divide their V down to a tolerable value for the ADC. 1 ADC will be used to measure thermistors on each cell (again, not terribly important).
Yes, adc1115 has 4 possible address with I2C communication.
Yes, one of your options is to use an attiny per 4x cell board (with one adc and 4 resistor dividers).

I'm not that sold on the adc1115. BiduleOhm uses LTC2452 (16 bit adc). It has 3-wire SPI communication (chip select, SCK and MISO). This may be better. No attiny. The ESP32 controls all the adc's via isolated SPI. One adc per cell?
 
I'm not that sold on the adc1115. BiduleOhm uses LTC2452 (16 bit adc). It has 3-wire SPI communication (chip select, SCK and MISO). This may be better. No attiny. The ESP32 controls all the adc's via isolated SPI. One adc per cell?

NB: I love SPI because it has a lot of advantages but one of his inconvenients is that it's not well suited for daisy chaining as it requires one chip select line per IC instead of having addressing (so 2 shared lines + one per ADC in your example).

I'm pretty sure you can find very similar ADCs with another protocol like I2C for example, or you can probably find I2C to SPI converters if you really want to use I2C with a SPI chip.

You can also use simple shift registers and do your own protocol to be able to daisy chain easily (only 3 lines required, no matter the number of them chained) and control pretty much any type of com you want (for example you could control 6 LTC2452 with one 8 bits shift register) ;)

Edit: guess what? there's the LTC2451 who has pretty much the same specs than the 2452 but has I2C comm :)
 
Last edited:
  • Like
Reactions: Cal
I still have no seen any engineering reason that this application requires more accuracy than the attinyx41 delivers. BiduleOhm provided his opinion, but there was no justification for his opinion that related to this particular application.

Right now, if I were to design a new 4x cell board, I would use 4x INA226 chips. They have been dead on accurate with my multimeter with respect to whole pack voltage and would require no resistors or reference voltage. (I could even use the bus bars as the shunts and measure the individual amps between the cells.)

And also, let's be clear here. You can argue that with higher accuracy we can bring the individual cells to exactly the cut off we want, and to balance to a finer degree. But again, again, again, all that does is enable a slightly higher usable capacity ("eek out more capacity"). Nobody has explained why any real application requires that additional x% of additional capacity. Nobody has stated why it makes sense to even go into the knee where this accuracy matters. Again, I stated that I need to discover the knee to reset the accumulated error on the Amp counting.
 
Glad you like the accuracy of INA226. It uses a 16 bit adc.

I don’t believe you got it clear. Higher accuracy is not to get slightly more energy into the battery.

We need accuracy so that the wrong cell isn’t “balanced”. You don’t want to be worse than 5 mV.
 
Glad you like the accuracy of INA226. It uses a 16 bit adc.
The like has nothing to do with how many bits.
and would require no resistors or reference voltage
My point is that you plop the chip down along with a capacitor, hook up the i2c, enter in your shunt info, and it gives you excellent values.
I don’t believe you got it clear. Higher accuracy is not to get slightly more energy into the battery.

We need accuracy so that the wrong cell isn’t “balanced”. You don’t want to be worse than 5 mV.
What is the benefit of balancing the cells? (hint: more usable capacity)

I have no intention of balancing cells that are within the measurable difference.
 
I still have no seen any engineering reason that this application requires more accuracy than the attinyx41 delivers. BiduleOhm provided his opinion, but there was no justification for his opinion that related to this particular application.

Reason was obvious but I'll write it here so no confusion is possible: more than +/- 5 mV would mean more than a 10 mV delta between two cells and that's usually the delta limit we use for balancing. But I see @Cal already posted it :)


Right now, if I were to design a new 4x cell board, I would use 4x INA226 chips. They have been dead on accurate with my multimeter with respect to whole pack voltage and would require no resistors or reference voltage. (I could even use the bus bars as the shunts and measure the individual amps between the cells.)

Wait to put some common mode voltage on them to confirm they're still accurate; pack voltage is easy to measure accurately compared to cells voltages and shunt voltage. And also cycle one over a 50 °C temp change and see how much it drift too, because temperature is usually the biggest drift factor ;)

Also, measured accuracy on a few samples isn't reliable. You need to either measure hundred of them, or just use the datasheet specs (ideally the worst-case ones) to have any kind of idea of the real tolerances.


And also, let's be clear here. You can argue that with higher accuracy we can bring the individual cells to exactly the cut off we want, and to balance to a finer degree. But again, again, again, all that does is enable a slightly higher usable capacity ("eek out more capacity"). Nobody has explained why any real application requires that additional x% of additional capacity. Nobody has stated why it makes sense to even go into the knee where this accuracy matters. Again, I stated that I need to discover the knee to reset the accumulated error on the Amp counting.

And, again, please try to view things with a different PoV than the only one you follow from the start.


The like has nothing to do with how many bits.

Well, the resolution doesn't give you the accuracy but without a good resolution you can't have a good accuracy.


My point is that you plop the chip down along with a capacitor, hook up the i2c, enter in your shunt info, and it gives you excellent values.

Mmm yea, we understood and never said the opposite :)


What is the benefit of balancing the cells? (hint: more usable capacity)

Not only that actually. First other reason who comes to my mind is equal wear on the cells.
 
  • Like
Reactions: Cal
I like your project, I was thinking of doing something similar with an esp32, I'll stay here to see how it evolves.
 
Reason was obvious but I'll write it here so no confusion is possible: more than +/- 5 mV would mean more than a 10 mV delta between two cells and that's usually the delta limit we use for balancing.
Again, for what purpose? Balancing is not a self evident goodness. Balancing to less than 10mV is not some sort of self evident truth.
Not only that actually. First other reason who comes to my mind is equal wear on the cells.
Ahhh, finally an acknowledgment that capacity is a reason, and a new reason! Yea!

OK, so what degree of balance is needed to ensure equal wear on the cells given that the BMS will let the user charge to N%, and only rarely drive the cells to the knee to clear accumulated error? Note, that SoC is calculated by integrating Amps, not by measuring V.
 
Last edited:
I like your project, I was thinking of doing something similar with an esp32, I'll stay here to see how it evolves.
Excellent, tell me what you need/want. Speak up if you want to give it a go. I have boards that are working fine, but I have new designs with minor improvements waiting to be ordered when JLCPCB has the attinyx41s in stock. Alternatively one can hand solder the SMT attinys. Or find another fab that will do the complete job.
 
Ahhh, finally an acknowledgment that capacity is a reason, and a new reason! Yea!

Of course it's a reason, we never said otherwise. I don't know why you're so focused on thinking we all want to extract the last fraction of a % of capacity and that all of what we say is towards that goal, but it's getting really tiring. So I'll stop answering here, and I just wish you good luck with your project anyway ;)
 
I don't know why you're so focused on thinking we all want to extract the last fraction of a % of capacity
I apologize but that's the only reason I know for balancing, and that provides no rationale for needing less than 10mV of measurement accuracy. If you had continued to read that posting, you would have spotted the following:
and a new reason! Yea!

OK, so what degree of balance is needed to ensure equal wear on the cells given that the BMS will let the user charge to N%, and only rarely drive the cells to the knee to clear accumulated error? Note, that SoC is calculated by integrating Amps, not by measuring V.
Notice, that I have recognized a new reason to balance, and I am assuming that this new balancing reason is going to tell me where the 10mV number came from below.
Reason was obvious but I'll write it here so no confusion is possible: more than +/- 5 mV would mean more than a 10 mV delta between two cells and that's usually the delta limit we use for balancing
Can you explain why you believe we want the cells to be balanced to within 10mV?
 
Last edited:
I apologize but that's the only reason I know for balancing, and that provides no rationale for needing less than 10mV of measurement accuracy. If you had continued to read that posting, you would have spotted the following:

Notice, that I have recognized a new reason to balance, and I am assuming that this new balancing reason is going to tell me where the 10mV number came from below.

Can you explain why you believe we want the cells to be balanced to within 10mV?

The 10 mV is a rough average that make sense and that you can see in most other BMSs. 100 mV is too coarse (that's like 20 % of the typical 3.0 to 3.5 V range we use with LFP...) and 1 mV is obviously very nice but most people don't want to spend the money to have that kind of accuracy.

I personally want better than 10 mV but that's because I like accurate equipment so I don't need to ask myself if the accuracy is good enough (I know it is because it's actually better than good enough, like having a Fluke DMM vs a cheap Chinese DMM for example) and because I want to do some experiments to characterize LFP cells where the higher the accuracy the better. And of course it means a bit more usable capacity and less wear on the cells (and it should be more equal across them too). It's also not too hard to do because I need a high spec ADC for the current measurement anyway. Again, it's a personal choice only.

Oh also, now that I'm thinking to selling some, it allows me to be sure the specs I list are met, even in the worst case, because I can have some margin (like for example if the BMS is capable of +/- 0.5 mV worst case I'll list +/- 1 mV just to be safe, vs. if it was actually +/- 1 mV I would either have no margin by listing +/- 1 mV or would have to list a lower spec of +/- 2 mV).
 
I'm using an ESP32. Specifically this one
The antenna is this.
I just tried it without the antenna and it sucked.

After paying attention to the different WROOM-32, I now understand that the 32U does not have the PCB board antenna, but it does have the u.fl connector.

I just bought this one which has the WROOM-32D which does have the pcb antenna. I am reasonably sure that the PCB antenna is sufficient for my needs and eliminates the fussy antenna.
 
  • Like
Reactions: Cal
I haven't gotten the WROOM-32D yet. It's lost in the mail. I need to reorder. You're supposed to get better reception with the external antenna.

I still don't know how to access data from the iPad. Did you write your own app? Is there an example to follow?
Thanks
 
Back
Top