Hello all,
I'm looking at the picowbell documentation, which has a helpful circuitpython example here:
viewtopic.php?p=970723#p970723
However, the example only uses time.sleep, rather than giving a deep sleep example. Does the picowbell have the ability to wake the Raspberry Pi Pico while that's completely turned off?
(This is a follow-on post from viewtopic.php?p=970723#p970723)
Pico and Picowbell - deep sleep?
Moderators: adafruit_support_bill, adafruit
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
- mikeysklar
- Posts: 13824
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Pico and Picowbell - deep sleep?
The Adafruit PiCowbell Adalogger provides an external RTC PCF8523.
There is example code provided by @bablokb for deepsleep / light sleep and setting pin alarms for wakeup.
https://github.com/bablokb/pico-sleepcurrent
There is example code provided by @bablokb for deepsleep / light sleep and setting pin alarms for wakeup.
https://github.com/bablokb/pico-sleepcurrent
Code: Select all
#-----------------------------------------------------------------------------
# Test program pico-sleep mode: PinAlarm via external RTC interrupt
#
# Author: Bernhard Bablok
#
# Website: https://github.com/pico-sleepcurrent
#-----------------------------------------------------------------------------
import time
import board
import alarm
from digitalio import DigitalInOut, Direction, Pull
from adafruit_pcf8523 import PCF8523 as PCF_RTC
#from adafruit_pcf8563 import PCF8563 as PCF_RTC
LED_TIME = 1
INT_TIME = 30 - LED_TIME
WAKE_PIN = board.GP4 # connect to RTC-INT
SDA_PIN = board.GP2 # connect to RTC-SDA
SCL_PIN = board.GP3 # connect to RTC-SCL
LIGHT_SLEEP = 0x3
DEEP_SLEEP = 0x4
MODE = DEEP_SLEEP
if hasattr(board,'NEOPIXEL'):
import neopixel_write
led = DigitalInOut(board.NEOPIXEL)
led.direction = Direction.OUTPUT
led_power = DigitalInOut(board.NEOPIXEL_POWER)
led_power.direction = Direction.OUTPUT
led_value = bytearray([255,0,0]) # GRB
else:
led = DigitalInOut(board.LED)
led.direction = Direction.OUTPUT
intpin = DigitalInOut(WAKE_PIN)
intpin.direction = Direction.INPUT
i2c = busio.I2C(SCL_PIN,SDA_PIN)
rtc = PCF_RTC(i2c)
# --- simulate work --------------------------------------------------------
def work():
if hasattr(board,'NEOPIXEL'):
led_power.value = 1
neopixel_write.neopixel_write(led,led_value)
time.sleep(LED_TIME)
led_power.value = 0
else:
led.value = 1
time.sleep(LED_TIME)
led.value = 0
# --- reset rtc ------------------------------------------------------------
def reset():
rtc.timerA_enabled = False
rtc.timerA_interrupt = False
rtc.timerA_status = False
rtc.timerA_frequency = rtc.TIMER_FREQ_1HZ
rtc.timerA_value = INT_TIME
rtc.timerA_enabled = True
# --- main loop ------------------------------------------------------------
while True:
reset()
work()
pin_alarm = alarm.pin.PinAlarm(WAKE_PIN,value=False,edge=True,pull=True)
if MODE == LIGHT_SLEEP:
alarm.light_sleep_until_alarms(pin_alarm)
elif MODE == DEEP_SLEEP:
alarm.exit_and_deep_sleep_until_alarms(pin_alarm)
- bjohas
- Posts: 27
- Joined: Sun Nov 30, 2014 7:58 am
Re: Pico and Picowbell - deep sleep?
Hi @mikeysklar,
Thank you so much, I will try that out.
I'm realising that there are two ways of doing 'deep sleep'. One is via the EN (3V3_EN). The Picowbell says "EN (3V3_EN) - This connects to the enable pin on the Raspberry Pi Pico, and is pulled high (to VSYS) via a 100kΩ resistor." I will def try this, to check how much power it draws. Where I've tried this, on other borads (see post on challeger, or Pico directly) the draw is around 7 mA. That's around 5 times less than the 'wake' state (around 40 mA).
However, there is another way of doing 'deep sleep', which is to use an external circuit that cuts interrupts.
This approach is taken here:
Thank you so much, I will try that out.
I'm realising that there are two ways of doing 'deep sleep'. One is via the EN (3V3_EN). The Picowbell says "EN (3V3_EN) - This connects to the enable pin on the Raspberry Pi Pico, and is pulled high (to VSYS) via a 100kΩ resistor." I will def try this, to check how much power it draws. Where I've tried this, on other borads (see post on challeger, or Pico directly) the draw is around 7 mA. That's around 5 times less than the 'wake' state (around 40 mA).
However, there is another way of doing 'deep sleep', which is to use an external circuit that cuts interrupts.
This approach is taken here:
- See schematic of the enviro indoor (with pico w) https://shop.pimoroni.com/products/enviro-indoor and the
- approach taken here https://github.com/bablokb/pcb-pico-en-control/ by bablokb (see also here: https://forums.pimoroni.com/t/low-power ... bell/22086).
- mikeysklar
- Posts: 13824
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Pico and Picowbell - deep sleep?
The TPL511x is definitely the way for maximum efficiency. If you can use that hardware with your project it will get you the most out of sleep without having to actually code anything around sleep.
- bjohas
- Posts: 27
- Joined: Sun Nov 30, 2014 7:58 am
Re: Pico and Picowbell - deep sleep?
Thank you - yes, that seems to be the case.
Just a quick type correction on my above post.
> However, there is another way of doing 'deep sleep', which is to use an external circuit that cuts interrupts.
interrupts -> power
Thanks!
Just a quick type correction on my above post.
> However, there is another way of doing 'deep sleep', which is to use an external circuit that cuts interrupts.
interrupts -> power
Thanks!
- adafruit2
- Posts: 22111
- Joined: Fri Mar 11, 2005 7:36 pm
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/