XIAO_BLE_Sense(mbed 2.7.2) battery charge and voltage monitor, analogRead(P0_31) does not work

You cannot apply VBAT directly to any port of nRF52840. According to datasheet the absolute maximum input voltage is (VDD + 0.3V) or 3.6V. A charged battery can rise up to 4.2V and so you must always use a potential divider to step down the voltage.

You can also easily calculate the voltage at P0.31 to be around 3.6V when the battery reaches 4.2V and P0.14 is off. This is the risk mentioned by Seeed.

As long as you use correct ADC resolution and potential divider values, the voltage measurement will be fine.

1 Like