Pico Lipo not reading battery voltage

I have a pico lipo (16mb) with the pico display. I uploaded the example code from github to display the battery voltage on the screen. The screen shows .2v/-188%. Adding print(vsys.read_u16()) to the code prints 1400-1500 which lines up with what is displayed. Battery voltage is 4.05v. The same readings are displayed regardless if the battery is connected. Board does run off of the battery so voltage is getting to the mcu. Charging indication works and reflects whether or not the usb cable is plugged in.

while plugged in:
vs: 4.851v
vb: 5.128v

On battery:
vs: 4.038v
vb: 0.005v

Getting the same! Looks like this example needs updating to keep pace with upstream MicroPython changes.

Try setting up the vsys read pin like this:

vsys = ADC(Pin(29))

There’s a Github issue here about why it’s happening here if you fancy some light reading :) RP2040: ADC value different in ADC(channel) vs ADC(Pin(#)) · Issue #10947 · micropython/micropython · GitHub

Thank you! That fixed it. Apparently my google-fu needs some training.

1 Like