Battery voltage monitor and AD conversion for XIAO_ESP32C

Hi andcoderes,

  1. I am soldering the resistor and was thinking of using a 1MΩ resistor. Should the equation to get the voltage be the same?

Battery voltage is obtained by the same formula.
Vbatt = 2 * analogReadMilliVolts(A0);

  1. Since I’m a noob, I’m afraid that because both resistors are connected to + and - and both connect to A0, could I cause a short circuit?

No problem.

  1. If I detect a low battery and put the device in deep sleep in the loop method, will the USB still charge the battery?

The charge controller charges the battery even in sleep mode.

  1. Can I use another pin for reading? I was checking the schematic for the C6 and was thinking of using the A6 pin at the back.

I have not checked, but I believe it can be used without any problem. Please experiment and post your results.

1 Like