diy solar

diy solar

YamBMS JK-BMS-CAN with new Cut-Off Charging Logic (open-source)

Just wanted to report things are working great. No issues with multi-bms-ble. Multiple charge/discharge cycles (on purpose).
 

Attachments

  • IMG_5769.jpeg
    IMG_5769.jpeg
    82.2 KB · Views: 6
In the case of an inverter with a low load (when you are away from home for several days for example), the battery voltage drops slowly and it takes a few days for the Rebulk V. condition to be true. This new criteria based on SoC makes it possible to start a new Bulk phase earlier otherwise it is possible that it will only start at an SoC of 75%.
I've been experiencing this situation recently: long sunny days with high PV production and days away from home with low consumption. As a result, the charging status remains in "FLOAT" for an extended period. The "rebulk" SoC condition could help by forcing the system back into bulk charging, thereby aiding in battery balancing.

I've now set the rebulk voltage to 52.8V. This level has been triggered only a few times in July.

1721739124305.png
 
@MrPablo @Der_Hannes @shvm @arzaman and all

What do you think of a rebulk based on two criteria :
  1. Rebulk V.
  2. Rebulk SoC
If one of these 2 conditions is true then a new Bulk phase can begin.

In the case of an inverter with a low load (when you are away from home for several days for example), the battery voltage drops slowly and it takes a few days for the Rebulk V. condition to be true. This new criteria based on SoC makes it possible to start a new Bulk phase earlier otherwise it is possible that it will only start at an SoC of 75%.
There's several ways we can look at triggering rebulk:
  1. Voltage - can lead to long-term float and resulting drop in SOC over time
  2. SOC - will resolve the above, but relies on accurate SOC
  3. Time since last full charge - will resolve the issue with voltage, but won't work well in systems that rarely charge fully
  4. Time since last bulk - will resolve the issue with voltage, should work regardless of SOC accuracy
SOC is likely the easiest to implement.
 
There's several ways we can look at triggering rebulk:
  1. Voltage - can lead to long-term float and resulting drop in SOC over time
  2. SOC - will resolve the above, but relies on accurate SOC
  3. Time since last full charge - will resolve the issue with voltage, but won't work well in systems that rarely charge fully
  4. Time since last bulk - will resolve the issue with voltage, should work regardless of SOC accuracy
SOC is likely the easiest to implement.

The SoC can become inaccurate when there is very little time to fully recharge. That said, in Portugal, I was able to compare the SoC of a JK-BMS 8S against a Junctek Shunt and even without 100% recharging for several days the SoC of the JK-BMS was often equal to the shunt.

Here is the graph over a period of 1 month without 100% charging every day.

SoC Shunt vs BMS.png

So I think that a well calibrated JK-BMS for correct measurement of a 5A current (this is my procedure) can be reliable.

Let's imagine a Rebulk with 85% SoC, what would be the problem if the real SoC is 80% or 90%? None from my point of view.

Let's not forget that in the future it will be possible to take Voltage, Current, Power and SoC information from a shunt. That would be the next step on my list.

So I add the Rebulk condition based on the SoC?
 
The SoC can become inaccurate when there is very little time to fully recharge. That said, in Portugal, I was able to compare the SoC of a JK-BMS 8S against a Junctek Shunt and even without 100% recharging for several days the SoC of the JK-BMS was often equal to the shunt.

Here is the graph over a period of 1 month without 100% charging every day.

View attachment 230605

So I think that a well calibrated JK-BMS for correct measurement of a 5A current (this is my procedure) can be reliable.

Let's imagine a Rebulk with 85% SoC, what would be the problem if the real SoC is 80% or 90%? None from my point of view.

Let's not forget that in the future it will be possible to take Voltage, Current, Power and SoC information from a shunt. That would be the next step on my list.

So I add the Rebulk condition based on the SoC?
I don't think I'm directly affected by this (3 x Inverters Deye 12kW/inverter has a no-load Power Consumption of 300W-400W -> 0.3kW/0.4kW, my base/average load is somewhere in the range of 1.2-1.5kW [including Inverter losses], so in one Day I currently swing between 30-40% to 100% with 30kWh installed), but I still think it's a good idea 👍 .

