Skip to content

Update fuel gauge config v3 #5550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

kopecdav
Copy link

@kopecdav kopecdav commented Aug 14, 2025

This PR brings quite significant improvements to the fuel gauge estimator.

1) Updated battery model

The battery model (battery_model.h) was adjusted to distinguish between temperatures for charging and discharging. When creating the OCV curves during battery identification, we link each curve with a specific temperature so the fuel gauge can look up and interpolate between them.

Previously, we extracted a single temperature for both charging and discharging curves from a given chamber test as the mean value of all NTC measurements, but this was not very accurate. In general, the battery temperature is higher by ~2-3°C when charging in the same ambient temperature because of self-heating from the charging current. Using different temperature lookup tables for charging and discharging scenarios should compensate for that offset.

2) More accurate identification data

The updated JYH battery model battery_data_jyhpfl333838.h is composed of updated battery characterization data from the tool introduced in #5536 and a more precise battery dataset captured with an automated tool on 5 parallel fresh battery samples across a wider temperature range of 5-40°C.

3) Fuel gauge parameters update

The PR also updates the Fuel Gauge R and Q parameters. The previous version showed great results in simulation, but we observed quite different behavior on the physical device. This was very likely due to different sampling rates – while on the device we sample data and update the fuel gauge estimation every 100ms, in the simulator we used data sampled every 1.3s. In such cases, we need to scale the Q parameter properly.

@kopecdav kopecdav requested a review from cepetr August 14, 2025 11:06
@kopecdav kopecdav self-assigned this Aug 14, 2025
@kopecdav kopecdav added the T3W1 label Aug 14, 2025
@github-project-automation github-project-automation bot moved this to 🔎 Needs review in Firmware Aug 14, 2025
Copy link

github-actions bot commented Aug 14, 2025

en main(all)

model device_test click_test persistence_test
T2T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3B1 test(all) main(all) test(all) main(all) test(all) main(all)
T3T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3W1 test(all) main(all) test(all) main(all) test(all) main(all)

Latest CI run: 17126599648

@kopecdav kopecdav marked this pull request as ready for review August 20, 2025 15:51
@kopecdav kopecdav requested a review from TychoVrahe as a code owner August 20, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🔎 Needs review
Development

Successfully merging this pull request may close these issues.

1 participant