yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] Droid_Nut:
So, on my Pixel 4 and Pixel 4 XL, I could not get the charging to stop with BCL. So I tried ACC that I have used in the past before I knew of BCL. and it works like a charm. Stops and starts charging using the settings I assigned. Maybe the Dev can use it to figure out why BCL does not work on Pixels any more?
[Android Apps and Games] ezdiy:
For generic mediatek device (tested on really old Redmi6A up to very recent such as VivoX90), you can use the following:

Control file: /sys/devices/platform/charger/input_current

Disable: 0

Enable: ffffffff

This is a canonical way according to kernel driver comment, unless the phone OEM deliberately removes it.

There's also /proc/mtk_battery_cmd some other tools use, but is unreliable - it re-enables charging spuriously.
[Android Apps and Games] Feenix0:
Mine runs the stock international rom.
[Android Apps and Games] blackmennewstyle:
Hello beautiful people,

Some of the links for downloading the .apk are not working, especially the latest version :'(
[Android Apps and Games] simplepinoi177:
Is there a particular reason you can't download "the latest version" from the Google Play Store (linked in the OP)? Is there a particular reason you need an older version?
[Android Apps and Games] blackmennewstyle:
Absolutely, i don't want to install a google account on my phone :)

That phone won't be used for browsing the internet :)

Also, the version currently available in Google App store is 1.1.1, which is the one i want to download but i can't, the link does not work.
[Android Apps and Games] simplepinoi177:
Well....that's an "interesting" decision...I'm curious as to your reason (if it is worth the hassle and/or a reasonable decision)....

Regardless, all the links seem to work for me (both the Google Play Store link and the androidfilehost.com ones). If they were really down, I would suggest you could download it from APKMirror -- the only caveat is that the latest is the 1.1.0 version (about a few weeks before the last update). If you were good with that one, you could download it to a computer or other device, then "beam" (bluetooth, NFC, flashdrive, put on PC and transfer through cord, connect both through a PC, etc.) it to that device to install.

The only thing I can think of as to why you can't get the links to work is something is blocking your connection; host blocking (AdBlock), firewall, router filter. You should re-check on any setting that may related to those and try again.
[Android Apps and Games] fddm:
It's on F-Droid too

Battery Charge Limit | F-Droid - Free and Open Source Android App Repository

Stops charging at a desired level

f-droid.org
[Android Apps and Games] blackmennewstyle:
I made a screenshot to show you my situation. It's not related to some sort of blocking. It just says "no mirrors found".
[Android Apps and Games] blackmennewstyle:
Thank you, your link actually works.
[Android Apps and Games] andrasandhi:
Realme 9 Pro Plus (RMX 3393).

Its different from my previous Realme 6 Pro, so i found myself this.

View attachment 5942065
[Android Apps and Games] deechte:
I can't thank you enough. This works for the Oneplus 11 too!!
[Android Apps and Games] saphta:
Hi, on a Moto G Pure (powered by Mediatek MT6762G Helio G25). App says charging when I plug it in. I set the charge limit to 80 and it was still charging at 81%. Is it possible to add this device to the list?
[Android Apps and Games] fddm:
Try installing the ACC Magisk module and run the command "acc -t". It will test all known strategies and save the results to /sdcard/Download/acc-t_output.txt. You can then add one of the working control files reported in Battery Charge Limit's settings.

You can also just use ACC if you like, it still gets updates and support. Just install ACCA or ACCSettings for a gui similar to Battery Charge Limit's.
[Android Apps and Games] saphta:
I did, got this output:

1/6: /proc/mtk_battery_cmd/current_cmd 0::0 0::1

switch: off (0 1) current: 1mA (Idle)

switch: on (0 0) current: 535mA (Charging)

Switch works ✅

- battIdleMode=true

2/6: /proc/mtk_battery_cmd/current_cmd 0::0 0::1 /proc/mtk_battery_cmd/en_power_path 1 0

