Interrupt wakeup from deepsleep

  • Hi everyone,

    As I understand it to put my lopy to deepsleep with the pysense/pytrack boards, I have to use the respective board libraries. For example: pytrack.setup_sleep() and pytrack.go_to_sleep() and not machine.deepsleep(). But opposed to the machine.deepsleep() I cant find any way to wakup from deepsleep with a hardware interrupt yet. I need to wakeup my devices with a raising edge from an input pin. Has anyone done this? Or is this something that is still missing in the current releases?


  • @chrisi if you are using the Deep Sleep shield, then you have the relevant functions in the library that goes with it.

    If you are using a Pysense (and I believe the same applies to the Pytrack), then it's a lot more complex. There's only one usable pin on the I/O header, you need to patch the Pysense firmware, isolate a pin between the module and the Pysense, and change a few things in the sleep process. But it does work.

    Refer to for details.

  • Has there been any updates on how to wake up a Pycom device from deep sleep with an interrupt?

  • @livius said in Interrupt wakeup from deepsleep:

    Pin('P10', mode=Pin.IN, pull=Pin.PULL_DOWN)

    I also wondered how deep sleep with pysens and pytrack works, so I tested this myself:

    During deep_sleep the pyboard is not power at all! So basically the PIC of the pysens or pytrack does disconnect the supply voltage from the pyboard! The only thing which ever is able to wake the pyboard is the PIC. I guess the intention of pycom here is to provide a "software" solution which will make the PIC aware of selected interrupts. Of course this is limited to the interrupts which are physically routed to the PIC.
    So you likely have to wait for pycom to come up with their software solution till this is going to work ...

  • @dbrgn
    what if you add first

    p_in = Pin('P10', mode=Pin.IN, pull=Pin.PULL_DOWN)

  • @livius said in Interrupt wakeup from deepsleep:

    I didn't tried wake up by pins yet. Then the best is trying it self. I am interested about results :)

    Alright. With this code:

    import pycom
    import utime
    import machine
    from lib.pysense import Pysense
    py = Pysense()
    pycom.rgbled(0xff00ff)  # pink
    machine.pin_deepsleep_wakeup(['P10'], mode=machine.WAKEUP_ANY_HIGH, enable_pull=True)
    pycom.rgbled(0xff0000)  # red

    ...the board should sleep for 10 seconds, with a way to wake it up with 3.3V on the P10 pin. I just tried it and it doesn't work. (Makes sense, since the pysense library probably controls different hardware than the machine module.)

  • @cfaessler
    I didn't tried wake up by pins yet. Then the best is trying it self. I am interested about results :)

  • @livius thank you. But does this also work when i use the pysense board librarie's deepsleep mode and not the machine.deepsleep mode?

Pycom on Twitter

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.