-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[Power] Option to reduce charging limit for increased battery longevity #1158
Comments
Hi. It is possible to limit target battery voltage(with charger settings) and make another set of params for gauge(or leave gauge with current params). |
Thank you for your feedback! I understand it not being a priority. Knowing you're not opposed to accepting a pull request of sufficient quality, this might be a good opportunity for me to try to learn a manageable subset of every layer in the Flipper firmware (UI, abstractions, hardware control, etc). Meanwhile, if anyone else sees this open issue, feel free to experiment - it likely will be a long while before I have the time to dig into this. |
Minor design updateI've been pondering how to implement this in a way that reduces support requests from folks turning on the feature and forgetting about it. So far, I've drafted the following change to the battery icon design when charge limiting is enabled:
In the above example, the charge is limited to 80% (i.e. 20% of the battery is "grayed out"). This would be drawn inside I'll dig into the code side when I have time to set up the build environment and tinker - I'm expecting to change the charging profile (translating the percentage limit into a reduced battery voltage limit), but not change the charge gauge. |
Feedback request - preferred charge limit method?There's two reasonable methods I've managed to come up with to implement battery charge limiting:
Flipper developer team - what would you prefer? I'm leaning towards option #2 given the complexity of #1 involving coordinating the charge limit via both the charging chip and the battery gauge chip, but I'm happy to try that option if preferred. I'm open to other methods, too. It's quite possible I overlooked pros and cons in either solution! Additional context - Linux battery charge limitThe Linux kernel battery charge limit interface operates on start/stop percentages via System76 have implemented battery charge limiting in their open embedded controller firmware for their Linux laptops using battery charge percentage rather than directly setting the battery charge voltage. This most closely matches option #2 - software/firmware charge limiting instead of hardware (IC) limiting. Details for battery charge/gauge chipsNOTE: This does not apply for method #2, where the Flipper Zero firmware intervenes to limit charging below 100%. ℹ Click/tap to show all the details about the bq25896 and bq27220I've finally gotten a local firmware build set up using Podman instead of Docker (no daemon running as root), so I've looked into this more…
|
Bit | Field | Type | Reset | Description |
---|---|---|---|---|
7 | VREG[5] |
R/W | by REG_RST & Watchdog |
512mV |
6 | VREG[4] |
R/W | by REG_RST & Watchdog |
256mV |
5 | VREG[3] |
R/W | by REG_RST & Watchdog |
128mV |
4 | VREG[2] |
R/W | by REG_RST & Watchdog |
64mV |
3 | VREG[1] |
R/W | by REG_RST & Watchdog |
32mV |
2 | VREG[0] |
R/W | by REG_RST & Watchdog |
16mV |
Charge Voltage Limit
Offset: 3.840V
Range: 3.840V - 4.608V (110000
)
Default: 4.208V (010111
)
Note:
VREG >110000
(4.608V) is clamped to register value110000
(4.608V)
Interpretation
The bq25896
defaults to a charge voltage limit of 4.208V (010111
) as noted above. The charge voltage limit gets set by taking the binary components and adding them up.
NOTE: If you're tinkering with the charging voltage limit, do not exceed 4.2V without taking precautions should the lithium battery fail and/or catch fire. I am not yet sure what additional protective circuitry, if any, is included in the Flipper Zero, so it is possible you could start a fire with toxic fumes.
Charge Voltage Limit register
Decimal = Binary | VREG[5] (512mV) |
VREG[4] (256mV) |
VREG[3] (128mV) |
VREG[2] (64mV) |
VREG[1] (32mV) |
VREG[0] (16mV) |
Resulting charge limit |
---|---|---|---|---|---|---|---|
0 = 000000 (minimum) |
0 |
0 |
0 |
0 |
0 |
0 |
3.840V |
6 = 000110 (an example) |
0 |
0 |
0 |
1 |
1 |
0 |
3.936V |
23 = 010111 (bq25896 default) |
0 |
1 |
0 |
1 |
1 |
1 |
4.208V |
Calculation:
3.840 + 0.512×VREG[5] + 0.256×VREG[4] + 0.128×VREG[3] + 0.064×VREG[2] + 0.032×VREG[1] + 0.016×VREG[0]
It's not possible to reduce the charge voltage limit below 3.840V without having the Flipper Zero actively monitor and pause charging (currently, the charge voltage limit appears to be completely handled by the bq25896
IC).
Lithium-Ion Capacity vs Longevity
This is copied from the Battery University page on prolonging lithium-based batteries.
Table 4: Discharge cycles and capacity as a function of charge voltage limit
Charge Level* (V/cell) | Discharge Cycles | Available Stored Energy** | Editor's note |
---|---|---|---|
[4.30] | [150-250] | [110%-115%] | Potentially unsafe, do not use |
4.25 | 200-350 | 105-110% | |
4.20 | 300-500 | 100% | Flipper Zero, most smartphones, etc |
4.15 | 400-700 | 90-95% | |
4.10 | 600-1,000 | 85-90% | |
4.05 | 850-1,500 | 80-85% | |
4.00 | 1,200-2,000 | 70-75% | |
3.90 | 2,400-4,000 | 60-65% | |
3.80 | See note | 35-40% | |
3.70 | See note | 30% and less |
Every 0.10V drop below 4.20V/cell doubles the cycle but holds less capacity. Raising the voltage above 4.20V/cell would shorten the life. The readings reflect regular Li-ion charging to 4.20V/cell.
Guideline: Every 70mV drop in charge voltage lowers the usable capacity by about 10%.
Note: Partial charging negates the benefit of Li-ion in terms of high specific energy.* Similar life cycles apply for batteries with different voltage levels on full charge.
** Based on a new battery with 100% capacity when charged to the full voltage.Most chargers for mobile phones, laptops, tablets and digital cameras charge Li-ion to 4.20V/cell. This allows maximum capacity, because the consumer wants nothing less than optimal runtime. Industry, on the other hand, is more concerned about longevity and may choose lower voltage thresholds. Satellites and electric vehicles are such examples.
For safety reasons, many lithium-ions cannot exceed 4.20V/cell. (Some NMC are the exception.) While a higher voltage boosts capacity, exceeding the voltage shortens service life and compromises safety. Figure 5 demonstrates cycle count as a function of charge voltage. At 4.35V, the cycle count of a regular Li-ion is cut in half.
bq27220
- battery gauge/health
This chip measures the battery capacity, health, and tracks the current flowing in and out of the battery to provide a percentage remaining.
Of note, Flipper relies on the bq27220
's RelativeStateOfCharge()
(0x2C
) to get the battery charge percentage from 0-100%.
The datasheet for Texas Instrument's bq27220
("Single-Cell CEDV Fuel Gauge") goes into the electrical and design considerations of the chip. To see the actual commands for interacting with the chip, one must turn to the bq27220 Technical Reference Manual. Section 4.4.1 Detecting Charge Termination
on page 49 describes how to determine whether the battery is charged:
Datasheet on Detecting Charge Termination
For proper fuel gauge operation, the cell Charging Voltage must be specified by the user.
The fuel gauge detects charge termination when:
- During two consecutive periods of 40 seconds, the AverageCurrent() < Taper Current.
- During the same two periods, the accumulated change in capacity must be > 0.25 mAh.
- Voltage() > Charging Voltage – Taper Voltage.
When this occurs, the BatteryStatus()[FC] and [TCA] bits are set depending on the SOC Flag Config A [FCSETVCT] and [TCSETVCT] options. Also, if the CEDV Configuration [CSYNC] bit is set, then RemainingCapacity() is set equal to FullChargeCapacity().
Interpretation
Flipper does not set CSYNC
, so RemainingCapacity()
is not being set equal to FullChargeCapacity()
on reaching the charge limit.
Instead, Flipper waits for RelativeStateOfCharge()
to reach 100%.
To keep this working with a voltage-based battery charge limit:
-
The battery gauge's Charging Voltage would need updated and
CSYNC
would need enabled -
Flipper would need to manually map the charging voltage limit to the relevant state of charge percentage.
Datasheet on Charging Voltage
If going for option #1 above, adjusting the battery gauge's Charging Voltage, section 2.21 Charging Voltage
on page 24 describes some detail:
ChargingVoltage(): 0x30 and 0x31
This read-only function returns an unsigned integer value of the desired charging voltage of the battery. A
value of 65,535 indicates that the battery is requesting the maximum voltage from the battery charger.
As this value is read-only, the configuration must be specified as part of the Flipper's bq27220_init()
function within Control_ENTER_CFG_UPDATE
/Control_EXIT_CFG_UPDATE_REINIT
, involving resetting the battery gauge chip whenever the charging voltage limit is adjusted and when the Flipper Zero loads settings from internal storage.
Section 3.4 Data Memory Summary
on page 29 provides the Charging Voltage
configuration parameter:
Class | Subclass | Address | Name | Type | Min Value | Default | Units |
---|---|---|---|---|---|---|---|
Configuration | Charge | 0x91FD | Charging Voltage | I2 | 0 | 4600 | 4200 |
Of note, this is separate from the gauge configuration and requires additional initialization code.
How to reconfigure charging voltage
…as this was already getting quite long, I stopped looking at this point. I'm happy to continue if this is the preferred method.
Couple things:
In my opinion battery life prolongation in that way is not worth it. |
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Firstly, thank you for taking the time to read and respond! I appreciate all of you are very busy and the work y'all have done is awesome! I've experimented further, successfully tested changing the charger configuration, and tried to better explain myself. I expected to be doing the work to implement this, I just want to make sure I'm pursuing the right path. Usefulness of charge limitingRationaleI agree with you for folks who are carrying their Flipper with them everywhere (akin to a mobile phone), and/or not paying as close attention to the battery level. The bigger concern for them is discharging the battery too far. The current behavior is a good default! In my case, though, I don't travel much, so I'd find it easier to leave the Flipper connected to USB power (via a charger or my computer for the serial console) and just disconnect when I go somewhere, ensuring I never have to think about keeping the battery from discharging too much. However, with the current battery charging behavior, keeping the Flipper plugged in would try to continually keep the battery at near full charge - 4108mV to 4208mV (based on 6+ years is a long time, but I tend to use electronic devices longer than average (e.g. I daily-drive a 2014 laptop where the battery has degraded to "70% health", which actually means "about 45 minutes usage at low brightness with little warning before hard shutdown"). If the Flipper battery was easily replaceable, I wouldn't be as concerned, but from watching a teardown video the battery appears to be buried in the middle of the device, with delicate components, plastic clips, tiny screws, and a bit of adhesive in the way. Battery manufacturer/model?Can you share the battery manufacturer and model so I may look up the cell datasheet? I couldn't find the details in the Flipper hardware documentation. (I recognize you might not be allowed to share the actual datasheet, but I might be able to find it online.) Optional contextCell manufacturersI ask since the datasheets for some well-regarded high capacity lithium-ion cells (see "18650 The good cells") make note of reducing charging voltage for use cases where staying charged is more common:
"As shipped from factory" storage charge is too low for daily use, but even a 3.8v charge - the lowest the Higher-end round cell chargers do have a "storage" mode that charges to about 3.8v - see "Store" near bottom. With this in mind, and considering Table 4 on the more general Battery University page, it seems that limiting the charge to 4.00v or so if one frequently connects (or stays connected) to a charger could meaningfully increase the battery longevity. Device manufacturers using cellsOther device manufacturers have implemented methods to try to adapt to folks who tend to leave things plugged in: Dell implemented an adaptive charging algorithm that tracks whether one tends to keep a Dell laptop plugged in versus unplugging and discharging often, and it will reduce the maximum charge if it's normally plugged in: Reddit link with linked photos, Dell support forums. Apple implemented an automatic 80% charge limit that keeps their devices from charging to 100% overnight until right before when it'd normally be unplugged. Google implemented a less intelligent version that operates by scheduled alarms - see "Charge steadily overnight". Both Apple and Google also automatically detect when their devices are plugged in for a few days and limit the maximum charge. An automatically adapting charging algorithm might be complicated to implement in the Flipper Zero firmware, but a simple way to express "I frequently leave my Flipper connected to the charger/USB so it's kept topped up" versus "I primarily use my Flipper on the go and frequently drain the battery" might be straightforward enough. Method of charge limiting: changing charger configurationYour preference makes sense, and I'll focus on that. In hindsight, I was overcomplicating matters. If combined with a generally applicable pull request to also check the charging IC if it says charging is done, it's very straightforward for me to hard-code a charging voltage limit: @@ -56,6 +56,12 @@ void bq25896_init(FuriHalI2cBusHandle* handle) {
furi_hal_i2c_write_reg_8(
handle, BQ25896_ADDRESS, 0x02, *(uint8_t*)&bq25896_regs.r02, BQ25896_I2C_TIMEOUT);
+ // FIXME: Hard-coded hack to test, move this to an actual function later
+ // WARNING: Do NOT go above 0x17 (23 decimal) - that will overcharge the battery!
+ bq25896_regs.r06.VREG = 0x00; // Charge Voltage Limit: 3840 mV (offset: +3840mV)
+ furi_hal_i2c_write_reg_8(
+ handle, BQ25896_ADDRESS, 0x06, *(uint8_t*)&bq25896_regs.r06, BQ25896_I2C_TIMEOUT);
+
bq25896_regs.r07.WATCHDOG = WatchdogDisable;
furi_hal_i2c_write_reg_8(
handle, BQ25896_ADDRESS, 0x07, *(uint8_t*)&bq25896_regs.r07, BQ25896_I2C_TIMEOUT); (Without the aforementioned pull request, this method of implementing the charging limit works, but the charging LED stays red instead of turning green to signal that the The question then becomes if enough folks prefer to keep their Flippers on a charger/controlled via USB for integrating this into the Flipper firmware. I'm happy to put in the effort to add a setting, UI to control it, and some "charge voltage is limited" graphical interface indicator to minimize support hassle, plus going back-and-forth to ensure the code meets all standards. However, I'd understand if you/Flipper team are not open to accepting any code that implements this - all code does have a maintenance burden. EDIT 2022-7-7It may also be reasonable to automatically disable the charging limit if the battery level ever reaches shutdown levels ( |
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Design version 2I'm taking another look at this since, after recent firmware changes, charge limiting is now the only reason I'm building my own firmware instead of using the official builds. Following @skotopes 's advice, I've focused on adjusting the I'm open to feedback or suggestions. I'll look at incrementally implementing this as a new pull request built on top of my pull request to also check the charging IC if it says charging is done.
|
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Work-in-progress firmware buildI have implemented all the non-configuration graphical changes in my As the settings aren't yet implemented, it is currently hard-coded to I'll try to look into creating a power settings configuration soon (it's more complicated than I initially expected). I'll also want to add the automatic disabling of charge limiting if the battery level ever drops to critical. Here's some live screenshots:
|
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Design revision 2.1After further thought, this is a confusing setting to expose as just NOTE₁: I have not yet implemented this; the Modifying the Power application to implement settings involves significant changes to the application (e.g. using a message queue, mimicking the Notification app which manages LED/LCD brightness), so I want to check if I'm going the right direction first. I welcome any feedback on the preferred way to modify the Power app to support loading/saving Power menu adds configuration, revised
NOTE₂: The The The AC power cord icon will be added as a new asset. The battery icon is copied from the Battery Info screen. This scene/view will involve custom canvas drawing calls, similar to the I removed the |
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Brief update for those following alongAnother contributor has already refactored the Power application to support saving/loading settings. If merged, their work would simplify my task as I'd just need to focus on the new UI and the new setting. However, if the Flipper team decides that the minimum 4Kb internal storage cost to add two settings (that pull request plus my future pull request) is too expensive for the Flipper's limited internal storage, then this feature might not be practical for me to add. Without settings, it would only be a temporary change (being reset to 4.2v on every reboot). I'll continue to plan and implement, but I might wait for the Flipper developer team to decide on whether they'll allow the storage cost of adding the |
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. This adds a new function to the API: furi_hal_power_is_charging_done() Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. This adds a new function to the API: furi_hal_power_is_charging_done() Helps with flipperdevices#1158.
Awesome work! |
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. This adds a new function to the API: furi_hal_power_is_charging_done() Helps with flipperdevices#1158.
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. This adds a new function to the API: furi_hal_power_is_charging_done() Helps with flipperdevices#1158.
@D0han I think a one-off option to fully charge the Flipper while keeping charge limiting enabled is a good idea. However, to help keep this task manageable, I don't think I'll be implementing that in my initial pull request. When I've implemented the current design, it will be possible to manually set the charge limit to 4.2v to fully charge, then when you head off on the trip, set the limit back down when unplugging - no need to wait for the Flipper to discharge. Hopefully, the lack of the crosshatch pattern on the desktop battery capacity bar will help with remembering that the charge limit is not enabled. |
Also check the actual charge controller bq25896's CHRG_STAT to see if charging is complete. Don't only rely on the battery fuel gauge bq27220 reaching 100% to indicate charging is finished. This more accurately reflects the actual charging status and simplifies optionally reducing the battery charging voltage limit. Keeping the fuel gauge check ensures that dis/connecting from USB will still show as fully charged at default settings (no charge limit), since the bq25896 takes a few seconds to detect charging is complete. This adds a new function to the API: furi_hal_power_is_charging_done() Helps with flipperdevices#1158. # Conflicts: # firmware/targets/f7/api_symbols.csv
For anyone following along, I've gotten everything except for the actual configuration UI implemented in PR #2063, "power: Add API to get/set battery charging voltage". EDIT: the API pull request has been merged! Now the Power settings UI needs implemented. If you build that pull request, you can then add and build your own custom tiny Flipper application or service (as described in the verification steps) to set the battery charging voltage limit. I'll add the integrated settings UI once PR #1647, "Automatic shutdown on idle" is merged, providing the settings loading/saving backend. If you have the know-how to build the firmware yourself, help with testing would be appreciated. |
@skorokithakis Since you asked, here's the details on charge voltage limiting: Right now, it requires building either a service integrated to the system (my temporary approach), which will work on reboot but means maintaining your own builds, or you can write a standalone third-party Flipper App to call the API for you (not tested). My changes for system-level integration are here, setting a quite reduced 3.9v (always plugged in): There's some old screenshots in the initial API PR: |
Ah, I was hoping there would be a console command, but I will try to write an app, thanks! |
Is your feature request related to a problem? Please describe.
From what I understand, lithium batteries wear out over time, and using and storing lithium batteries at full charge (e.g. 4.2v) can result in the battery wearing out faster.
Since the Flipper Zero's battery is not easily replaceable (requires disassembly), I'd like to take steps to ensure it degrades as little as possible when I don't need the full battery capacity.
Describe the solution you'd like
Provide an option in
Settings
→Power
to reduce the maximum allowed battery charge for sake of battery longevity.For example,
Charge limit: 100%
, adjustable down to60%
or so in 10% decrements.Alternatively, just provide a few charging profiles (
Full Charge
,Balanced
,Max Lifespan
) corresponding to 100%, 80%, and 60% or so (see System76's UI in additional context).Implementation details:
Flipper's firmware currently can pause charging with
furi_hal_power_suppress_charge_enter()
andfuri_hal_power_suppress_charge_exit()
.Alternatively, it appears there may be a way to adjust the bq25896 regulator's voltage limit via
VREG
inREG06
. If feasible, lowering that may avoid requiring having the Flipper firmware actively toggle suppressing the charging circuitry.Either way, the Desktop UI's battery indicator should probably show that the battery charge is limited to avoid potentially confusing folks.
Describe alternatives you've considered
Additional context
There's ongoing research around battery charge thresholds and various devices and software exists to control this on other platforms. It'd be nice if Flipper could integrate this without needing a third-party workaround.
The text was updated successfully, but these errors were encountered: