yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] hgmichna:
Which max voltage to choose

It is a compromise between battery longevity on one hand and getting through the day without the battery running empty on the other. Battery longevity determines after how many years you have to abandon your battery and replace it with a new one (either in your phone or by swapping your entire phone for a new one).

Battery university says that below 3.92 V you have hardly any wear on the battery. In the area of 4.3 to 4.4 V you have maximum wear, meaning that your battery will become unusable after two years. Going even higher would destroy the battery in much less than two years.

If you easily get through the day on 60% or if you have the opportunity to recharge a bit during the day, like at your workplace, go for 3.92 V or 60% max. If not, charge higher and find out how much you need. The default setting of 80% is a very good compromise between having a lot of charge and keeping your battery for longer than two years. I guess 80% corresponds roughly to 4.1 V.

Another trick to extend the lifetime of the battery for those who charge over night is to get a 500 mA charger, so the battery does not reach full charge needlessly early and also stays cooler. I just found one of these rare chargers on Amazon.

US: https://www.amazon.com/dp/B071V3DC9R/

Germany: https://www.amazon.de/dp/B07DDHGSFB/

I have ordered this charger but have not received it yet. So no recommendation for now.
[Android Apps and Games] iluvatrix:
On the subject of getting a 500 mA charger. I've read in a xiaomi forum that /sys/class/power_supply/battery/constant_charge_current_max can be set to restrict the charge current. Any thoughts?
[Android Apps and Games] zputnyq:
Removed
[Android Apps and Games] hgmichna:
Low-current charging

If it worked, it would be just as good as a weak charger.
[Android Apps and Games] ChemoNL:
Can someone share their settings if they use it successfully on OnePlus 6 oos 9 ?
[Android Apps and Games] SGH-i200:
The difference between the two approaches is not percentage vs absolute value (which can be calculated from the percentage).

The question is: Do we want to stop charging at a defined limit or do we want to hold that defined value the whole night long? And should we limit the charging current?

It is better to continue charging if the device is in operation and the battery charge should not drop once the desired battery level has been reached. When I'm using my device, I prefer to disconnected the cable as soon as possible. This gives me a feeling of freedom! :svetius:

https://batteryuniversity.com/index.php/learn/article/how_to_prolong_lithium_based_batteries

"Most Li-ions charge to 4.20V/cell, and every reduction in peak charge voltage of 0.10V/cell is said to double the cycle life. For example, a lithium-ion cell charged to 4.20V/cell typically delivers 300–500 cycles. If charged to only 4.10V/cell, the life can be prolonged to 600–1,000 cycles; 4.0V/cell should deliver 1,200–2,000 and 3.90V/cell should provide 2,400–4,000 cycles."

"In terms of longevity, the optimal charge voltage is 3.92V/cell. Battery experts believe that this threshold eliminates all voltage-related stresses; going lower may not gain further benefits but induce other symptoms."

Check the real current via a USB multimeter, to be sure.
[Android Apps and Games] BreckZeBoulay:
Just for example, my Nexus 5X.

And to charge during the night, I use an old Samsung charger of 500 mA.
[Android Apps and Games] bertsmelik:
Sorry it took some time. Very busy!

Yes, it is a Wyhred and it's running LOS 15.1.

I have taken your suggested commands and tested them.

The good news: it does change the value

The bad news: charging is not limited

Too bad!
[Android Apps and Games] papete:
My 2 cents: On my Xiaomi Pocophone toggling /sys/class/power_supply/battery/input_suspend to 1 or 0 stops/restarts charging. I'll test it some for a week and let you guys know.
[Android Apps and Games] NexusRunner:
Wow, this is really interesting. I've tested this on 3 different devices,all of them are running Battery Charge Limit despite have read-only voltage_max.

To my surprise, 2 out of these 3 devices actually works when voltage_max changed to r/w.

It's working on Mi 6 and Mi 8 SE.

It's not working on Mi Pad 4: voltage_max can be written, but it reverts back to 4400000 immediately when plugged in.

All these devices are running on stock kernel.

Thank you!

I think they are two different approaches, both have pros and cons. BCL is definitely the more compatible solution. Some of my devices don't have much custom ROM support, one device I mentioned above doesn't even have kernel source released yet, but they all works with BCL. On the other hand, voltage_max is not working on MOST of my devices, even counted in the two recent working devices above.

