iOS Device: Checking battery state of charge via Lightning/USB Type-C  - Page 1
Forum section: electronics / projects

author: TimNJ
author_rank: Super Contributor
timestamp: June 10, 2020, 04:26:59 am
content: Hi all,Firstly, I'm typically pretty far away from software/firmware, so please excuse the ignorance of this question. I'm also pretty sure no one will have experience with this, but here goes:Is it possible to check/request the battery's state of charge from an iOS device via a wired connection (i.e. Lightning or USB Type-C)? Seems like it's possible via Bluetooth. I've looked through Apple's accessory design guidelines, but don't really see anything about it.https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdfI've been kicking around an idea for an external charge cut-off device that prevents the device's battery from being charged above some level. The life of lithium based batteries can be greatly improved if you just charge to 80-90% instead of 100%. Apple has implemented a software feature which sort of does this, but still winds up charging up to 100% anyway. The software feature avoids float charging at 100% for prolonged periods.Thanks,Tim

author: NiHaoMike
author_rank: Super Contributor
timestamp: June 10, 2020, 04:50:41 am
content: If it can be assumed the device will be idle, check the current draw and look for it going below a certain point.

author: TimNJ
author_rank: Super Contributor
timestamp: June 10, 2020, 02:50:51 pm
content: Thanks. I suppose that could "work" but think it would be quite crude. Of course, does not work (well) if you're using the phone while on the charger. Plus, different batteries, chemistries, and varying degrees of battery health probably means that "cut-off charge current"varies all over the place.The convenient thing about battery management systems, is that, most good ones, actively monitor the charge/discharge characteristics (impedance) to analyze the health of the battery pack. So, the reported state of charge is relatively accurate, and there's no need for "calibration". By calibration I mean: If I was just measuring input current, then the current at which 80 or 90% SoC is reached will likely be different depending on factors I mentioned above. But, when a BMS reports 80% SoC, you can believe that the battery really is charged to 80% +/- 5%, or so. No need to do any analog measurements.Thanks for the idea though. Maybe there's still a way.

author: PlasmaArcEng
author_rank: Newbie
timestamp: June 11, 2020, 02:29:07 am
content: If you make an app for your phone it could report back to the smart charger the status of the charge level. I cant find anything about an API for this natively.

author: NiHaoMike
author_rank: Super Contributor
timestamp: June 11, 2020, 02:52:39 am
content: Quote from: PlasmaArcEng on June 11, 2020, 02:29:07 amSo the app checks the charge level and tells the charger to turn off when it is just right. The hardware for it already exists if you want to do it over Wifi or Bluetooth.https://hackaday.com/2019/12/26/new-part-day-sonoff-usb-smart-adaptor-taps-a-new-wifi-chip/If you want to do it over USB, it's possible but would probably involve more complexity than you want. Back when I worked at Intel, they had those really neat stationary bicycles in the gym that can charge a connected phone or tablet and there's an optional app for recording data, but the app still needs to be paired using Bluetooth - the USB is for power only.

author: Jeroen3
author_rank: Super Contributor
timestamp: June 11, 2020, 08:16:32 am
content: Yes™Apps can use ExternalAccessory api to talk to devices. Those devices can still charge the phone.Drawback: app must be in foreground.To not be in foreground (eg: carplay) you must be MFi, an no way they're going to sign off on a feature like this.You could start here:https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf