How to use Low Power Sleep Mode on the PICO? code examples?

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
aslamxtreme
Posts: 1
Joined: Tue Feb 09, 2021 12:01 pm

How to use Low Power Sleep Mode on the PICO? code examples?

Post by aslamxtreme » Tue Feb 09, 2021 12:13 pm

HI.. I want to reduce the power consumption to the minimum for my project which involves reading an Input once every minute.. and transmitting a byte using HC12 RF module.. "utime.sleep(60)" does not seem to put the board in low power sleep mode for a minute.. any suggestions ? Thanks

NameOfTheRose
Posts: 7
Joined: Tue Jun 29, 2021 7:12 am

Re: How to use Low Power Sleep Mode on the PICO? code examples?

Post by NameOfTheRose » Fri Dec 02, 2022 9:27 am

Sorry for the delayed response, you might have already found the answer to your question.
The latest micropython releases provide a lightsleep function in the machine module that does that. I have tested on a rpi pico
with rp2-pico-20221128-unstable-v1.19.1-721-gd5181034f.uf2 (The latest stable version 1.9.1 does not implement this). Current drops from 20mA to 1.5mA.

Code: Select all

import machine,time
led=machine.Pin(25,machine.Pin.OUT)
led.value(1)
time.sleep(30)
led.value(0)
machine.lightsleep(30000) # sleep time in ms
led.value(1)
If on W10 it might be necessary to disconnect/reconnect USB to re-stablish communication (ie you must also provide backup power via VSYS).
On rpi that seems unnecessary.
The feature was announced here and here.

Post Reply