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.
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.
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.
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.