However, my experience is also that a few months ago after a full charge, the maximum SOC of **ONE** Battery (with an older HW/SW Version of JK BMS, IIRC Version 10) would weirdly drift. First it would be 100%, a few days later 99%, then a few days later 98%, etc. I think for a Period it didn't go above 92% .... Then, not sure why, the last 1-2 Months it went up again to 99% or so.

The other Battery didn't have this Problem and always reached 100% [actually too early, because there was still some charging left to be done, HW/SW Version 11 for this one].

Just to say: don't put the Rebulk SOC "too high", otherwise they might never go to float. Of course your situation might be different, but this is my Experience. I wouldn't recommend to set it above 85% (worst case), probably even lower (75% or so). And I agree that while the SOC is not that accurate with the JK BMS built-in sensor, it's probably "good enough" for our purposes. I don't routinely go below 20% so I have some headroom there (plus a charger in parallel that "forces" a minimum Voltage of say 51 VDC).

Are there any "Risk" if it keeps switching between Rebulk-Float-Rebulk-... all the time there is a small transient Cloud above your PV Array ? My Situation is maybe a bit extreme but with those high delta voltage values it will take a few hours to rebalance the Pack I guess. But is it really neeed ?

@Sleeper85: are you trying to force Bulk to do a "rebalance" of the Cells, to make sure that they get 100% Charged from time to time, minimize the voltage/SOC swing (-> increase Lifespan) or mainly optimize your economic yield in terms of Power (if there is excess Power on the PV side, take the chance and "boost" charge the battery before it's "too late") ? If you are "away for a few Days", i.e. the load aerage/peak is lower, thus shouldn't the unbalance also be lower (assuming it's caused by internal losses / difference in ESR, then ESR * I^2 will also be lower when you are away), wouldn't it ?

Maybe all of them ... Just trying to understand better the reasoning there.


On a separate Note
I think I just threw away the idea of installing a shunt on these new Batteries I'm currently building. Would have been 2x Victron Shunt but not much Space (or Money) for it. And I'm not in the Position, unlike many of you with maybe only 1 Inverter, to just install one: I have 3 Inverters, 5+ Chargers, 4+ Batteries all on 2 DC Distribution Busbars. Unless of course doing some very crazy stuff with 8+ Cable lugs on top of each other or something like that (Bad Idea !).

I have a few DC Current Transducers (https://eu.mouser.com/ProductDetail/Tamura/L34S400D15?qs=EyUr%2BTmQJGcqRQyWuoPhyw==&countryCode=DE&currencyCode=EUR, assuming their Datasheet is correct max. Offset would be ~ 0.02V/4V * 400A ~ 2A). DC Current Transducers (+ ADC Chain etc), from Experience, have quite high DC offset though

Do you think something like that could be an Alternative to a Smart Shunt ? IMHO a Current Shunt will have much better (lower) Offset though ...

EDIT 1: saw @MrPablo Post, so you force to Rebulk in order to "reset" (recalibrate) the SOC Counter at 100% at the High Battery Voltage & Low Tail Current Condition (if I understood correctly).
 
Last edited:
The SoC can become inaccurate when there is very little time to fully recharge. That said, in Portugal, I was able to compare the SoC of a JK-BMS 8S against a Junctek Shunt and even without 100% recharging for several days the SoC of the JK-BMS was often equal to the shunt.

Here is the graph over a period of 1 month without 100% charging every day.

View attachment 230605

So I think that a well calibrated JK-BMS for correct measurement of a 5A current (this is my procedure) can be reliable.

Let's imagine a Rebulk with 85% SoC, what would be the problem if the real SoC is 80% or 90%? None from my point of view.

Let's not forget that in the future it will be possible to take Voltage, Current, Power and SoC information from a shunt. That would be the next step on my list.

So I add the Rebulk condition based on the SoC?
Yes, SOC based is by far the easiest to implement. I mention the alternatives for reference, but they all require additional logic and testing.
This is definitely a cost / benefit moment - it's a low risk problem so dev effort should be kept low.
 
@silverstone

1000015903.png

Here is the graph of version 1.17.3 with an inverter with low load (max 150W) while we were in Portugal. I just tell myself that it might be interesting to recharge more often and not leave the SoC below 80% which would be a conservative default value.

In the case of a large load on the inverter the Rebulk V. would probably be reached more quickly so these two conditions would be complementary.

I added it to the version being tested at home. This will be part of version 1.4.2.
 
@silverstone

View attachment 230706

Here is the graph of version 1.17.3 with an inverter with low load (max 150W) while we were in Portugal. I just tell myself that it might be interesting to recharge more often and not leave the SoC below 80% which would be a conservative default value.

In the case of a large load on the inverter the Rebulk V. would probably be reached more quickly so these two conditions would be complementary.

I added it to the version being tested at home. This will be part of version 1.4.2.
Sure, it is a good idea as I also said 👍 . Just IMHO (especially if you have the same issues that I do) the SOC threshold shouldn't be set too low.

80% would be fine. If you do NOT have that weird SOC drift that I had, then 90% would also probably work. Keep at 80% for default though 👍.
 
Sure, it is a good idea as I also said 👍 . Just IMHO (especially if you have the same issues that I do) the SOC threshold shouldn't be set too low.

80% would be fine. If you do NOT have that weird SOC drift that I had, then 90% would also probably work. Keep at 80% for default though 👍.

I have no problems calculating SoC with the latest JK-BMS and even better since it integrates the two new reset voltage parameters 0% and 100%.

SoC rebulk will be set to 80% by default ;)
 
I have no problems calculating SoC with the latest JK-BMS and even better since it integrates the two new reset voltage parameters 0% and 100%.

SoC rebulk will be set to 80% by default ;)
Sorry maybe there is something new I don't know yet ... I was talking about the "Normal" SOC (I think this is what the JK BMS Calculates by itself, NOT something the ESP32 does). Which probably explains why HW/SW v10 would slowly drift away while HW/SW v11 would be fine.

Or do you mean the SOC Value that I saw in Home Assistant was always handled by syssi Code (and maybe now by yours):
1721804740194.png

I can understand that now (especially with multiple Batteries) your code will calculate a "Global SOC" so you can of course "manipulate" (in a positive Way ;) ) and filter out these BUGs by the JK BMS Board.

