TL;DR: Looking for all kinds of advice :-) Especially related to pushing "backwards" power into a MC34063 based step-up switching controller at times.
I'm building a device with an AVR microcontroller, some I/O (rotary encoder, button, LED digits and a buzzer,) a wall wart power in, and a 18650 LiPo cell for unconnected power.
I want the device to run well on connected wall wart, as well as charge the LiPo battery. The AVR will disconnect the charge voltage when the LiPo voltage gets to 4.1V. (Data sheet says to charge to at most 4.2V, so that leaves a little safety margin -- the cell also has built-in protection)
The chain is something like "jack in -> linear regulator -> switch -> battery -> switching step-up -> AVR" with a diode from linear regulator to AVR to run on wall power even when the battery charging is switched off.
I built a version of this that used a 5V 1117 regulator and a depletion mode MOSFET for the switch. Sadly, the MOSFET had a Rdson of about 3 ohm, which significantly limited the charging current once it got above 3.7 volts or so. This made it take forever to charge. The regulator also runs hot, but I have a heat sink on that, and on the MOSFET.
For a second try, I'm thinking of using the variable 1117, set to 6V out (with a 0.85V rectifier drop that to 5.15V for the AVR) and a P-channel MOSFET as a switch. This will not stay "on by default" as the depletion mode did, but with the shunt diode to the AVR, it will come on with wall wart power only anyway. Initially, I did not have that diode, so power "on by default" was important. The P-channel MOSFET has an Rdson of about 0.2 ohms at -4V, so it probably won't even need a heat sink.
I will then depend on the current limiting built into the 1117 to not deliver more than one amp into the battery while charging. While this is going on (voltage < 5V) the switching step-up controller will actually power the AVR, in parallel with the battery being charged. Further, even when the battery charge switch is turned off, the battery will be in-line with the step-up converter, although that converter will be running "idle." (It's a mc34063 based converter) I imagine I'll need hysteresis in the charge on/off switch -- say, charge to 4.1V, discharge to 4.0V, repeat. Hopefully, that cycle is long with this design while plugged in. The device will be un-plugged every day and recharged overnight, generally.
Finally, I'm enclosing both the schematic and the layout. The biggest annoyance with the lay-out is that the inductors I have are laying down, and thus take up a square inch of the board :-/ That also makes the traces from the switcher to the inductor longer than needs be. On the final board, I will overlay a ground polygon on both sides of the board (2-sided only, no real "planes," sorry :-)
Please be gentle but firm!