Instructions usually advise to use the charger that came with the device. We're taking a chance when we use amateur means to charge batteries.
Yes, of course. I try to rephrase my goal (it was probably not well explained).
I don't want to replace an optimized factory charger, which best fits for some specific battery.
As far as I know (but correct me if this is wrong), the life of a battery (in particular, a Lithium-ion one) is extended if it is charged with lower currents. On the other hard, higher currents of course reduce the overall charge time.
I would like to build a device which is able, according to my needs, to provide both the scenarios, through a programmable current.
What's the recommended range for your mobile phone battery? I guess 3.7 to 4.2V (but you should measure to make sure). Here's a simple circuit that uses a plain diode to drop 0.6V from a 5V supply.
So far, I did not make any measurement through a multimeter. However, there is an app that monitors some battery parameters. Hoping that it provides enough accurate values, the higher voltage I saw is 4.3 V (charged at 88 %).
Also, the mobile phone itself seems to tweak the current provided to the battery during the charge, so that its value is always optimized. This way, probably my charger could be less "smart" than I thought, as it just must provide a fixed current, set by the user:
- when a fast charge is needed, I can set its current to a high value (3 A, for example), then the mobile phone will grab it according to the battery needs;
- when a slow charge can be tolerated, I can set the current to a lower value;
- in an intermediate situation, I can set the current to some value between 0.5 A and 3 A.
The key fact is that I would like to be able to set the current provided by the charger: then, it will be the maximum available current. The phone will adapt it, according to a precise schedule depending mostly on the battery charge percentage.
This also would make my charger independent from the specific phone and battery.
View attachment 184617
Suppose the battery starts at 3.7V, then it admits 22mA charge current. This amount goes down automatically as the battery rises over 4V.
After several hours the battery could reach 4.2V. In that event the charge current is small (3 mA). We can surmise it barely affects the battery. Of course you ought to research further and keep track of battery temperature as well as a host of other parameters to make sure.
These aspects (which are all very important) are probably monitored by the phone itself. Trying to rebuild such adjustments is out of my capabilities.
My initial doubt was, however, about a slightly different problem: in general, how can the output current of a device (whose purpose, if relevant, is to charge batteries) be set in a custom way? Is this achievable through a microcontroller setting its GPIO pins as command to the output transistor terminals? Or through the GPIO pins setting a resistance? Why?