switch: off (0 1, 1) current: 3mA (Idle)

switch: on (0 0, 1) current: 542mA (Charging)

Switch works ✅

- battIdleMode=true

3/6: mtk-master-charger/constant_charge_current_max 1980000 0

switch: off (1980000) current: 1mA (Idle)

switch: on (0) current: 463mA (Charging)

Switch works ✅

- battIdleMode=true

4/6: usb/current_max 1500000 0

switch: off (1500000) current: 544mA (Charging)

Switch doesn't work ❌

5/6: mtk-master-charger/constant_charge_current_max 1980000 50000

switch: off (1980000) current: 0mA (Idle)

switch: on (0) current: 590mA (Charging)

Switch works ✅

- battIdleMode=true

6/6: usb/current_max 1500000 50000

switch: off (1500000) current: 588mA (Charging)

Switch doesn't work ❌

I've selected the ones with a green checkmark (one by one) from the above list, and pressed Test the charging switch (from the app), the result: an error has occurred.

Edit: Manually selecting the first profile from the list above stopped the charging at 75% which was the plan. Not sure why the error came up but it works.
[Android Apps and Games] adek89:
Dont work android 12 gsi lineage os
[Android Apps and Games] deechte:
You need to find the

You need to find the proper file and settings. Read the thread.
[Android Apps and Games] UnknownPlanet:
This apps is so good creating control loop sets by the battery percentage which creates hysteresis band outputting switching pulses of charging state to control the BMS. It still crude because of the high current spike at the band limit. But it's okay for now.

I couldn't find of how to change the control loop to voltage instead of battery percentage, how to do that?
[Android Apps and Games] nmajin:
Is there any support for Moto Z3 Play phones? I tried this app (Battery Charge Limit) to limit charging to 80% and it didn't do anything. Properly rooted and all. Also using Pixel Experience 13 ROM.

I could not find anything on the device on how to make this work via some control file:

