diy solar

diy solar

DIY Battery via Smart shunt to inverter integration (Solis etc)

I have a very interesting discovery to share...

...Yes, I am being purposfully long winded here haha....

...But as mentioned the current is summed.

But you've still kept us in suspense... did you wire the shunts in serial or parallel :unsure: ;) :ROFLMAO:
 
So here we go, a version of the new code that works, it's a bit bloated so over the next few weeks I'll be working on efficiency and stability.

Please note it does get upset and can reboot itself, but that is when your in the web browser, am aware of it and looking in to it, if it does reboot it has just come back online without needing any interference.

Once you've done your setup I'd suggest closing the browser and not leaving it open all the time.

Note, if a page has Save to EEPROM then your changes in the window are not saved and will be lost on reboot, so make sure you click Save.

I need to create notifications to show that your changes have been saved, at the moment it does show you.

The code is now at: https://github.com/sijones/DiyBatteryBMS.git

I reworked the pylontech protocol code, implementing the strict version and still the Solis inverters don't seem to understand it and only the workaround version works.

Don't get upset at me if your house burns down, your BMS on the battery packs should be configured to save them, i.e. cut off, if over or under charging voltages.

After some efficiency and performance improvements, I will be adding a automatic current limiting by voltage, this will mean once a battery voltage is hit the charge current will be reduced to keep the voltage steady.

Any bugs, put them in the issues of my github, i'll look at them during dev time. and the wife lets me :)

P.S. Once flashed with this release, you'll be able to update using Firmware.bin files that will be available on github and be able to update using ipAddress/update - note at the moment this window says "send me a donation" or "buy me a coffee", that doesn't go to me, that is for the dev of the updating library.
 
OK just aheads up, after a couple of days I seem to have hit a load of mqtt data corruption, not sure if it's the data in or the way it's being handled by the mqtt library.

Currently looking in to it urgently.
 
What a week it's been!

After a huge amount of effort to try and find the issue it turns out it wasn't my code, it's the libraries used underneath for the network communications, specifically me-no-dev/asyncTCP and anything built on it.

Trying to replace them took a little while as there was a certain way needed as certain libraires was dependant and caused overlaps.

Anyway, I think it's resolved, i've pushed the fixes to the new GitHub repo and it's running for a while without issue, so fingers cross :)

So, over the weekend I can start to add features that I want and said.

Any feature that you think would suit the software, drop it in here and i'll see.

Added to the feature list is: Multiple probe temp monitors with control of fans forced cooling the inverter and heaters for the batteries.
 
Excited to try the new but the first version (no UI) has been rock solid.
 
How do you use slow charging parameters? What are yours?
It seems anything I enter stops charging completely.

What does "divider" mean in this context?View attachment 214555
I’m not running the UI version but have it defined in code at 90% SOC it ‘divided’ to only charge with 20amps. At 95% SOC it sets charging at 5amps. Gives me a good amount of balance time.
 
I’m not running the UI version but have it defined in code at 90% SOC it ‘divided’ to only charge with 20amps. At 95% SOC it sets charging at 5amps. Gives me a good amount of balance time.
It must not be working. In the GUI version

Im charging at 50 amps currently.
if I put in 20 it stops charging
If I put in 2 it stops
if i put in 80 it stops.
If I populate both setpoints with corresponding values, it stops charging

I have tried decimals but it wont save.

No clue over here :!:~

Hmm, Ill try negative numbers
That didnt work either.
:)
 
It must not be working. In the GUI version

Im charging at 50 amps currently.
if I put in 20 it stops charging
If I put in 2 it stops
if i put in 80 it stops.
If I populate both setpoints with corresponding values, it stops charging

I have tried decimals but it wont save.

No clue over here :!:~

Hmm, Ill try negative numbers
That didnt work either.
:)
My battery is 200ah and defined in code that way. I need the look at the code in my config but here is the source from git. If I understand this, > 90% SOC 200ah/10=charge at 20a. If > 95% SOC 200ah/20=charge at 10a.


if (_battCapacity > 0 && _initialBattData){
if(_battSOC > 95)
_chargeCurrentmA = (_battCapacity / 20);
else if(_battSOC > 90)
_chargeCurrentmA = (_battCapacity / 10);
else
_chargeCurrentmA = _maxChargeCurrentmA;
}
 
My battery is 200ah and defined in code that way. I need the look at the code in my config but here is the source from git. If I understand this, > 90% SOC 200ah/10=charge at 20a. If > 95% SOC 200ah/20=charge at 10a.


if (_battCapacity > 0 && _initialBattData){
if(_battSOC > 95)
_chargeCurrentmA = (_battCapacity / 20);
else if(_battSOC > 90)
_chargeCurrentmA = (_battCapacity / 10);
else
_chargeCurrentmA = _maxChargeCurrentmA;
}
Yeah, that makes sense, but it doesnt work in the gui.
Ill try the code maybe this weekend.
 
ok to use the slow charging feature, you MUST set a battery capacity first of all.

Slow Charge SOC 1 has to be lower than 2.

Below is the example of configuration, I slow down charging at 90% and then again at 95%.

The divider number is by the battery capacity when the SOC is at or above the Slow Charge SOC number.

This has been running on my system for over 12 hours solid, am quite confident in it, but do make sure your running the stable or latest master.
Screenshot 2024-05-11 103303.png
 
