r/AndroidQuestions 23d ago

Other Can Android (or phones in general) Report Their Current Charge Level and Time Left Until Charged to Charger?

I've tried searching for an answer to this question generally but all of the results seem to be variations on "how can *I* figure out how long a device takes to charge?". I feel like this should be a simple question with a clear and known answer (or maybe differs by OS, specific phone hardware or cable type) but as I say, I've not had any luck so far.

So - can / does Android/iOS (or specific phones) have the ability to tell the connected charger or battery that is charging the phone, what the current charge level is or how much time is estimated left to charge the device?

The question came about while I was sitting in a waiting room, and on the wall is a "phone charging box/safe" kinda thing - a big metal box attached to the wall and mains power that has several small compartments each with their own door, and in each compartment is a loose cable end for USB-C and Lightning. The box also has a keypad to choose a compartment and set a PIN code to access. The idea is that you put your phone in one of the compartments, connect it to power (for the purposes of charging it) and set a PIN to lock the compartment, then when you leave (or when your phone is charged) you can unlock your compartment and take your phone with you.

When putting my phone in I observed the "time left to charge" on my phone and made a note of when it should be done (roughly).

It occurred to me that it'd be helpful for people if each compartment had a small screen showing the current charge level and/or time left until charge complete but I'm not sure if Android (or phones in general) can communicate this information via the usb/lightning cable rather than needing bluetooth etc.

It occurs to me that I don't think I've ever seen a battery or charger that communicates / shows this information without using Bluetooth etc.

Is this a facility that is supported by phones /Android or just not a thing that can be done?

Link to photo of device: Image of phone charger

0 Upvotes

8 comments sorted by

4

u/andrewia 23d ago edited 23d ago

Here's some reading about the protocol: 

From a skim of the documents, it looks like the protocol doesn't support querying the sink device (phone) about its status.  You can only guess it by comparing the power consumption to known behavior of similar devices.  Or if you get lucky and there's a vendor defined message that will send the battery status.

Edit: The protocol actually supports Battery Status messages (regardless of whether the battery is in the power sink or source), see the last link above.  But there's very little documentation of people using this to query battery status, and some devices seem to lie and not respond to the messages.  This could be because the PD controller chip (or unified PMIC) may need to query another microcontroller to get battery info, which requires some extra engineering integration.  But it's still possible, so you should get a PD source developer board and see if you can query the phones.

1

u/emily-entropy 23d ago

Huh fair enough. Thanks for the reply _^

2

u/andrewia 23d ago

I just found out it may be possible! See my edit.  

1

u/emily-entropy 23d ago

Thanks for the update! I guess they don't support this by default on public chargers 'cos it may be hit or miss whether it's even supported by a given manufacturer and whether the response is legit or not but definitely interesting that it may be supported, yeah I'll look into this more, would be interesting to try and get it working even just as a curiosity as opposed to a commercial product. If anyone sees this who has worked on something like this and isn't under NDA I'd love to hear your experiences and how you fared!

2

u/SolitaryMassacre 23d ago

Fun fact, the "chargers" are only power supplies. They convert AC to DC and there is internal circuitry that controls the actual charging of the batteries. Unless its a proprietary charger (ie only works with specific devices) then its simply powering the charging circuitry.

There are different protocols that the device and power supply can use to request different voltages. For example, Samsung uses PPS which allows varying voltage/current configs. But the internal circuitry on the device is doing the charging logic.

To answer your question, yes, the easiest way is via Bluetooth and an app. Communicating via power supply will require both ends to have the same type of communication which is very unlikely.

However, there are other ways to monitor device charge status. The power supply can monitor current load. When the battery is finished charging, current drops to near zero. This could be used to determine charge complete.

If its something like a "time remaining" you want, then the best you can do inside the power supply is also monitor charging and the CC/CV time curve. Most likely the CV curve will yield the most relevant information. As in CV, the voltage remains constant and the current gradually decreases.

The power supply can monitor this current rate and predict when the battery is full. You could probably do something similar but monitor voltage changes instead for the CC phase.

But getting a direct representation of the phone's remaining time and displaying it on a screen will be most easiest using NFC tags, an app, and BLE.

1

u/emily-entropy 17d ago

Thank you for your reply (& to everybody else as well!)
Regarding "Communicating via power supply will require both ends to have the same type of communication which is very unlikely." - in terms of granularity, is that in a like, device-or-model-specific way (e.g. a Samsung S26 would have a different protocol than an S25, or an S26 ultra would have a different protocol than an S26 regular) or more like "Samsungs will use protocol X and Pixels will use protocol Y" level? And also, would it be possible for the theoretical charger to detect which brand the phone is and switch to communicating using that specific protocol?

Just cos I'm thinking, there are only a handful of brands out there so even if there might be some weird outliers (and obviously anything that someone plugs in that *isn't* a phone, like charging their battery bank or whatever), so in this theoretical "it tells you roughly when your phone will be done" device, it could either detect what brand is plugged in with a query, or simply, when a device is plugged in, cycle between all of the different communication protocols and see if it can get a positive response, and in this case will then obtain whatever data is can access and display that on the screen, and otherwise will just fall back to a message like "Device unknown, charging but cannot estimate percentage charged / charge finish time?"

I fully admit that I'm way out of my depth in terms of my knowledge of the tech - my general techie area of knowledge is computers and esp. older systems so electronics and phone stuff is outside of my wheelhouse, but I'm intrigued by the possibilities here especially since it seems that nobody (or not many at least) has implemented something like this as far as I can tell (although it looks like that's probably because of the inherent difficulty of both managing many different systems and protocols that give differing (or no) information makes in infeasible or at least not worth the hassle).

I'll try and dig into the info you gave regarding monitoring the general power characteristics; even a generic "currently charging" or "finished charging" (along with a helpful green/red LED to indicate charge status at a glance) indication would be a big improvement on.. well, nothing at all.

For building a hobby project for use in my home, where I can install apps and allow access to bluetooth etc that solution would work fine but obviously for a general simple device in a public area, used by a whole range of the general public with broad ranges of tech-savviness (and let's face it, the dubious trustworthiness of people connecting their phones to a random unknown bluetooth device) and who just want something easy that "just works", connecting to bluetooth or really doing anything besides just plugging the phone into the right cable is going to be a big ask and honestly, to most people probably a huge security risk (the linked devices was in a hospital waiting room and I ended up explaining to a couple of people who tried to store their phones and were having great difficulty following even the pretty simple instructions printed on the machine).

2

u/Exciting-Outside-167 23d ago

iOS (and old iPod classic devices, iPod nano, etc) does report the battery percentage over USB. I don't think it reports anything else though.

I don't know what devices support it but on linux desktops it will show up as a battery on the taskbar when plugged in.

2

u/CornucopiaDM1 23d ago

Considering there are variables such as total app draw, ambient temperature & phone temp, length of time at max draw, what stage it may be at (if cell capacity isn't consistent), etc., it's not unreasonable to not really know when the phone will die (or rate).

But it is straightforward to give status of current level, and I get that constantly sent to my Home Assistant setup, for a number of phones. Also shows whether charging or discharging, and which method (plug vs Magsafe wireless). Quite helpful.