Page 1 of 1

Wake up PyBoard

Posted: Fri Aug 24, 2018 12:32 pm
by Robert
Hi,

Is there another way to wake up PyBoard in stop or standby mode?

import pyb
rtc = pyb.RTC()
rtc.wakeup(1000) # wakeup every 1000 ms (1 second)
while True:
do_some_processing()
pyb.stop()

Thank you

Re: Wake up PyBoard

Posted: Sat Aug 25, 2018 4:41 am
by shaoziyang
In standby mode, the only way to wake pyboard is reset. In stop mode, you may use RTC or pin level irq to wake it.

Code: Select all

def pin1_irq(t):
	#do something
	return

pin1 = Pin(Pin('B0'), Pin.IN)
pin1.irq(handler=pin1_irq, trigger=Pin.IRQ_FALLING)

Re: Wake up PyBoard

Posted: Sat Aug 25, 2018 4:50 am
by pythoncoder
Yes. For ways to wake from standby and more information on building low power systems I suggest you look at this repo. Standby has the characteristic that program state is lost: it behaves similarly to a soft reset. This limits its application areas.

Waking from stop is much more versatile, because program state can be retained while stopped. My fork of uasyncio here provides a module which enables any asynchronous application to stop for a period and resume where it left off. There is a demo lpdemo.py which waits for a button press with low power consumption, retaining program state.