ls -la /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-00/800f000.qcom,spmi:qcom,pm660@0:qcom,qpnp-smb2/power_supply/battery <
total 0
drwxr-xr-x 3 root root 0 1971-03-17 06:31 .
drwxr-xr-x 9 root root 0 1971-03-17 06:31 ..
-r--r--r-- 1 root root 4096 1971-03-17 06:31 age
-rw-r--r-- 1 root root 4096 1971-03-17 06:31 battery_charging_enabled
-rw-r--r-- 1 root root 4096 1971-03-17 06:31 capacity
-r--r--r-- 1 root root 4096 1971-03-17 06:31 charge_counter
-r--r--r-- 1 root root 4096 1971-03-17 06:31 charge_done
-r--r--r-- 1 root root 4096 1971-03-17 06:31 charge_rate
-r--r--r-- 1 root root 4096 1971-03-17 06:31 charge_type
-r--r--r-- 1 root root 4096 1971-03-17 06:31 charger_temp
-r--r--r-- 1 root root 4096 1971-03-17 06:31 charger_temp_max
-r--r--r-- 1 root root 4096 1971-03-17 06:31 constant_charge_current_max
-r--r--r-- 1 root root 4096 1971-03-17 06:31 current_max
-r--r--r-- 1 root root 4096 1971-03-17 06:31 current_now
-r--r--r-- 1 root root 4096 1971-03-17 06:31 current_qnovo
lrwxrwxrwx 1 root root 0 1971-03-17 06:31 device -> ../../../800f000.qcom,spmi:qcom,pm660@0:qcom,qpnp-smb2
-r--r--r-- 1 root root 4096 1971-03-17 06:31 die_health
-rw-r--r-- 1 root root 4096 1971-03-17 06:31 dp_dm
-r--r--r-- 1 root root 4096 1971-03-17 06:31 fcc_stepper_enable
-r--r--r-- 1 root root 4096 1971-03-17 06:31 health
-rw-r--r-- 1 root root 4096 1971-03-17 06:31 input_current_limited
-rw-r--r-- 1 root root 4096 1971-03-17 06:31 input_suspend
-r--r--r-- 1 root root 4096 1971-03-17 06:31 num_system_temp_levels
-rw-r--r-- 1 root root 4096 1971-03-17 06:31 parallel_disable
drwxr-xr-x 2 root root 0 1971-03-17 06:31 power
-r--r--r-- 1 root root 4096 1971-03-17 06:31 present
-rw-r--r-- 1 root root 4096 1971-03-17 06:31 rerun_aicl
-r--r--r-- 1 root root 4096 1971-03-17 06:31 set_ship_mode
-r--r--r-- 1 root root 4096 1971-03-17 06:31 status
-rw-r--r-- 1 root root 4096 1971-03-17 06:31 step_charging_enabled
lrwxrwxrwx 1 root root 0 1971-03-17 06:31 subsystem -> ../../../../../../../../class/power_supply
-rw-r--r-- 1 root root 4096 1971-03-17 06:31 sw_jeita_enabled
-rw-r--r-- 1 root root 4096 1971-03-17 06:31 system_temp_level
-r--r--r-- 1 root root 4096 1971-03-17 06:31 technology
-r--r--r-- 1 root root 4096 1971-03-17 06:31 temp
-r--r--r-- 1 root root 4096 1971-03-17 06:31 type
-rw-r--r-- 1 root root 4096 1971-03-17 06:31 uevent
-r--r--r-- 1 root root 4096 1971-03-17 06:31 voltage_max
-r--r--r-- 1 root root 4096 1971-03-17 06:31 voltage_now
-r--r--r-- 1 root root 4096 1971-03-17 06:31 voltage_qnovo
[Android Apps and Games] fddm:
Should be supported afaik, weird. I see candidates battery_charging_enabled 1 0 and input_suspend 0 1, but you really should use acc for testing at the very least.
[Android Apps and Games] baggino:
I have rooted xiaomi 13 but the apk does not stop charging at a certain setting, very useful for me when I am with android auto long trips. Please some help
[Android Apps and Games] an-ca:
Hello,

I am trying to understand charging limits implementations on Android (see my other question here). I have in mind the tlp laptop implementation: writing thresholds, no service or background activity "daemon" required.

So far — please correct my if my understanding is wrong —, both this solution and acc rely on watching the battery charge level and stopping the charge at a set threshold when the level reaches that thresold. Some additional work seems to be necessary to ensure the kernel won't restart charging the battery.

Why is this behaviour required?

Why are we not able — if indeed we are not — to implement a similar design as tlp — tlp being in the a simple shell script launched once — which sets a threshold that the "device" will respect?

So far, I'm imagining — and that's where I'm looking for clarifications or confirmations — that such design is imposed by kernel or hardware abstractions which do not offer this notion of charging thresholds.

Thank you for your time,

Anthony
[Android Apps and Games] rodken:
ACC rely on watching the battery charge level and stopping the charge at a set threshold when the level reaches that threshold. This is because the kernel does not provide a way to set a charging limit directly.

As you mentioned about using a simple shell script, but this would require root access and would not be as reliable as a solution that is integrated and a background service and would also require root access and would consume a bit more battery juice than intended.
[Android Apps and Games] SidneyD:
Thank you, this worked perfectly for me :)
[Android Apps and Games] real_milux:
Have a look at my Automate flow script. ;)

Same here...

Nice idea, let's see if I have time to either adapt my flow or enhance the app, now that the latter is open source...

Also thought about this, but there are some problems. The most obvious one is the voltage drop after unplug. Depending on the charging state, this drop can me more or less huge. Furthermore, it can be different for different batteries. The battery percentage algorithm takes all that into account, providing a convenient abstraction without racking one's brain about voltage ranges.

