Skip to content

Feature: Byd Auto SOC Calibration#2241

Open
demon1300 wants to merge 9 commits into
dalathegreat:mainfrom
demon1300:feature/byd-atto3-auto-soc-calibration
Open

Feature: Byd Auto SOC Calibration#2241
demon1300 wants to merge 9 commits into
dalathegreat:mainfrom
demon1300:feature/byd-atto3-auto-soc-calibration

Conversation

@demon1300
Copy link
Copy Markdown
Contributor

@demon1300 demon1300 commented Apr 19, 2026

What

This PR implements automatic SOC recalibration to 100% for the BYD series of batteries, triggered when the pack has been held at tail current for a sustained dwell period of 10 minutes and the reported SOC has drifted beyond a configurable threshold (in the more battery info page).

Why

The BYD packs drift their SOC gradually over time (tends to be around 1% per day). Without any SOC calibration, usable capacity is reduced over time. The existing manual SOC calibration via the WebUI requires user intervention each time — this automates it safely under tightly gated conditions.

How

  • Monitors charge taper progress and current direction; starts a 10-minute dwell timer once the slewed current cap reaches the tails current (which as been increased to 1A) and actual charge current is below 3A. If the tail current isn't held for 10 minutes (due to discharge etc) then the timer resets.
  • Fires the existing UserRequestCalibrateSOC state machine when all conditions are met simultaneously: dwell elapsed, SOC drift exceeds the configured threshold, contactor closed, no manual request in progress, and a 1-hour cooldown has passed. It also copies the exisitng batteries "capcity current" so as to not modify the reported battery SOH value when the SOC is written back.
  • Adds a toggle in the more battery info page to turn on and off (defaults to on).
  • Adds a drift percentage variable so you can set the threshold of how much drift is acceptable before it will trigger an SOC recalibration which also saves and is persistent with a reboot (The default for this is 5%).
  • Logs an event into the 'Events' page labelled EVENT_BYD_AUTO_SOC_CALIBRATION and logs the data drift percentage at the time of firing.

@btoonen
Copy link
Copy Markdown

btoonen commented Apr 30, 2026

I am looking forward to have this integrated and working. i am trying to install your code to try it. but have not yet succeeded. i am a rookie with github. thanks for your work. this will make my byd atto 3 battery paired with the sma stp 10.0 hybrid working without intervention.

@demon1300
Copy link
Copy Markdown
Contributor Author

I am looking forward to have this integrated and working. i am trying to install your code to try it. but have not yet succeeded. i am a rookie with github. thanks for your work. this will make my byd atto 3 battery paired with the sma stp 10.0 hybrid working without intervention.

Try the instructions here and let me know if you need more info 👍
https://github.com/dalathegreat/Battery-Emulator/blob/main/CONTRIBUTING.md#downloading-a-pull-request-build-to-test-locally-

@btoonen
Copy link
Copy Markdown

btoonen commented May 11, 2026

Thank you Demon. and sorry for taking this long. i managed to download your firmware and install it. i am testing if the autocallibirate wil work. can i do something specific to help the project further?
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants