3v3 pin how to read voltage

Hello
Due to some issue with battery plug i decided to use 3v3 pin for battery in my ab01 heltec’s.
Can anyone help me with code how to read battery voltage from that pin?

Maybe follow the link in this response:


You can’t read the voltage from that pin directly so, if you’re going to bypass the internal battery management circuitry (by not using the JST1.25 battery connector), you’ll have to build something similar externally.

I too have been struggling with this same intent of measuring the 3.3v when a battery is connected to the 3.3v input as shown in diagram above. The method that I have come up with for the V2 AB01 is to use Vext (which is MOSFET controlled. I connected Vext to the ADC input with a voltage divider (the ADC max input is 2.4v). UniquePete’s write-up above finally clarified for me what I couldn’t figure out from the documentation (THANKS UniquePete!! for your writeup). You will have use “battery = (analogReadmV(ADC) * 2) / 1000;” in your code (after turning Vext on) to read the 3.3v in voltage. Note the ADC reference which reads the analog input on the module’s ADC input and not Vbat.