Or do you mean that now, with your code, you even might go a Step further: you do NOT expose the "JK BMS" SOC anymore but you fully control how the SOC is calculated by yourself (e.g. doing Coulomb Counting / Capacity = Integral of Current, and then when at say 55.2 VDC for > 0.5h AND Tail Current < [X] ADC AND Balancer OFF, then you do a SOC = 100% Reset / Recalibration) ?
 
Last edited:
In the case of a large load on the inverter the Rebulk V. would probably be reached more quickly so these two conditions would be complementary.

I added it to the version being tested at home. This will be part of version 1.4.2.

complementary ==> OR of the two conditions right ?
So idea is to start bulk charging when either Voltage is <= Rebulk Voltage threshold OR SoC <= new threshold (80% default)
 
I can understand that now (especially with multiple Batteries) your code will calculate a "Global SOC" so you can of course "manipulate" (in a positive Way ;) ) and filter out these BUGs by the JK BMS Board.

Or do you mean that now, with your code, you even might go a Step further: you do NOT expose the "JK BMS" SOC anymore but you fully control how the SOC is calculated by yourself (e.g. doing Coulomb Counting / Capacity = Integral of Current, and then when at say 55.2 VDC for > 0.5h AND Tail Current < [X] ADC AND Balancer OFF, then you do a SOC = 100% Reset / Recalibration) ?

This is already the case, the SoC is slightly manipulated. The goal was above all not to send 100% before the end of charging (EOC status) because some inverters stop charging with an SoC of 99 or 100%. For this reason the SoC does not go higher than 98% during charging.

