Battery charging/discharging/protection and voltage conversion for 3.3v and 5v logic can be tricky.
Generally speaking the circuit is broken down as following:
+-----> Buck boost -> 3.3v consumer | USB -> Charging circuit -> Bypass -> Step-up -> 5V consumer | Protection | Actual cell
Each compoenent here has certain purpose:
- Charger circuit gradually increases voltage up to 4.2 and eventually attempts to hold the current until current goes to 0A. Example IC-s for charging single cell LiPos include TP4054 800mA and TP4056 1A.
- Bypass circuit is used to hook battery up to the charger and hook USB power directly to consumers
- For stepping up LiPo voltage 3V .. 4.2V to 5V MAX1709 4A, MT3608 2A IC-s are suitable note that in all cases you need external schotky diode and inductor.
- For converting the same LiPo range to 3.3v there are LTC3440 IC-s. Note that external inductor is necessary and LTC3440 is rather not hander solderable, the leads are 0.3mm wide.
- It is not unheard of to have also step down after step up. You can use for example LM3671 600mA to generate 3.3V from 5V.
In many cases consumer can be connected without voltage regulation:
- ESP32 works between 2V .. 4V because it has internal voltage regulators. So LiFe battery would work just fine, but LiPo is fully charged to 4.2, in that corner case ESP32 just won't boot
- Servo motors work fine, but inrush current can cause neighbouring components to reset/freeze etc. Use 0.1ohm resistor in series with servo power to prevent crashes. Note that servo RPM lowers as battery is discharged.
From Aliexpress you can also find some suitable boards with IC-s of unknown origin, eg this 5V 2.1A board
Note that we are using step down conversion because linear regulation is not power efficient. In case of linear regulation the voltage drop over the regluator is dissipated as heat. Basically if the device is not making use of any inductors it's linear regulator for sure. If you don't care about the power loss, you can make use of AMS1117, it has multiple versions with different fixed voltage outputs including 2.5V, 3V, 5V etc. Note that 1117-s are manufactured by different vendors and some of them haven't bothered to include short circuit protection. Accidental short-circuit of the outputs will cause the input voltage to be passed down to the output pin. The voltage drop over 1117 regulator is usually more than 1V, which means that rather empty LiPo at 3V will result probably less than 2V on the output. In that case you could look for low dropout regulators (LDO-s), in which case the voltage drop is shaved down to couple hundred millivolts.