Li-ion battery chargers use the CC/CV algorithm. CC means Constant Current and CV is Constant Voltage. When a battery is under charge, the device supplies a constant current until a threshold voltage is reached (typical 4.2V), then applies a Constant Voltage. When the charging current drops below the 10% of the set value, the battery is disconnected (float). I tried to use a battery charger to light a white led at 300mA constant current. The trick is that the led (obviously) does not recharge, so the charger remains continuously in CC mode, with the current set as programmed.
I built the circuit on a proto board, using a self made adapter for the smd IC TP4056. Note that this IC has a metal pad on the bottom side, for thermal dissipation. I soldered a wire under the chip before placing it onto the adapter. The schematic is very simple:
Detail of the prototype board :
Now it’s time to test. I used a trimmer for setting the value of charging current. For 300mA the value must be 4K Ohm. If you don’t want to use a trimmer, such non-standard value can be obtained paralleling two resistors: 10K and 6.8K (the result is 4.04K). The image below shows the current measured with a multimeter.
Note the 1N5819 diode at the charger output. This is important. The white led I used has a typical Forward Voltage of 3.42 Volts and if you connect it directly to the BAT signal of the IC (pin 5) the charge does not start. You will have a current that is the 10% of your settings, so about 30mA. The IC “starts” if there is a voltage near 3.7V ; the diode 1N5819 has about 0.35V voltage drop at 300mA, so 3.42V of led plus 0.35V of diode makes 3.77V and the circuit start “charging” at 300mA. I also tested one commercial board I purchased some time ago on ebay. I just modified the charge set resistor and added the diode at the output. Please note that if you set higher currents, the IC will be hot. I don’t recommend current values higher than 300mA, without any thermal dissipation. This IC is not made to be a led driver. For professional results, use one made for that purpose.
Here is a table for values of resistor to set a specific current and the position of such resistor on the circuit.