Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Does deepsleep work at all

    Scheduled Pinned Locked Moved Discussion
    deepsleep
    83 Posts 20 Posters 50.3k Views 23 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      daniel
      last edited by

      @tmz so it simply goes out to the REPL without running your code? Do you have any condition in your code that could cause that (exit the script instead of going into deepsleep)? Do you have anything connected to P12? Maybe at some point the board is booting into safe mode...

      T 1 Reply Last reply Reply Quote 0
      • T Offline
        tmz @daniel
        last edited by

        @daniel The deep sleep works! But then at one point without any error it's not entering into next deep sleep cycle instead is enter into REPL.

        1 Reply Last reply Reply Quote 0
        • D Offline
          daniel
          last edited by

          @tmz what you say is that after calling the go_to_sleep() the deepsleep shield doesn't put the LoPy to sleep?

          T 2 Replies Last reply Reply Quote 0
          • T Offline
            tmz @daniel
            last edited by

            @daniel Yes, executing go_to_sleep() some cycles works and than at one point it's not enter into deep sleep mode.

            Do you have anything connected to P12?
            Nothing connected to P12.

            For debugging i was running connected over "Serial" to see what happens and for some time (cca. 5 - 20 cycles) works normally and then without errors enters into REPL.

            code:

                # Setup deep sleep mode
                ds = DeepSleep()
                ds.enable_wake_on_raise('P17')
                # Some work here
                ds.go_to_sleep(60)
            
            1 Reply Last reply Reply Quote 0
            • T Offline
              tmz @daniel
              last edited by

              @daniel
              I make now the execution
              Deep sleep ends after 4 cycles.

              LoPy on Expansion board with "DeepSleep Shield"
              Firmware version: 1.7.9.b1

              deepslep.py latest: https://github.com/pycom/pycom-libraries/commit/074bc7ee0181451720bbeb30d627debafc617ad8

              Run 60 seconds deepsleep interval.

              Output:

              MicroPython v1.8.6-740-g5b756011 on 2017-08-07; LoPy with ESP32
              Type "help()" for more information.
              >>>
              >>>
              >>> ets Jun  8 2016 00:22:57
              
              rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
              ets Jun  8 2016 00:22:57
              
              rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
              configsip: 0, SPIWP:0xee
              clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
              mode:DIO, clock div:1
              load:0x3fff9010,len:12
              ho 0 tail 12 room 4
              load:0x3fff9020,len:388
              load:0x40078000,len:11584
              load:0x4009fb00,len:848
              entry 0x4009fc9c
              
              ****DEEP SLEEP MODE****
              
              Do sem work for 3 seconds
              End work go deep sleep for 1min
              
              Brownets Jun  8 2016 00:22:57
              
              rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
              ets Jun  8 2016 00:22:57
              
              rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
              configsip: 0, SPIWP:0xee
              clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
              mode:DIO, clock div:1
              load:0x3fff9010,len:12
              ho 0 tail 12 room 4
              load:0x3fff9020,len:388
              load:0x40078000,len:11584
              load:0x4009fb00,len:848
              entry 0x4009fc9c
              
              ****DEEP SLEEP MODE****
              
              Do sem work for 3 seconds
              End work go deep sleep for 1min
              
              Brownets Jun  8 2016 00:22:57
              
              rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
              ets Jun  8 2016 00:22:57
              rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
              configsip: 0, SPIWP:0xee
              clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
              mode:DIO, clock div:1
              load:0x3fff9010,len:12
              ho 0 tail 12 room 4
              load:0x3fff9020,len:388
              load:0x40078000,len:11584
              load:0x4009fb00,len:848
              entry 0x4009fc9c
              
              ****DEEP SLEEP MODE****
              
              Do sem work for 3 seconds
              End work go deep sleep for 1min
              
              Brownets Jun  8 2016 00:22:57
              
              rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
              ets Jun  8 2016 00:22:57
              
              rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
              configsip: 0, SPIWP:0xee
              clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
              mode:DIO, clock div:1
              load:0x3fff9010,len:12
              ho 0 tail 12 room 4
              load:0x3fff9020,len:388
              load:0x40078000,len:11584
              load:0x4009fb00,len:848
              entry 0x4009fc9c
              
              ****DEEP SLEEP MODE****
              
              Do sem work for 3 seconds
              End work go deep sleep for 1min
              MicroPython v1.8.6-740-g5b756011 on 2017-08-07; LoPy with ESP32
              Type "help()" for more information.
              >>>
              >>>
              
              1 Reply Last reply Reply Quote 0
              • D Offline
                daniel
                last edited by

                @tmz Do you have a pull-down on P17? I think what is happening is that noise is waking up the deepsleep shield before it gets to turn off the LoPy completely. Please try putting an external pull-down to P17 and disabling the internall pull-up with the deepsleep library.

                T C 3 Replies Last reply Reply Quote 1
                • T Offline
                  tmz @daniel
                  last edited by

                  @daniel said in Does deepsleep work at all:

                  Do you have a pull-down on P17?
                  I have plugged the P17 and GND to have an option to wakeup (with normally close switch) and set ds.enable_wake_on_raise('P17').

                  Now tested "without plugging P17 with GND".
                  Running the example from documentation:

                  ...
                  ds.enable_pullups('P17')  # can also do ds.enable_pullups(['P17', 'P18'])
                  ds.enable_wake_on_fall('P17') # can also do ds.enable_wake_on_fall(['P17', 'P18'])
                  ...
                  

                  With same result as before it runs 5 cycles and ends.

                  At home i don't have any resistor i will let you know tomorrow.

                  1 Reply Last reply Reply Quote 0
                  • C Offline
                    chumelnicu @chumelnicu
                    last edited by

                    @chumelnicu Hi Daniel, sorry for late update but i was in holliday until yesterday.

                    I did try deepsleep with new DeepSleep library and llopy behive same. After 14-15 DS cycles program stop running.

                    I use lopy with DS Shield powered from USB and nothing on Pin12.
                    Condition to wake up, is time, w-up after 10 minutes.
                    Do u have any ideea what is wrong?

                    Thx !

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      tmz @daniel
                      last edited by

                      @daniel The result is the same. Stops after (5 - 20) cycles. How do i run in more verbose way? There is no error, it's jumps into REPL.

                      1 Reply Last reply Reply Quote 0
                      • C Offline
                        chumelnicu @daniel
                        last edited by

                        @daniel Could you tell me how and when DeepSleep will work ? Im not only one who claim about this problem and I think is really time to clarify with your team what is happening

                        Thank you !

                        1 Reply Last reply Reply Quote 1
                        • R Offline
                          Robin @adam_IoTK
                          last edited by

                          @adam_IoTK

                          I have the same problem with a LoPy + Deep sleep shield.
                          My code runs for 20-40 times and then stops. Issue reported here: https://forum.pycom.io/topic/1685/lopy-with-deep-sleep-shield-is-unstable

                          This is a blocker for any real world deployment.
                          Not having seen any useful response from the Pycom team on the forum about this issue i am considering moving to another platform to get my project finished.

                          1 Reply Last reply Reply Quote 0
                          • D Offline
                            daniel
                            last edited by

                            Hello,

                            The instability has been fixed here: https://github.com/pycom/pycom-libraries/commit/ea3e22c14884671801bcd1cfe49c703bc63c7078

                            We are now working on reducing the deep sleep current.

                            Cheers,
                            Daniel

                            T R J C 4 Replies Last reply Reply Quote 0
                            • T Offline
                              tmz @daniel
                              last edited by

                              @daniel
                              Thank you! The issues seems to be fixed after this fix.
                              Is > 8h without interruption.

                              LoPy v1.7.9.b3
                              Expansion board (with deep sleep shield)
                              Fix: https://github.com/pycom/pycom-libraries/commit/ea3e22c14884671801bcd1cfe49c703bc63c7078

                              1 Reply Last reply Reply Quote 0
                              • R Offline
                                Robin @daniel
                                last edited by

                                @daniel Seems to work for me too now.
                                Adding the garbage collector statements in the calling code seems to be crucial through.

                                1 Reply Last reply Reply Quote 0
                                • J Offline
                                  johncaipa @daniel
                                  last edited by

                                  @daniel I'm testing the deepsleep example but I get the following errors:

                                  Traceback (most recent call last):
                                  File "main.py", line 7, in <module>
                                  File "/flash/lib/deepsleep.py", line 143, in get_wake_status
                                  File "/flash/lib/deepsleep.py", line 76, in peek
                                  IndexError: bytes index out of range

                                  I am doing something wrong?
                                  thanks

                                  T 1 Reply Last reply Reply Quote 0
                                  • T Offline
                                    tmz @johncaipa
                                    last edited by

                                    @johncaipa

                                    Try the latest - https://github.com/pycom/pycom-libraries/blob/master/deepsleep/deepsleep.py

                                    J A 2 Replies Last reply Reply Quote 0
                                    • J Offline
                                      johncaipa @tmz
                                      last edited by

                                      @tmz that is the library I'm using, and which errors are generated

                                      B 1 Reply Last reply Reply Quote 0
                                      • A Offline
                                        Arnaud @tmz
                                        last edited by

                                        @tmz said in Does deepsleep work at all:

                                        https://github.com/pycom/pycom-libraries/blob/master/deepsleep/deepsleep.py

                                        Just tried the deepsleep example on Sipy 1.0 - Pytrack 1.0 with latest deepsleep.py and after firmware upgrade to 1.7.9b3 and got the same error than John.

                                        I understood that Pytrack serves as deepsleep shield.
                                        All this deepsleep troubles merged with lack of documentation is really frustrating...

                                        A 1 Reply Last reply Reply Quote 0
                                        • D Offline
                                          daniel
                                          last edited by

                                          @Arnaud with pytrack or pysense simply use their own libraries which also provide the deepsleep functionality:

                                          https://github.com/pycom/pycom-libraries/tree/master/pytrack

                                          A 1 Reply Last reply Reply Quote 0
                                          • A Offline
                                            Arnaud @Arnaud
                                            last edited by

                                            Nice to hear that! Please help us with a bit more explicit documentation. You might be aware of this now based on the comments, you're building up hours of frustration which is not was intended at first I'm sure with the beautiful specs of your products.

                                            BTW, I think deepsleep example lacks an import deepsleep for constants.

                                            1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better đź’—

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 2 / 5
                                            • First post
                                              Last post

                                            Pycom on Twitter

                                            Pycom