I want, using 5v from an USB, charge a 4.2v 18650 battery (wired to an TP4056)
I then boost the 4.2v to 5v to feed it to an arduino and to 1 or 2 servo motors. (I've drawn a schematic for better understanding).
I want the battery to get charged while I'm working on my code and than, once finished, have a portable power supply for what I'm currently doing.
I would like to have your opinion regarding this:
Can I do something like this ? Or does it create some sort of strange loop ?
Is there a better/safer/ mor efficient way of doing it ? Could be adding some parts or using better componants or doing it completely differently.
Is there a componant that combines TP4056 + Boost converter ?
Any idea or suggestion is truly appreciated.
Thanks
TP4056 modules work well, however they are set to 1A charging current by default. You need to have a USB port with good load capacity to avoid overloading. A regular USB 2.0 port has a load capacity of 500mA and can be overloaded.
You can power the Arduino from an 18650 battery via a boost converter, but a power switch is required.
If you need automatic power switching, it is possible, but this is a separate topic. This can be done, as in Arduino Uno.
Thanks for your input. I've change the resistor in order to draw 250mA max.
Concerning the power, is to avoid that "strange" loop I was referring ? I've installed a power switch which will be in the off position when the USB is wired.
There's a device called the "18650 battery shield V3" which combines a battery holder, a TP4056 charger with protection, a 3.3V linear regulator, and a 5V boost converter:
However, this device would not give you USB communications for flashing, etc. It also does not provide a "load sharing" circuit which lets you operate your device safely while charging the battery at the same time.
Also, I'm confused by your schematic. It looks like you are powering the charger from the Pro Mini, but then running the Pro Mini off the battery and boost converter. That does appear to be circular, and I don't see how it could work.
@RedIron I think the circuit should be slightly different. You cannot create a "strange loop", it will give a perpetuum mobile machine. The loop needs to be broken. There are probably many ways to solve the problem. I see two easy ways:
Constant conversion - the converter works constantly, the Arduino always receives power from the converter.
Switching - The Arduino is powered by either USB or a converter. We need a switch. It can be a regular toggle switch, relay, or a field-effect transistor circuit, like Arduino Uno has.
I think either of Boffin's circuits would work fine. But if you will have two servos in your circuit, the USB-UART power and the charger may have a problem powering everything. Powering from the battery would be more likely to work. At some point you'll have to determine how much current you need when the motors are running.