Setting voltage_max on supported device is neat, it's charging more slowly towards the desired percentage, completely handled by kernel and doesn't require an app watching in the background. I'd say charging is almost too slow when I set voltage_max to 3.92V, but I agree it's the superior option regarding battery longevity.

Question is, do we really want BCL to set voltage_max on those few supported devices? Isn't a startup script tailored to your device more desirable? After all, one of the benefits of voltage_max way is you don't have to install another app!

I think BCL is irreplaceable and better stay what it is. If your device supports voltage_max, go ahead and use something else to set it. e.g. init.d
[Android Apps and Games] Infy_AsiX:
It's good to see more people discovering the benefits of limiting by voltage now. Here's some further tips and suggestions possible with it.

You can create shortcuts to Tasker to set a different voltage whenever preferred. A useful example is limiting to a lower voltage overnight until a timed alarm triggers a set higher voltage. This can be improved by setting a timed reminder with Google voice that Tasker Autonotification plugin detects and changes the max voltage. Thereby a lower normal usage battery voltage can be kept until an hour before you wake up when the higher voltage is activated. This idea is similar to Qnovo's charging optimisation brought out to Sony devices, but there it attempts to learn by your schedule and it isn't effective at learning from reading people's experiences with it.

As for a different use possibility is to limit maximum battery voltage low when running high performance gaming, to ease thermal constraints and device throttling. Setting the voltage where the battery isn't charging and maintaining CV with the supported ability. Note that when the battery is unplugged the voltage is lower than when plugged and idle because current directly lowers the voltage. Therefore it's best to understand and see how the battery voltage and current is operating when plugged to select the desired level. I use Cool Tool to overlay these but some app could put them to notification too probably.

Another thing is while employing this approach temp_warm or temp_hot or whatever is used on the device to stop charging by battery temperature has to be increased higher than it can be reached. The reason is current will slow or stop meaning the battery will discharge rather than maintaining CV. Ideally the temp limit should continue to power device only but it seems this limit is by the old design but still applies with these voltage limit supported devices. The temp limit value should be then reset to normal values when not limiting voltage for performance mode anymore.

Personally I've disabled CPU thermal throttling on my device and have increased performance settings. The performance mode low battery voltage implementation is a must for maintaining battery with maximum device performance while being able to not discharge the battery at all. This is also great for Daydream VR. Devices without max voltage support can't do this on a limited percentage as the device will constantly stop charging at limit and restart charging at threshold. They recharge while hot up to the overheat limit.
[Android Apps and Games] justjr:
Is there a way to implement this by software, like, on the rom or the kernel? Or max voltage limit is hardware dependent?
[Android Apps and Games] SGH-i200:
I was able to change the value of voltage_max on my rooted Axon 7 mini (tulip) to 4.0V. Addition to this lower charging current, I use this app to stop the charging process when the maximum charging level is reached. I don't want my phone to charge all night.

This is a good summary:
[Android Apps and Games] JackOfOwls:
Hi. Been using this program and find it useful but have been experiencing a new issue on my rooted Xiaomi Redmi Note 5. It will stop charging when reaching the limit I assign to it but if I leave the charger plugged in, it will start charging again a few hours later well above the low limit I selected. Do I need a special control file for my particular phone or something?
[Android Apps and Games] helidwarf:
EDIT: solved the issue
[Android Apps and Games] spambayes:
Hi,

It's not working on my phone. It installed fine and I see the toast "Battery service limit enabled" but it still charges to 100%. I tried another control file (Samsung Note) and there's no difference. Rebooting, uninstalling/re-installing make no difference as well.

Samsung Note 3

Stock Android 5.0.1 with stock kernel

Rooted with Magisk