Last edited:
I've changed the default partitions of the ESP32 devices to make more space for code.

Make sure your using the release v2 or latest master from the repo, if you don't know how to sync and pull down the changes then let me know and i'll post a how to.

If you have any issues, use the erase flash command in platformio menu and then flash firmware and the build filesystem image.

The build filesystem image is the html code, I may put this in the flash and take away the need for the 2 flashes as it was before i started to understand how you can server web files.
 
All stable now, been running for 24 hours without a hiccup. Just make sure you either use the release i've done 2.0.1 or sync your branch to master now.

P.S. also check out the wiki section on github as i've done a few pages to explain things.
 
Last edited:
Any feature that you think would suit the software, drop it in here and i'll see.

Added to the feature list is: Multiple probe temp monitors with control of fans forced cooling the inverter and heaters for the batteries.

Just an idea for your code when you add the temp monitors...

What I did with my code (which, as you know, was originally derived from yours) was to adjust the charge rate so it is not just based on SOC, but also dynamically based on temperature, in line with the datasheet for my EVE LF280K's. As mentioned here.


eve-lf280k-charge-vs-temperature-profile-png.121396


// otherwise, adjust charge rate depending on batt min temp and SOC
else if (_battTemp < 1)
{
// no charge if temp < 1 degree
chkCatChange(1);
CAN_SetChargeCurrent(0, "Battery temp < 1 degree");
//writeCriticalErrorLogStr("Warning: Charging stopped as battery temp < 1 degree");
}
else if (_battTemp <= 10)
{
if (_battSOC > 90)
{
// no charge over 90% if < 10 degrees
chkCatChange(2);
CAN_SetChargeCurrent(0, "Battery temp <= 10 degree AND battery SOC > 90%");
}
else if (_battSOC >= 70)
{
// if SOC between 70 and 90%; charge at range of 3.5A to 35A = 0.0125C to 0.125C from 1 degree to 10 degrees
// which is less than recommended allowance up to 0.2C at 10 degrees
chkCatChange(3);
CAN_SetChargeCurrent((_maxChargeCurrentmA / 20) * _battTemp, "Battery temp <= 10 degree AND battery SOC between 70% and 90%");
}
else
{
// if SOC < 70%; charge at range of 7A to 70A = 0.025C to 0.25C from 1 degree to 10 degrees
// which is less than recommended allowance up to 0.4C at 10 degrees
chkCatChange(4);
CAN_SetChargeCurrent((_maxChargeCurrentmA / 10) * _battTemp, "Battery temp < 10 degree AND battery SOC < 70%");
}
}
else
{
// battery temp within normal range (i.e. > 10 degrees)


Caveat: Hopefully that code works as designed. But as I also have battery heaters triggered by my code, the lowest temp they have reached is about 17C when it was -5C outside, so it's never been run in anger ;)

I also allow the Solis to "trickle charge" the battery pack up to a pre-defined but configurable max individual cell voltage (3.45V in my case) once the SOC is reported (from the BMS in my case, but from the Smartshunt in yours) as being 100%. This, I found, avoids any drift of the reported SOC the the actual SOC, makes sure a full charge is achieve and gives more balancing time. So what my code does is when it see 100% SOC reported, but cell voltage is below 3.4V, it sends the Solis a 99% SOC CANBus value and a charge rate of just 4A (=batt capacity with a slow charge divider of 70).
 
eve-lf280k-charge-vs-temperature-profile-png.121396



I also allow the Solis to "trickle charge" the battery pack up to a pre-defined but configurable max individual cell voltage (3.45V in my case) once the SOC is reported (from the BMS in my case, but from the Smartshunt in yours) as being 100%. This, I found, avoids any drift of the reported SOC the the actual SOC, makes sure a full charge is achieve and gives more balancing time. So what my code does is when it see 100% SOC reported, but cell voltage is below 3.4V, it sends the Solis a 99% SOC CANBus value and a charge rate of just 4A (=batt capacity with a slow charge divider of 70).
This is a reason for the adding of the Temp probes, but the battery temp would only be a feed for the MaxCurrent, the actual current would vary and reduce as battery voltage rises or falls.

Just to note the Solis has a minimum cut off, so if you go under i think 4a it just stops.

Also, Solis seems to have a restart of charging min of 96%, so if you hit 100 and then change to 99 it may ignore to charge again.
 
This is a reason for the adding of the Temp probes, but the battery temp would only be a feed for the MaxCurrent, the actual current would vary and reduce as battery voltage rises or falls.
(y) yes, I use SOC, temp and voltage as inputs to the charge current.

Just to note the Solis has a minimum cut off, so if you go under i think 4a it just stops.
LOL... yes... been there, done that... 2A doesn't work!

Also, Solis seems to have a restart of charging min of 96%, so if you hit 100 and then change to 99 it may ignore to charge again.
Interesting... maybe that is firmware-related though :unsure:. Our Solis has been switching between 99% and 100% SOC every 30 mins or so, all afternoon.
 
Interesting... maybe that is firmware-related though :unsure:. Our Solis has been switching between 99% and 100% SOC every 30 mins or so, all afternoon.
I think it's following the Pylontech spec, with Pylontech protocol, it says the inverter shouldn't restart charging until under 97%.
 
Back
Top