Firebeetle ESP32 C6 battery level

userHead Peter.Robinson 2024-06-30 05:30:59 25 Views0 Replies

I'm using the Firebeetle ESP32 C6 with Micropython and a LiPo battery.  Analog input A0 is supposed to read the battery voltage level, but it's always zero.  I've tried different attenuation settings, with the same result.  Has anyone succeeded in resading the battery voltage level, and if so how?

 

Here's a snippet of the code I'm using (I've omitted the imports):

 

bat = ADC(Pin(0))
bat.atten(ADC.ATTN_11DB)      #Full range: 3.3v
battery = bat.read() * 3.3 / 4096
print(f"Battery {battery}")

 

All advice gratefully received.