However, I realized problems of this algorithm as well. The battery statistics can be wrong, causing the voltage to be much higher/lower than expected. We wouldn't have this problem for a voltage-based approach...
[Android Apps and Games] mesvam:
Yea, I realized this problem too after posting. I can think of three solutions, depending on capabilities of the device:

(1) The ideal solution is to be be able to set voltage limit in hardware. During normal charging, typically what happens is you have a constant current supply (say 500mA) that has a voltage limit of 4.35V. That means that the charger keep will raising the voltage to the necessary level in order to make 500mA flow into the battery, but never under any circumstances go above 4.35V, even if that means you won't get 500mA anymore. What ends up happening is that charger will supply a constant 4.35V at the end of the charge while current slowly drops to 0. This is what people usually refer to as trickle charge or maintenance charge.

What you want to do, is be able to configure that max voltage, so that voltage limiting kicks in to start the trickle charge earlier. You can only do this with some charge controllers, but phones are pretty advanced so I wouldn't be surprised if it was possible. I found voltage_min, voltage_max_design, voltage_min_design in my battery/ folder (though I don't know if they work or not), so I expect this to be possible for at least some phones.

(2) If not, then limiting the voltage manually could work too. For example, if you set a limit at 4.0V, then when the voltage rises to 4.0V or higher, drop current by 1/2 (500mA -> 250mA). When you drop the current, voltage also decreases, so now you're charging at around 3.95V. Voltage will rise to 4.0V again (since we're still in constant current mode), then you cut the current by 1/2 again (now 125mA). Do this repeatedly, and your current eventually gets set to 0, while voltage goes to 4.0V, effectively imitating a trickle charge. And when voltage drops too far below the set point, then you start doubling the current.

Of course, the ratio can be configurable, so instead of doubling and halving the current, you should be able to choose 1/3/, 2/3, 1/4, etc. any number from 0 to 1, depending on how responsive you want the system to be. Higher number means more fine grained adjustments, but can be unstable from voltage sensor noise. Lower number is slower to reach set point, but more stable.