Can anyone help? Thanks.
[Android Apps and Games] justjr:
After limit is reached here, it disables normally, but then when I disconnect the cord, it does not disable it self, and stay on the notification bar, I have to go there and disable it manually, and the toast saying it's disabled appear. I think it should do it when I disconnect, right? Is it a know problem?
[Android Apps and Games] :
<removed because not a question anymore...>
[Android Apps and Games] ranasrule:
Is this working on the Pixel 2 XL ? I cant get it to work. I'm rooted and on Oreo 8.1 stock.
[Android Apps and Games] theking37:
Where you able to get this fixed?
[Android Apps and Games] NexusRunner:
It's normal behavior. On some devices this app works by virtually disconnecting the charging cable, then it won't detect physical [dis]connection until that virtual switch is reset. So it has to wait in the notification area until recharge limit is reached before flipping the switch back and exit itself.
[Android Apps and Games] Brenneke:
Has always been 100 percent trouble free for me on my Pixel 2 XL rooted on Oreo and now on Pie.
[Android Apps and Games] POMF2K:
I am having the exact same issue and it's driving me insane. On my previous Xperia X Compact, the notification would disappear when i disconnected the device. Now I'm using an Xperia XZ1 Compact and it stays on after disconnecting the cord. The only difference I can think of is that my new device is rooted via magisk instead of supersu.

The thing is when i click the notification to disable it... I'm pretty sure it resets the battery stats too.

Very strange. Is there something I can do to correct this?
[Android Apps and Games] POMF2K:
So... nobody knows?
[Android Apps and Games] guest4711:
There are a lot of different implementations for the powermanagement and a lot of different control files. What works on stock kernel may not work on custom kernels for the same device, what works on N may not work on P and vice versa. So you are on your own. Mostly it so sinple and stupid as to check whether changing one control file (in /sys/classes/...) will have any result and if not proceed with the next one.

It would be helpful if everybody would report his device, ROM version, kernel version, control file used on success...
[Android Apps and Games] justjr:
I don't think there's any other way for the app to know if power is connected after it sets battery_state to 0. So, does this works for anyone at least? Or it is specific to sony battery-slate different files maybe?
[Android Apps and Games] POMF2K:
I'm using preconfigured control files on my devices. I have noticed they are different.

On the Xperia X Compact (working), it is using the Nexus battery_charging_enabled. This was rooted with SuperSU.

On the Xperia XZ1 Compact (not clearing notification when unplugged after reaching maximum charge threshold, but does clear when not fully charged and unplugged), it is using the Universal charging_enabled. This was rooted with Magisk. I also do not have the option for the Nexus control file. Any ideas?
[Android Apps and Games] hgmichna:
Service stays active after disconnecting the charger

I have had that too on my OnePlus One with LineageOS 15.1 and the built-in root. But I have had it only very occasionally, possibly when I moved the micro-USB-plug and caused a disconnect, rapidly followed by a reconnect, followed by the final disconnect, but I'm only guessing. Most of the time the disconnection works perfectly well, and the service along with its notification disappears.

If this happens always on your phone, then there is most likely a different cause.
[Android Apps and Games] fassal:
Hi,

I am trying to find the control file for my Huawei Ideos X5 or U8800. Actually my ROM by Blewfish has his app called "Huawei Settings" which is able to set the current to 0mA (effectively disabling charging) and to different values to enable charging. Would such a file work too with Battery Charge Limit? I am currently trying to find that file with no luck so far, see also here.

Thank you!
[Android Apps and Games] post-mortem:
It's mostly trial and error to find the right control file. You might get a better answer by asking in the thread for your ROM. You might also ask if the ROM allows for such changes to be made programmatically, like through a terminal command, or via an intent. If so, you could do everything through Tasker.
[Android Apps and Games] lklaus:
since going to LOS 15.1 (Oreo), battery charge limit often crashes when plugging in:

Seems these are the relevant messages:
[Android Apps and Games] 5t0rmr1d3r:
I can confirm those crashes, but i haven't looked for the catlog...
[Android Apps and Games] real_milux:
Version 1.1.1 "clean release"

Those crashes have been fixed in April and version 1.1.1 published on Google Play Store in May.

So the fixed version was available in the Play Store for some months already, but it was a "quick-and-dirty-release" since we didn't update tags, OP, F-Droid...

Sorry for the inconvenience everybody, I tried to put this right today and hope that everybody will get the new version ASAP.

