18

Device : Moto X Play ( Rooted, Stock, Android 6.0.1, msm8916 Board, XT1562)

Why do I want to limit charging ?

( Let's leave out whether my reasons are valid or not and accept that I want to, if you disagree with my reasons)

To improve the longevity of battery , I wish to limit charging when it reaches 90%, as explained here Ideal charging / discharging percentage for maximum battery life?

Is it possible?

Yes, at least on my previous device Honor 6, as brought out here How do I override charging current on Huawei Honor 6?, with two different ways of doing it

I have tried unsuccessfully to identify the file responsible in which changing values would limit charging

I am looking for the system file responsible for stopping charging, with it's true path (without symlinks)

(as I saw on on my previous device, locating the path of file was a big challenge after identifying it)


CC BY-SA 4.0
5
  • 1
    I know you're very experienced here, but this may be a bit of an XY Problem and it could be helpful to indicate what your main goal is—longer battery longevity? worried about explosions?—so we all can try to help you with that.
    – owlswipe
    Jan 22, 2017 at 16:02
  • Why do you insist on "no symlinks" here? Power-related files are conveniently symlinked to /sys/class/power_supply/ on pretty much any Linux system I've seen. Why do you need to locate them inside e.g. i2c tree? Nov 26, 2018 at 9:15
  • @DmitryGrigoryev Good question with a simple answer. I am not Linux savvy and don't understand - so I wanted to know the location from where I can directly manipulate them as I did in my answer :-)
    – beeshyams
    Nov 26, 2018 at 9:19
  • 1
    Now there's Chargie - a USB stick+Android app combo that limits charging externally. Just install the stick between the charger and phone and use the app to select the charge level. Simple as that. Look for "chargie stick" on Google. Jun 21, 2019 at 6:30
  • Related (and with far better answers in my opinion): How to limit charging to a user-defined limit?. Apr 27, 2021 at 20:47

3 Answers 3

12

Okay.. Got it :)

  • The first thing to note is on Honor 6, my previous device , there was a single file I could play around with to stop charging automatically

  • On Moto X play, there are two distinct files - one for disconnecting the charger and other for removing charging symbol ( In other words, you could stop charging and still have the charger connected symbol showing). Till I realised this, I was running around in circles, since I took charging symbol to show that charging was happening ( and assuming I was dealing with the wrong file ). While experimenting, when I noticed charge drop despite charging symbol showing, I verified with Ampere app and wisdom dawned !

What are the files?

