I got a XIAO ESP32C3 board which is connected to a battery which charges through the USB-C connection. I want to install an on/off slide switch to be able to turn off the device. The battery should always charge as long as it is plugged and the board program should only be running if the switch if “on”.
I am not sure where do I need to install the 3-pins slide switch (example) on my circuit to make this work. Does someone has a clue how I can go about this? I did ask a similar question on Arduino forums (link).
Hi there,
Take a look at the schematic for the "grove xiao Expansion Board , It has a Power switch and battery management. You can get some Idea of what to do , Or mount the Xiao on that and even add the expansion flash memory too …
HTH
GL PJ
When the “EN pad” on the back of XIAO is set to LOW with the switch, the chip power is turned off (the same state as when the Reset switch on the top of XIAO is pressed).
The data sheet “4.6 Current Consumption Table 17: Current Consumption Depending on Work Modes” says that the chip current consumption when Power is off is 1uA.
The device is charged when connected to USB regardless of the switch.
(I have not tried this).
I tried it, but it consumes 400uA from the battery even with EN=LOW (ResetSW=ON). This current is due to the pull-up resistor of ResetSW.
@PJ_Glasso I looked into those boards and it seems they simply connect a switch in between the BAT+ pin and GND. It does says in the docs that the battery charges when USB-C is powered and the switch is “on”, so it won’t charge if it is “off”.
@msfujino thank you so much for conducting the experiment with the EN pad.Could the reset switch be removed?
I was also considering using the switch to trigger deep sleep mode which would consume only 5uA. Though it is still 5 times less battery life at rest compared to disabling the chip.
Hi there,
Yes, If you want to see what that looks like check out the Grove Expansion Demo I posted on here. You push the button to make it Deep sleep and again to reset and resume.