YAML:
  # +--------------------------------------+
  # | Battery State of Charge (SOC)        |
  # +--------------------------------------+
  - platform: template
    name: ${name} ${yambms_name} Battery SoC
    id: ${yambms_id}_battery_soc
    unit_of_measurement: "%"
    device_class: battery
    update_interval: ${yambms_update_interval}
    accuracy_decimals: 0
    filters:
      - or:
        - throttle: 10s
        - delta: 1
    lambda: |-
      float soc = id(${yambms_id}_state_of_charge).state;
      float min_cell_v = id(${yambms_id}_min_cell_voltage).state;
      float cell_uvpr = id(${yambms_id}_cell_uvpr).state;
      if (min_cell_v <= cell_uvpr) return 0;                          // Real 0% Sending 0%
      else if (soc < 1) return 2;                                     // False 0% sending 2%
      else if (soc < 99) return soc;                                  // SOC < 99% => Sending BMS SOC
      // Useful for some inverters, will not send 100% until charging is complete
      else if (id(${yambms_id}_eoc) == true) return soc;              // End Of Charge => Sending BMS SOC
      else return 98;

I think it would be useless to carry out a real SoC calculation function if the input parameters are not reliable. If you consider the JK SoC unreliable then the same goes for current measurement.

The best solution is to add a reliable measuring shunt.
 
The best solution is to add a reliable measuring shunt.
Yeah ... I'm still in doubt where to install it though (as mentioned before). Not much space in each battery. And not sure there is much space left on the Wall :( .

But "do I really need it" is the Primary Question I guess :unsure:.
 
I don't think this is really necessary, it might be a little more precise.
I know. But Coulomb Counting is mainly an Issue if the offset is "big" (compared to the Actual Value). You are integrating an Offset essentially.

So two Factors will influence that:
- Offset Value (and in relation to the Actual Value)
- Integration Time Period

If your Offset is say 1A, integrated over Time that yields 1 Ah/h or 24 Ah/day. For 280Ah cells that's roughly 10% Error/A/day.

Just taking the 2 Examples we provided as a "Case Study" ... I'd say your 150W Case would get more benefit for an accurate shunt, while mine is like ... "nice to have but does it really matter if I have 98% or 90% left ?" 😅.

My Case with 1.2kW Base Load
This is approx. ~ 20 ADC TOTAL, ~ 10 ADC/Battery, 1A offset is around 10% Error/A for each Battery.
(we agree in reality Offset might be much higher, it's just to keep it easy for Calculations :) )

I force charge at the End of Each Day usually (not always hitting 100% Charge but quite close).
Similarly I have a Charger in parallel to the Battery "forcing" a minimum Voltage (51 VDC), in case the Battery tries to go lower.
Usually I do 1 Cycle/Day, could be 2. In the Future maybe slightly better as I add more Batteries in parallel of course :).

Your Case at 150W Base Load
This is approx. 0.15 kW ~ 3 ADC TOTAL. 1A Offset / 3ADC Total is already like 25-33% Error/A (depending how you look at it).
(we agree in reality Offset might be much higher, it's just to keep it easy for Calculations :))

You probably don't force charge / ensure minimum Voltage through external means (maybe through the Deye Inverter though ?).
You can go several days without doing a "full cycle" (or close to). So your Integration Time is much longer for sure (thus any Offset will "accumulate" much more).

So essentially in your case, Offset/Value [in %] is higher than mine AND your integration time [in s/h/days] is longer, i.e. any improvement in accuracy would be significantly important in your case compared to e.g. mine.

Feel free to correct if disagreeing (y).
 
The "rebulk" SoC condition could help by forcing the system back into bulk charging, thereby aiding in battery balancing.
You don't have to cave in to the battery balancing bloat floating on the Internet.
Battery balance doesn't come into equation until at the very end of the a charge cycle.

You can float cells for months and then have them balanced at the end with a full-charge cycle in hours. Most of us have fast active balancers anyway. There is no need to worry.
 
Just wanted to report back that multi-bms BLE is still working fine with two JKs. Unfortunately have not been able to get back to the cabin to add the 3rd BMS. ESP32 does reboot occasionally but no impact.
 

Attachments

  • IMG_5810.jpeg
    IMG_5810.jpeg
    89.5 KB · Views: 0

diy solar

diy solar
Back
Top