XIAO BLE How to Run on Battery with Switch

I have a lipo battery powering my XIAO via the pads on the bottom which is good. I now want to be able to charge the battery using the charging circuit + usbc port and to have a switch so the board can be turned off/on when running on battery anc not charging?

Also is there a way to detect which power source is being used?

Any advice here? Has anybody hooked an on/off switch up to a XIAO? Would really love some help. I can’t figure out how to wire it up to also support charging a rechargeable lipo

I wish to know this as welll.

Hi,
There is a charging schematic for the XIAO BLE that you may find helpful in post #2 of the link below.

Charging characteristics of XIAO_nRF52840 and XIAO_ESP32C3

If you can organize what you want to do and ask specific questions, we may be able to offer some advice.