(3) If current is not configurable, then the only way to do this is to cut the charge at 4.0V. The voltage will drop instantly (let's say to 3.92V) when you stop the charger. Subtract 0.05V from that voltage (3.92V - 0.05V = 3.87V) and let the voltage drop to that level (3.87V) before initiating charging again. When you reconnect the charger again, voltage will rise instantly (to ~3.95V, because we gave it a 0.05V range), then charge up to 4.0V again. This ensures that the voltage never goes above the max point, while not letting cycle too frequently.
[Android Apps and Games] real_milux:
That is pretty much what came to my mind after the last post. Just cut the power, wait for a few seconds, then subtract X from the current voltage and wait until it decreases to that value, then top it up again.

Regarding current modification: Did you perform any experiments about that? Is this really working in the way it is supposed to? I am asking this because afiak, limiting charging current requires special curcuits which cannot be - I might be wrong about that - configured with arbitrary thresholds. So maybe it's a good idea, but in practice you cannot really change anything, even if the file was editable.
[Android Apps and Games] mesvam:
I have a USB power meter, and I can confirm that my USB current can be limited down to 100mA by changing /sys/class/power_supply/usb/current_system_max, so I do have a bit of current control. However, I haven't been able to directly alter the battery charging current, which is not exactly the same thing. (Edit: Apparently battery/input_current_max also controls USB current, not charging current) The voltage regulator means 5V/1A USB power draw could mean 4V/1.25A at the battery, and that's not even accounting for the efficiency of the regulator.

My intuition is that it should be possible with some phones. But even if it's not, USB current control can still work, because the adjustments are relative, in response to voltage. You only need to know if you want to raise or lower current, you don't need to know what the exact current should be. That's the beauty of this method. In the worse case you would just get on/off control. In fact, current control is just a more advanced version of on/off control.

---------- Post added at 12:40 PM ---------- Previous post was at 12:26 PM ----------

I found some interesting documentation on Qualcom chargers (more)that suggests this should be possible:

- qcom,chgr:	Supports charging control and status
reporting.
- qcom,buck:	Charger buck configuration and status
reporting with regards to several regulation
loops such as vdd, ibat etc.
- qcom,chg-misc:	Miscellaneous features such as buck frequency
settings, comparator override features etc.
...

Parent node required properties:
- qcom,vddmax-mv:	Target voltage of battery in mV.
- qcom,vddsafe-mv:	Maximum Vdd voltage in mV.
- qcom,vinmin-mv:	Minimum input voltage in mV.
- qcom,ibatmax-ma:	Maximum battery charge current in mA
[Android Apps and Games] HikingMoose:
Everyone needs to remember this is the OP's app that he's sharing with us. Why's everyone so demanding and act like he has to add their suggestions?
[Android Apps and Games] realista87:
sorry but i am only ok with your last 2 points, and PARTIALLY.

1- the range of 3% is quite standard.... no one would to fall asleep ..thinking in the morning to find the phone to 80.70% just maibe he setted to chargetill 90.. and REcharge when under 80..70... it's a stupid possibility to let to users imho. at max the developer could set a label where user can set a number from 0 to 5%, so a lot of user can set 0 or 1 to find the battery ad the DESIRED level... and not till 3% lower.......like now

2- max level 40 to 90 is perfect.... i would make it 40 to 95 also...

3- you are right ...limiting amps would be nice but i think IT IS VERY HARD to be implemented. for example my input_current_max file is written with 1000000 value. what does it mean this value? maybe it's a too much difficult thing to do...... too much custom rom differences.....

4- voltage limit is A MUST that the developer should REALLY implement on this software.

but your info about the right voltage is completely dependend of the precise phone you own because you forgot that for example a redmi note 3 pro battery (like most of the new recent phones) is 4,4v maXvoltage XD XD

the battery university tip of 4.1 is REAL....for GENERIC 4.2v ..... because almost 80/90% of lithium batteries on the word are 3,6v / 4,2vmax ..... but lately we've seen 3,7 and 3,8v........ that allows 4,3 and 4,4v max voltage.
[Android Apps and Games] blueberry.sky:
:good:

I've also been thinking that as I read these continuing posts.

And some of the demands suggestions are becoming just an exercise in OCD. Very little to no actual added benefit for li-ions over the current app.

But luckily, we can all have whatever our heart desires! Sriharshaarangi kindly open sourced the app under GPLv3. You can submit code contributions or fork the project & do anything you wish. Have fun, go crazy.

Source Code: https://github.com/sriharshaarangi/BatteryChargeLimit

Could you reduce wear a little more? Yea, if you can reduce charge current. I tried in the beginning. Some devices don't support it, crashes if you attempt it. Found Moto e2 works, direct file: /sys/devices/soc.0/78d9000.usb/power_supply/usb/current_max , initial value: 1300000 , resets when plugged or unplugged, hard minimum of ~700mA.
[Android Apps and Games] Pipiou211:
It does what it says on my Nexus 6P!

I am on Nougat 7.1.1.

I have no Ampere at the moment and as I remember it requires xposed framework ... So I am not installing it at the moment, but I am preety sure it is working as it have to ...

Have a nice day!
[Android Apps and Games] Marília de Oliveira:
Does not xperia z3 compact?
[Android Apps and Games] savvymatthew:
The battery saver on Android? I have oneplus 3 with the same rom as you... Stock kernel though. I haven't noticed that happening
[Android Apps and Games] danecr7:
Yes the Android battery saver. Maybe it's related to the kernel, I will search in that thread and see.

I will report back to confirm.
[Android Apps and Games] danecr7:
Seems like it's kernel related because even when I disable this app the battery is still triggered when the cable is unplugged.
[Android Apps and Games] gingerboy92:
the problem with all this complicated method is that it will end up depending on how each device works since you are basically trying to take control of the kernel's work, and there are not really any universal interface to actually do it. Some device do have the capability to fine tune the charging rate etc, especially those with quick charge 3.0 capable chips, but then even that will require the kernel to actually made it visible to the userspace(for example, in my phone, there's this /sys/module/qpnp_smbcharger/parameters/default_dcp_icl_ma that can be use to control charging current). Perhaps you could try contacting Ampere's developers to find out what phone supports what interface? they have been doing something related to this for some time, i'm sure they know a few things.
[Android Apps and Games] Anonymous_1S:
[MENTION=6898873]sriharshaarangi[/MENTION] can you make the option for maintaining mode too? like if i set the limit at 80%, then i want it to charge again at 70%.

