I committed my code to johntaves/diybmsv4code.
This code goes with the controller I made that has 6 relays on board, 1 external thermister connector, and 2 INA226 chips for current measurement. However, it works with the base controller. If it fails to find the INA chips, then the settings and status things that need those chips disappear. However, I have not fully tested it with an original board. One of the main reasons for this new code is to take advantage of the current measurement stuff and be able to use state of charge in controlling the relays.
I can commit that hardware design if anyone wants it.
@MasterCATZ, I totally killed the original rules functionality. It seemed like a generic rules processor that could do anything, but it couldn’t. I didn’t figure out a way to keep that do-anything style while supporting the functionality that I felt was necessary. I actually made a version (see screen shots either on this thread or the other thread) that used the original rules method, but added states for hysteresis. It might have handled everything, but I was not really confident. My head kept spinning with respect to applying the rules sequentially. For example, if you put the rule that the load relay be shut off when the battery is less than xV, and of course that is the highest priority rule, then oops it overrides the fish tank rule that was a lower priority and turns on the loads when above xV.
I had to be confident, with straight forward logic, that the loads and chargers would be shut off when the limits were hit. This required a simple UI and simple code. I felt that the rules made my head spin with the assorted states and even if I got the code right, I was not convinced the user would set the rules properly. The basic idea is that you tell it the limits, and which relays are loads and which are chargers, and it will make sure those limits are not exceeded.
I intend to put in an email notification (so you can send an SMS to your phone) if it commands that loads or charges be off, and it still has current going in that direction. This would happen if you lied about the relays, or you’ve shorted them on.
Yes, this will provide the capacity test information. You provide the capacity, and the max cell and min cell voltages, then charge it until the max trips off the chargers. The code then shoots the state of charge to 100%. If it reaches 100% prior to tripping off, it highlights the state of charge display to indicate it’s above your estimated capacity. If it was not at 100% when it tripped off, it displays the milliAmpHour addition it had to do to get it to 100%. In other words, it shows the difference between your estimate capacity and what it counted. The same thing happens at the bottom. So, you’ll charge it up, and thus establish your 100%, then throw on the loads and wait for it to trip off. As long as you’ve over estimated your capacity, it will show the capacity it thought you had before it tripped off.
The individual cell temperatures are not supported, but it will take no time to throw them back in. I didn’t really see the point. I have an external temp sensor on my controller that provides me with the pack/ambient temperature necessary to keep from charging when near freezing.
Regarding the fish tank rule, it will turn on/off based on state of charge. I did not do anything where you can look at temp and state of charge.