Pimoroni Pico Lipo undocumented features

I’ve been tinkering around with my Pico Lipo. It has a User LED, and the Boot Select Button can be used as a User Button. How to do it isn’t documented though?
The User Switch (Boot Switch) is wired to GPIO 23
The User LED (Green) is wired up to GPIO 25
Also - The Raspberry Pi Pico uses GP29 for Vsys monitoring, Pico Lipo uses it for battery voltage monitoring.

This will blink the User LED. A high turns it on and a low is off.

from machine import Pin, Timer
led = Pin(25, Pin.OUT)
timer = Timer()

def blink(timer):

timer.init(freq=2.5, mode=Timer.PERIODIC, callback=blink)

And this will turn it on when the User Button is pressed, and off again when released.
Button Value is “0” when pressed, and “1” when released though? I was expecting it to be the other way around? From the schematic it looks like its pulled High, and grounds that GPIO pin when pressed.

import time

from machine import Pin
led = Pin(25, Pin.OUT)

button = Pin(23, Pin.IN)

while True:
    if button.value():

The Pimoroni Lipo Shim Battery example will run just fine on the Pico Lipo.
Battery voltage is monitored by GPIO 28 (ADC2) on both.

from machine import ADC, Pin
import time

# Uncomment one of these lines, depending on what display you have
import picodisplay as display
# import picodisplay2 as display

# Set up and initialise display
buf = bytearray(display.get_width() * display.get_height() * 2)

vsys = ADC(29)              # reads the system input voltage
charging = Pin(24, Pin.IN)  # reading GP24 tells us whether or not USB power is connected
conversion_factor = 3 * 3.3 / 65535

full_battery = 4.2                  # these are our reference voltages for a full/empty battery, in volts
empty_battery = 2.8                 # the values could vary by battery size/manufacturer so you might need to adjust them

while True:
    # convert the raw ADC read into a voltage, and then a percentage
    voltage = vsys.read_u16() * conversion_factor
    percentage = 100 * ((voltage - empty_battery) / (full_battery - empty_battery))
    if percentage > 100:
        percentage = 100.00

    # draw the battery outline
    display.set_pen(0, 0, 0)
    display.set_pen(190, 190, 190)
    display.rectangle(0, 0, 220, 135)
    display.rectangle(220, 40, 20, 55)
    display.set_pen(0, 0, 0)
    display.rectangle(3, 3, 214, 129)

    # draw a green box for the battery level
    display.set_pen(0, 255, 0)
    display.rectangle(5, 5, round(210 / 100 * percentage), 125)

    # add text
    display.set_pen(255, 0, 0)
    if charging.value() == 1:         # if it's plugged into USB power...
        display.text("Charging!", 15, 55, 240, 4)
    else:                             # if not, display the battery stats
        display.text('{:.2f}'.format(voltage) + "v", 15, 10, 240, 5)
        display.text('{:.0f}%'.format(percentage), 15, 50, 240, 5)


Got some info from Pimoroni.

Lipo shim battery example: is using GP29. The Raspberry Pi Pico uses GP29 for Vsys monitoring, Pico Lipo uses it for battery voltage monitoring.

The user led is used and wired the same way as on the Raspberry Pi Pico: GP25 is used for LED and not usable for other purposes

Yep, the boot switch can be read via GP23

I’ve hopefully made the shop page a little more helpful with regard to pins :)

There’s a battery example for Pimoroni Pico LiPo here - with this board you can read the battery voltage at the same time as charging it, as you’re measuring VBAT and not just VSYS.

I’ve just added a LED/button example to pimoroni-pico - the button is active low (hence the reversed logic).

from machine import Pin
import time

led = Pin(25, Pin.OUT)
button = Pin(23, Pin.IN, Pin.PULL_DOWN)

while True:
    if not button.value():
1 Like

Thankyou, much appreciated. Just ran the Battery example on my Pico Lipo with a Display Pack2 attached. Knowing the battery state is a handy feature.