BTW your app works perfectly on xiaomi redmi note 3 pro?
[Android Apps and Games] Dims_Camper:
useful app! this app should be included in xda-labs for integrated update
[Android Apps and Games] shaun.kleyn:
Superb app! I do however second this idea. It would be handy to set the percentage at which to start charging again. When plugged in I'd prefer it to discharge to 40% before changing again, eg. maintain a charge between 40% and 80%.
[Android Apps and Games] Galaxea:
Yes!
[Android Apps and Games] Akshay Prasad:
Whats your laptop?
[Android Apps and Games] makey404:
I was looking for an app like this. Sometimes I need keep the phone plugged in but I don't want to kill the battery keeping it at 100% for a long time repeatedly.

Works fine on my Galaxy Note 4 with latest stock-based ROM.

I already need to check on Nexus 7 (2013).

Enviado desde mi SM-N910F mediante Tapatalk
[Android Apps and Games] tiennhu89:
Ok. after many times try to charge my phone and now i can confirm that it work. But i dont know its bug or not: If i unplug charge <80%, this app will remain running on background until my phone charge on 80%. I mean i always have a message on notification until its charged to 80%. :eek:
[Android Apps and Games] mr_fingy:
I have tried to get this working on my Pixel 6 Pro (Android 13) but it just keeps charging past 80%

I checked the control file /sys/class/power_supply/battery/status and it is using Charging/Discharging which changes when on charge.

Not sure what I am missing. There are 149 pages so apologise is I missed the answer within them, but I did search
[Android Apps and Games] Dragon1212:
Thank you!!!
[Android Apps and Games] mr_fingy:
Thanks for the info. I just set the file you mentioned to 80.

It's default was 100

The charge didn't stop at 80

Did you also point the app to this file and set the enable/disable to it?

From what I understand:

vi the charge_stop_level file to 80

Then I'm not sure what the next step is.
[Android Apps and Games] asdf2345:
How do I find the control file on my LeEco S3 X626?
[Android Apps and Games] kneejerking:
Hi, I tried using ACC on my pixel 4 android 13 and it still won't work. It stops my phone from charging even though it drops below the battery % I set. May I ask what version you use and what charging switch?
[Android Apps and Games] MetroWestMA:
If you are using a Pixel 6-8 these Magisk modules will work -- I have used them on all 3 series with no issues.

Meanwhile I am going to try BatteryChargeLimit on a new OnePlus Open :)
[Android Apps and Games] co01l3r:
yo, can anyone pls help me? I have an issue that I haven't in LineageOS18 on the same phone. Previously, when the batter reached the "Charging limit" it stopped even when still plugged in the charger; otherwise, it didn't start charging until it reached the "Recharge below" point.

This is what I want again, however now it only starts vibrating when it reaches the "charging limit" and it won't stop until plugged out from the charger and the "recharge below" is completely ignored, which means no matter what point I plug it back, it will always start charging.

is there a solution/alternative, or I'm unlucky? Thank you.

(Xiaomi Mi 9T Pro / Redmi K20 Pro)

View attachment 6062354View attachment 6062355View attachment 6062356