[Link: https://www.androidfilehost.com/?fid=11410932744536981974]

Edit: APK seems to be corrupted, use the APK of [MENTION=6898873]sriharshaarangi[/MENTION] instead: https://www.androidfilehost.com/?fid=674106145207486851
[Android Apps and Games] Wenro:
Thanks for this! Using it and will continue to do so, especially when getting a new phone.

Question, I read so much about the charge limit and recommendations to be around 80%. I have mine set to 97%, just to keep it clear from 100%.

Is this bad? I want to have the most amount of charge when I head off to work in the mornings, and 80-85% just doesn't cut it. Is it still fine with those types of batteries?

Thanks again, great app!

Regards
[Android Apps and Games] VR25:
This is not as bad as 100%, but it's pretty close!

Keep in mind, though, what matter most are battery temperature, voltage and charging current.

You have to keep your battery as cool as possible (not freezing, of course) and make sure its voltage doesn't stay high for too long (or doesn't touch/pass the high threshold at all).

Since you're letting your battery charge to 97% capacity, at least refrain from using fast charging!Use a regular/old-fashioned adapter instead, or even better, charge on USB only. The lower (not less than 500mA) the charging current (amperage) is, the better.

High current, voltage and temperature reduce battery lifespan much more that simply charging to near full or full capacity.
[Android Apps and Games] Wenro:
Great information, thank you so much ?
[Android Apps and Games] justjr:
As in the OP: http://batteryuniversity.com/learn/article/how_to_prolong_lithium_based_batteries

Educate yourself in why would you want to charge less. The information is out there, use for your benefit only. Don't be a slave of it, if you need more charge, do it You will get less lifetime on your battery, but at least the phone will be fulfilling it's purpose. But, if you have a power bank or another battery, you may still live in both worlds.

You'll find info about temprature voltage and all that jazz there. Is the source.
[Android Apps and Games] cpoxda:
Hi I just wanted to make you aware that the APK link for v1.1.1 under "Alternate APK download links" in the OP has a corrupt file on Android File Host. This is at https://androidfilehost.com/?fid=11410932744536981974 This will give you a 1.1 MB file size, while the good one is 1.3 MB.
[Android Apps and Games] torty85:
Thank you for your great app, but the function "automatically reset battery stats" does not work. Nevertheless, the button "Reset Battery Stats" works correctly. So i have to manually reset the statistics after each load. Is there a solution for this? I use the Samsung Galaxy S8 with Android 8.0. Thank you for your help. Greetings.
[Android Apps and Games] gonzo1963:
Good night,

What is the difference between this and te Google Play version?

They have te same version number

Regards.

Enviado desde mi unknown mediante Tapatalk
[Android Apps and Games] real_milux:
I know. Ideally, there's no difference at all.

If you're using the Play version, stick to that!

---------- Post added at 08:34 AM ---------- Previous post was at 08:28 AM ----------

True, Android Studio messed up again. :confused:

Use the APK of [MENTION=6898873]sriharshaarangi[/MENTION] instead:

https://www.androidfilehost.com/?fid=674106145207486851
[Android Apps and Games] superfonic:
Hello!

Doesn't work for me.

On Nexus 5, with recent Lineage 14.1, there's no such control file, /sys/class/power_supply/ac/charging_enabled. (checked with Amaze, with root access). There's the "ac", but it's an empty *file*, not a directory. Lineage is self-compiled, but everything looks good except this.

Did Lineage team change the path, or I made some mistake compiling? Perhaps the latter, but I compiled Lineage pretty much along the instructions, so have no idea.
[Android Apps and Games] Kir3:
Hi, the app works for me, except the automatically resetting battery starts. The button works but when you have enabled the switch to automatically reset, they don't.
[Android Apps and Games] torty85:
I have the same problem with the battery statistics (see post 2025 above). The function basically seems to work, at least manually. It should only be a small problem that the statistics are not reset manually, right? Does anyone have the command to reset the statistics so that I can solve this via Tasker?
[Android Apps and Games] guest4711:
Try the command

dumpsys batterystats --reset

using Tasker (give root access).
[Android Apps and Games] torty85:
perfect, thank you
[Android Apps and Games] SGH-i200:
Install/update through F-Droid

