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

    deepsleep maximum time

    Scheduled Pinned Locked Moved LoPy
    deepsleep
    22 Posts 7 Posters 6.3k Views 7 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
      dhk111
      last edited by

      Q1) what is the maximum time(seconds or hours) lopy can remain in deepsleep. I am using lopy+deepsleepshield+expansionboard.

      Q2) is it possible to do this " lopy sleeps forever and only wakes when pin 17 changes state, do the required thing and go back to sleep."

      thanks in advance.

      L 1 Reply Last reply Reply Quote 1
      • sebS Offline
        seb
        last edited by

        Hi,

        Q1) The deepsleep time is set as a 3 byte value in seconds, so therefore the maximum sleep time is 2^(8*3) seconds = 16,777,216 seconds = 27.7 weeks

        Q2) In regards to waking on pin P17 please see the docs here: https://docs.pycom.io/chapter/datasheets/boards/deepsleep/api.html

        You can do this like so:

        ds.enable_pullups('P17')
        ds.enable_wake_on_fall('P17') 
        ds.enable_wake_on_fall('P17')
        ds.go_to_sleep(100) #Sleep for 100s
        

        When the deep sleep shield goes to sleep, the LoPy will be completely unpowered, when it wakes up (either via a change on P17 or after 100s in the example above) the LoPy will begin code execution just as if you had pressed the reset button on the module.

        I hope this answers your questions

        D C 2 Replies Last reply Reply Quote 0
        • D Offline
          dhk111 @seb
          last edited by

          @seb thank you for the reply.
          can you please tell me why 3 byte value.

          1 Reply Last reply Reply Quote 0
          • sebS Offline
            seb
            last edited by

            I don't think there is a specific reason why 3 bytes were chosen, that is just how the firmware on the deepsleep shield was created.

            1 Reply Last reply Reply Quote 0
            • L Offline
              livius @dhk111
              last edited by

              @dhk111
              just curious - why do you need to sleep board forever? I can not imagine design.

              think about people first, then computers

              D 1 Reply Last reply Reply Quote 0
              • D Offline
                dhk111 @livius
                last edited by

                @livius I am measuring temperature from attiny85 if the temperature rises certain limit it would send signal on pin17 and lopy wakes do the needful and go to sleep until temperature rises again. So the period between successive temperature rises, may be less than 27.7 weeks or greater. During this period, I need to lopy to sleep.

                sebS L S 3 Replies Last reply Reply Quote 0
                • sebS Offline
                  seb @dhk111
                  last edited by

                  @dhk111
                  I think it would be ok to sleep for 27.7 weeks and then wake up, check the wake reason, if it was not a pin change, go back to sleep. Waking twice a year is not really going to use a lot of power

                  D 1 Reply Last reply Reply Quote 0
                  • L Offline
                    livius @dhk111
                    last edited by

                    @dhk111

                    do the needful

                    I am really curious :) what it do then, send message to the server?

                    think about people first, then computers

                    D 1 Reply Last reply Reply Quote 0
                    • C Offline
                      combaindeft @seb
                      last edited by

                      @seb

                      Regarding Deepsleep mode, does one really have to use a "Deep Sleep Shield"?

                      I'm wondering, since the case we use is tight on space, and we only can fit a PyTrack & LoPy board inside the case ... could we do some sort of "deep sleep" mode with just the two? (without a deep sleep sheield...)

                      /Daniel

                      J J 2 Replies Last reply Reply Quote 0
                      • sebS Offline
                        seb
                        last edited by

                        With the LoPy/SiPy/WiPy2 the onboard regulator remains in a high performance mode even when the device does into sleep mode, hence the need for the additional board to externally disconnect the power. If you are tight on space I would recommend one of our newer boards (LoPy4/GPy/FiPy/WiPy3) which dont have this issue and work perfectly with just the eps32 deep sleep

                        C 1 Reply Last reply Reply Quote 1
                        • J Offline
                          jmarcelino @combaindeft
                          last edited by

                          This post is deleted!
                          1 Reply Last reply Reply Quote 0
                          • D Offline
                            dhk111 @seb
                            last edited by

                            @seb thank you. 27.7 weeks is more than enough for my project.

                            1 Reply Last reply Reply Quote 0
                            • D Offline
                              dhk111 @livius
                              last edited by

                              @livius needful= check if temperature is really high, then send mail,notification

                              L 1 Reply Last reply Reply Quote 0
                              • L Offline
                                livius @dhk111
                                last edited by

                                @dhk111
                                Ok, i assume that this notification is not critical?
                                Because you have not any info between wake up, that control device still is working.

                                think about people first, then computers

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

                                  @seb

                                  Then I guess, we'll have to go for a LoPy4 or FiPy :)

                                  Thanks @seb

                                  1 Reply Last reply Reply Quote 0
                                  • S Offline
                                    ssmith @dhk111
                                    last edited by

                                    @dhk111 You're going to have issues with this system design. A sensor need to periodically wake up and report in so you know it is still alive. Waiting 27 weeks for it to wake up and check in???

                                    1 Reply Last reply Reply Quote 0
                                    • J Offline
                                      jcaron @combaindeft
                                      last edited by

                                      @combaindeft if you use a Pytrack or Pysense you don’t necessarily need the deep sleep shield. The Pytrack and Pysense have equivalent functionality, though wake on pin is a bit more problematic.

                                      Of course if you use one of the newer boards you don’t need either.

                                      @seb are you sure about the 24-bit value being in seconds? On a mobile right now so I’m too lazy to check, but IIRC the value in seconds is multiplied by a calibration factor, and it’s the result which is sent on 24 bits. Don’t know the typical values of the calibration factor, but it can decrease the max time quite a bit (and you would certainly get an overflow if you tried to use 2^24-1)

                                      It would probably be a good idea to check for overflows in the library and document a sensible max time.

                                      While you’re in the docs, it would be helpful for many people to add details of the « external deep sleep » requirements in the machine.deepsleep docs.

                                      sebS C 2 Replies Last reply Reply Quote 0
                                      • sebS Offline
                                        seb @jcaron
                                        last edited by

                                        @jcaron

                                        You are correct, upon further investigation I now see that there is a clock calibration multiplier that will multiply the value given by a value in the the range 0.75 - 1.25, so yes the longest duration of deep sleep can vary slight on a per device basis. Also, like you pointed out, this is not bounds checked so this multiplier could overflow, I will fix this in the code now.

                                        In regards to the various deep sleeps, I agree the documentation around these features does need to be clearer. I am adding it to my to-do list

                                        1 Reply Last reply Reply Quote 1
                                        • C Offline
                                          combaindeft @jcaron
                                          last edited by

                                          @jcaron We bought a set of PyTracks & LoPy's in Januari ;)

                                          and wake on pin isn't that of a high priority for us ... we'd just like to put the device in "deepsleep mode" ... and have it wake up now-and-then ... and "check in" with some values ...

                                          so it doesn't have to "wake up" on pin from some other external sensor ... more or less we are ok with a "deepsleep cycle loop" :)

                                          Do you by any chance have some samples code?

                                          sebS 1 Reply Last reply Reply Quote 0
                                          • sebS Offline
                                            seb @combaindeft
                                            last edited by

                                            @combaindeft

                                            Since you are using the LoPy, you will need the deepsleep shield to have the deepsleep to work correctly. Examples on how to use it can be found here: https://docs.pycom.io/chapter/datasheets/boards/deepsleep/api.html

                                            J 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
                                            • 1 / 2
                                            • First post
                                              Last post

                                            Pycom on Twitter

                                            Pycom