Skip to content

[TEST] BMW i3 SOC Havrla - CI build check - #2

Draft
mbuhansen wants to merge 3 commits into
mainfrom
feature/SOC-havrla-rebased
Draft

mbuhansen wants to merge 3 commits into
mainfrom
feature/SOC-havrla-rebased

Conversation

@mbuhansen

Copy link
Copy Markdown
Owner

Test PR in the fork, only to let CI build all environments (including lilygo_330 / T-CAN485 with SMALL_FLASH_DEVICE) before opening the real PR upstream. Not for merging.

  • 2a662f0: SOC Havrla + pack resistance estimation, rebased on upstream/main
  • 1b8f63f: compiled out under SMALL_FLASH_DEVICE

Not tested on hardware.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Firmware size report

Base: 79b6626 on main · This PR: f30bf55

Board New size Max % Flash Δ Flash
Lilygo T-CAN485 1,854,599 1,966,080 94.33% +244
ESP32 DevKit V1 1,796,579 1,966,080 91.38% +244
Stark CMR 1,968,459 3,342,336 58.89% +5,064
DFRobot Edge101 2,023,567 6,553,600 30.88% +5,516
Waveshare ESP32S3RS485CAN 1,953,218 6,553,600 29.80% +5,100
Lilygo T-2CAN 1,946,076 6,553,600 29.69% +5,032
BECom ES32S3 1,942,444 6,553,600 29.64% +5,048

To test this firmware on your device:

  1. Make sure you're logged into GitHub
  2. Click the link above corresponding to your hardware type
  3. Download the .ota.bin file for your board
  4. Upload the .ota.bin via OTA

mbuhansen and others added 3 commits October 9, 2026 19:38
…stimation

- Estimate pack internal resistance from load steps (signed dV/dI, EWMA)
- Voltage-based SOC (SOC Havrla) using per-chemistry 60/94/120Ah lookup tables
- New setting BMWI3SOCHAVR: Disable / Auto (use Havrla if >3% off) / Enable
- Show internal resistance and SOC Havrla on the battery page

SOC logic ported from Adam Chyský's field-tested version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The resistance estimation, SOC lookup tables, the BMWI3SOCHAVR setting and
its web UI are compiled out under SMALL_FLASH_DEVICE (LilyGo T-CAN485).
There the BMW i3 keeps using the BMS SOC as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port of Adam Chyský's final version (internal 10.4.0.21), tested on
60/94/120Ah packs in full SOC Havrla mode:

- Fix the sign of the current correction: OCV = V - I*R (charging
  current is positive), and fade it out over the last 0.5 % near 0/100 %
- Keep the SOC filter state per battery instance instead of a function
  static, so a double i3 setup no longer shares one filter
- Within +-5 % move at most 1 %/min and never against the current
  direction; outside that window use the faster EWMA
- Fix the resistance estimate scaling (|dV|/|dI|, 1 Ohm = 100000 uV/dA)
  and seed its EWMA from the 80 mOhm default; retune step detection
- Adjust the top of the 60Ah table and the IR offset (-10 mOhm)

While SOC Havrla is set to Auto or Enable it also:
- reports SOC in whole percent with 1 % hysteresis
- adds cell voltage based charge/discharge current limits per pack size
  and a SOC based charge limit near full; they only lower the BMS limits
  and are released by at most 1-2 A/min

With SOC Havrla disabled the BMW i3 behaves as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mbuhansen
mbuhansen force-pushed the feature/SOC-havrla-rebased branch from 1b8f63f to f30bf55 Compare October 9, 2026 18:17
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.

1 participant