I upgraded to 1.1.1 via F-Droid: https://f-droid.org/en/packages/com.slash.batterychargelimit/ - The new APK was signed with another key than the APK before. So I had to deinstall 1.1.0 first.
[Android Apps and Games] zpower:
What's the difference compared to Google play?
[Android Apps and Games] gamemodapk:
I can't trust it. You can't envision to what extent I was searching for such an application .
[Android Apps and Games] guest4711:
f-droid does not track you nor your data. It hosts FOSS (free/libre open source software) only. They compile from the sources and sign the apks using their own key. Current and older versions are available for download using the f-droid.apk or via webinterface at https://f-droid.org
[Android Apps and Games] SGH-i200:
I install as much apps as possible via F-Droid. Apps that are not available there, I download via Yalp Store (downloads APKs from PlayStore). Yalp Store is available in F-Droid. This way I can install all my apps without GApps on my LOS device. Instead of GApps I use MicroG.
[Android Apps and Games] SGH-i200:
Same error here on LOS14.1 for tilup (Axon 7 Mini).
[Android Apps and Games] nreuge:
[MENTION=6898873]sriharshaarangi[/MENTION]

Works perfectly on Xperia XZ2 stock 8.0.

Could you modify the app to allow limit up 100% ?
[Android Apps and Games] hgmichna:
Charging to 100%

That function is essentially covered by disabling the app. You can even do this from the notification.

If you want the phone to charge to 100%, then to stop charging until it is down to, say, 95%, that's essentially what Android surreptitiously and automatically does anyway.

If you want the phone to charge to 100%, then to stop charging until it is down to, say, 80%, you would do your phone a big favor by charging to 82% instead, then stop charging until it is down to 80%.
[Android Apps and Games] nreuge:
I know but I just want charge to 100% and then let idle discharge (until I wake up). At least, I avoid stock 99<->100% cycles...
[Android Apps and Games] hgmichna:
Charging to 100%

I still think you don't need this Battery Charge Limit app. Stock Android will not do any recharging cycles overnight, because the newer Android versions automatically go into deep doze mode and thus discharge very slowly.

The exception would be that you run something overnight that needs more energy. My phone is an example, because I run a sleep watch app that uses ultrasound to record my sleep quality. This burns some battery charge, so I have to have the phone connected overnight. I use Battery Charge Limit to keep this to 60%.

What you could also do is charge your phone in the evening, so it will be somewhere like 90% to 100% when you go to sleep, but leave it disconnected overnight. In the morning you reconnect the charger and charge until you go out, which will take the battery to nearly 100%. Doing this you would also hopefully notice that your phone uses very little energy overnight, only a few percent.

But whatever you do along these lines, your battery will not live for many years. It will lose quite a bit of its capacity over two years and will be difficult to use after four. You can then still get a new battery.

Another question is whether you can recharge during the day, like at work. Then you wouldn't need 100% in the morning, and Battery Charge Limit would be useful.
[Android Apps and Games] nreuge:
Thanks for your answer :)

My device idle drain is about -0.5%/hrs. Thus, with your app set to 99% (limit up), my device is at about 95% when I wake up in the morning. Without your app, it is always at 100%, which means that 99<->100% small charge/discharge cycles has occured, it's not good for the battery I guess...
[Android Apps and Games] hgmichna:
Charging to 100%

Not my app, I'm only another user. But I'm an electronics engineer and know a fair bit about Li-ion batteries and smartphone charging.

It is difficult to tell what the phones do when they reach 100% and stay connected to the charger. To the best of my knowledge, the manufacturers cheat a bit at that point. Apparently many phones do not trickle-charge after reaching 100%. Instead they stop charging for much longer than just a 1% discharge, to avoid the charge-discharge cycles and the trickle-charge. But they also try to avoid service calls and complaints by still showing 100%, to keep the users happy. It is likely that you worry about something that doesn't really happen.

If you really wanted to know what happens in your phone, you'd have to connect an Amp meter and check the ups and downs of the charge current.
[Android Apps and Games] post-mortem:
In addition to what has already been said, it should be noted that the damage to the battery from repeated 1% cycles is not nearly as much as the damage caused by charging to 100% and keeping it there. It's better to leave your phone permanently attached to a charging source and cycle between 24-25% than it is to allow your phone to go one cycle of 100-0%, then fast charge to 100% once per day.