[20$ reward][WANTED] Annoying problem on Battery Measurement

Hi everyone, I have a simple but annoying problem here, if you help me solve this thing out, I’ll give you 20$ as a tip.

In short, I have a Pimoroni Pico Lipo with a regular lipo battery, the only thing I wanna do is to measure the battery percentage, but the outcome is abnormal. Here’s the code:

from machine import ADC

voltageInput = ADC(29)
voltageConversionFactor = 3 * 3.3 / 65535

voltage = voltageInput.read_u16() * voltageConversionFactor

print(voltage)

The code above will print something like 0.20 in the shell, which is far away from 3.3 - 4.2V.
The Pimoroni Offical also provided a demo code to measure the battery percentage, but that will print -185% on my Pico, which is far away from 100%.

I spent hours on this problem and tried everything I can. I also notice a previous post which has a similar problem. That user got -194% as result when he tried to measure the battery.

Is this a hardware design flaw?? I’m totally confused, any explain helps, thanks!

Hi all, this problem is solved by a friendly discord user named RebelMike, a true geniuse (or I’m too stupid).

If you have the same problem, just try ADC(Pin(29)) instead of ADC(29). This case has well demostrated that human still can not be replace by GPT (I spent hours asking GPT).

I’m getting in touch with him to give him the bounty :)

1 Like