General LoPy + Pytrack Sleep Functions

  • Greetings!

    I have a few questions regarding the LoPy with Pytrack expansion board and the sleep functions.

    1. Does the the py = pytrack() and sleep functions sleep the whole system (or just the LoPy for example)? See example code.
    2. Is there a deepsleep for pytrack? Example code intended for the pytrack expansion/ only seems to show just sleep.
    3. How does that function differ from machine.sleep() or machine.deepsleep() from microPython?
    4. Is there an easier way to debug/stop the running code that has sleep functions in it? Such as stopping the example code below? When I program the chip it can be very hard to stop the system with CTRL+C and re-flashing it to be able to access the file system again? Same thing with see print statements. I know when it sleeps it shuts down the UART so it has to reconnect almost instantly to see the outputs, correct?
    5. Is there a way to be notified when firmware updates for both lopy and pytrack are published?
      Example Code.
    from pytrack import Pytrack
    from L76GNSS import L76GNSS
    import time
    import pycoproc
    import pycom
    py = Pytrack()
    l76 = L76GNSS()
    pycom.rgbled(0xff0000) # red
    print("Wakeup reason: " + str(py.get_wake_reason()))
    #print("Approximate sleep remaining: " + str(py.get_sleep_remaining()) + " sec")
    pycom.rgbled(0x0000ff) # blue

  • Hi,

    1. Yes, the way the Pytrack/Pysense/Deepsleep shield sleep works is that they disconnect the power from the module, sensors etc entirely. In the case of the Pysense and Pytrack the USB is also de-initialised meaning you will lose the serial connection, this can make talking to the device difficult if it does not wake up for long
    2. The Pytrack/Pysense/Deepsleep shield sleep is a a "deep" sleep rather than a regular sleep. Once you use this, when the module wakes up it will be like it was rebooted.
    3. Pycom board do not currently support machine.sleep although this is being investigated. The way this differs from the machine.deepsleep is that this uses external hardware and powers off everything on the board, not just the ESP32 processor. You can still use machine.deepsleep if you desire but note that on the WiPy2, LoPy and SiPy, due to an issue with the way the voltage regulator is connected the deepsleep current draw will be quite high (15mA)
    4. If you connect P12 to 3.3v with a jumper cable and wait for the device to wake from sleep you will see the on-board LED blink orange. Once this happens you can disconnect the cable. The device will now "safe boot". This prevents the device from running and and therefore the code putting the device to sleep.
    5. The best way to stay informed of firmware updates is to use the forums subscribe feature for the announcements forum. We will always post in there when a new firmware is released

Pycom on Twitter