(Edit:30 Mar 20 Jackpot! Found this awesome repository of files for various devices by the developer of Advanced Charging Controller Magisk Module. You are better off using that versatile module but in case you want to DIY, it's a great start) .

There may be other files, but the files I homed on too are :

  1. For Charging Icon : /sys/devices/soc.0/78d9000.usb/power_supply/usb/online ( For disabling icon change value of file from 0 to 1)

  2. For charging : /sys/devices/soc.0/78b5000.i2c/i2c-1/1-001c/power_supply/battery/charging_enabled ( For disabling charging change value of file from 1 to 0)

For automating this, approach was similar to my answer here using Terminal Emulator and Macrodroid as explained here - How to automate command line when specific application is launched?

How did I find the files?

Inelegantly, and I am hoping that somebody posts a good way. Here is a way that may work for you in identifying the file and path

Assumptions

  • Long hours on the net and some coding on GitHub ( which I don't understand at all ) pointed me to look at i2c and usb related files with names like charger_enabled or enable_charger. This seems to be true for Honor 6, Moto X and some Nexus devices. I have no clue whether it is chipset or device dependent

  • The true path of this file is in /sys. Again, may vary

Next Steps

  • Do a search for charger enabled or enable_charger or a wild card search with similar words in /sys

  • Change rw permissions to enable changing the content from 1to 0 or vice versa

  • Connect your charger and see the value in file, disconnect and repeat. If the value changes, it looks like the right file. While the charger is connected, change the value in file and if charging stops, you have hit it (More so, if the path is in i2c directory). Verify with Ampere app to confirm charging status

  • While you are at it, may as well copy original and modified files to a separate directory in your storage. Needed for automation

  • If your device is like mine where charging can be stopped but charging icon, shows, more grind to identify that file by keywords like online or connected or ???

If you are lucky, above should work for you


Just as additional information for posterity the Terminal Emulator shortcuts are :

  • For disabling charging and removing the charging icon

su –c "cp /storage/emulated/0/moto_charging/disable_charging/charging_enabled /sys/devices/soc.0/78b5000.i2c/i2c-1/1-001c/power_supply/battery/" ; su -c "cp /storage/emulated/0/moto_charging/no_symbol_charging/online /sys/devices/soc.0/78d9000.usb/power_supply/usb/"

  • For enabling charger and charging icon

su -c "cp /storage/emulated/0/moto_charging/show_charging/online /sys/devices/soc.0/78d9000.usb/power_supply/usb/" ; su –c "cp /storage/emulated/0/moto_charging/enable_charging/charging_enabled /sys/devices/soc.0/78b5000.i2c/i2c-1/1-001c/power_supply/battery/"

moto_charging is a folder created in Internal SD that has original and modified copies ( to enable and disable charging), and these files are copied into the system. Of course, requires root

CC BY-SA 4.0
9
  • 1
    I also want to charge my battery only up to 85-90%. I admit that your answer is impressive and well documented (and I up-voted). But it is damn cumbersome to do that. Can a script/app be made to achieve all that with less effort? :)
    – Gravity
    Jun 9, 2017 at 11:43
  • There seems to be an app to do that. I haven't tied it YET: android.gadgethacks.com/how-to/…
    – Gravity
    Jun 9, 2017 at 11:53
  • @FreeAndNil thanks. 1. There is an app already linked in the foot note of my answer here 2. I haven't tried the app you linked (thanks for that ) but unless I know what goes into it, I would be chary 3. I don't know scripting, but this can be easily converted to script and Macrodroid supports scripting too-
    – beeshyams
    Jun 9, 2017 at 12:21
  • @FreeAndNil: checked. Your source is pointing to the same app which I linked to- last I checked the XDA forum of developer, script was not open source- maybe, it is know.
    – beeshyams
    Jun 9, 2017 at 12:25
  • 1
    @beeshyams afraid I'm not "keen enough"; I rather lack the time to investigate the sources in that depth, sorry.
    – Izzy
    Dec 5, 2017 at 11:22
6

Now there's Chargie - a USB stick+Android app combo that limits charging externally. Just install the stick between the charger and phone and use the app to select the charge level. Simple as that. Look for "chargie stick" on Google.

Disclosure: I am the CEO of Lighty Electronics. We developed Chargie and would love people who have had this issue to enjoy our product as much as we do. No spam, just the solution to the problem.

CC BY-SA 4.0
2
  • Chargie works great on Android and Apple phones! Download the app (the right app, as there are now 2 different apps by this name), plug in the device to your charger, and your charge cable to the device, and your phone to your charge cable. Then, open the app, approve needed permissions, wait for the app to auto-connect to the device via Bluetooth, drag the slider to the desired level of charge, done! I set mine to 70% and it automatically keeps my phone between 66% to 70% continually now. I just plug my phone in and don't do anything anymore, as it's all now automatic. May 11, 2021 at 16:25
-5

You're concerned about something, as well as focusing on something, that is inessential.

Most modern phones have built-in technology that will automatically stop charging at around 90% to 100%.

Don't buy into the whole charge cycle mumbo jumbo. If you have a good phone, you'll be golden 100% percent of the time (as long as you charge your phone when it needs to be charged. That means not every night). I've tested many, many phones and have yet to see this charge cycle "theory" as true.

Your phone is already built like that. When you see that it's charged to 100%, it's not literally its capacity. OEM's do that to prevent people from over-charging devices. (That is, if you have a phone where the OEM is smart).

It's also important to note that general use of the phone can wear your battery down in a year's time. Battery survival isn't forever no matter how healthy your charge cycle is. It depends on how you use the device, what apps you download and how they interact with your battery (consumption), etc.

In any case, you can use Safe Charge, an app from Google Play, to notify you when charging past a certain percent.


Sources

Other than six years of experience which alone isn't much, here are some relevant articles.

There are also plenty of peer-driven forums with people who have many years of experience who've tested this theory, turning up false. Devices handle charges on their own and stop when needed.

CC BY-SA 3.0
6
  • 2
    Let us assume that I want to for whatever reason and I need a way for that 2. I don't need additional app to notify me, I can do that easily using the automation app, Macrodroid, which I use. Your answer in the present form is unhelpful
    – beeshyams
    Jan 22, 2017 at 13:11
  • 6
    Most modern phones have built-in technology that will automatically stop charging at around 90% to 100%. - can you support that with any evidence??
    – beeshyams
    Jan 22, 2017 at 13:16
  • 3
    You might want to read the links you post as evidence, this is a quote from the only technically detailed one: "As we’ve pointed out before [with a link to a whole article of evidence], if you want to extend the life of your battery, you want to keep it between 40%-80% all the time." Fact is there is a trade off between time between charges and battery endurance, and only the former appears in device specs and adverts, so which do you think the manufacturer will prioritise? Evidence seems to point at 40% for storage and cycling 75-65% is the optimum range in use.
    – Chris
    Apr 15, 2017 at 10:03
  • 7
    HILARIOUS: one your sources (first one) you cited actually contradicts you: "As we’ve pointed out before, if you want to extend the life of your battery, you want to keep it between 40%-80% all the time". Also, your source says that YOU SHOULD not charge your phone to 100% and that over night it will be charged to 100% !!!!!!
    – Gravity
    Jun 9, 2017 at 11:39
  • 5
    And here is a trustable source (not like the ones you provided) to prove you wrong: batteryuniversity.com/learn/article/…
    – Gravity
    Jun 9, 2017 at 11:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .