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

    Wake up from deep sleep via accelerometer outputs?

    Scheduled Pinned Locked Moved Discussion
    @lopy4 pysense
    10 Posts 4 Posters 627 Views 4 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.
    • G Offline
      gabrielapb
      last edited by

      I am using Lopy4 + PySense and trying to use PySense accelerometer measurements to define my wake up condition based on a threshold determined by me. How is it possible?

      Also, what is the difference between using machine.deepsleep and the Deep Sleep API? Sorry, I just started with Pycom

      #Lopy4 #PySense

      1 Reply Last reply Reply Quote 0
      • P Offline
        Paul Thornton
        last edited by

        machine.deepsleep() just puts the lopy4 to sleep.

        The deepsleep API can be used with some of our expansion boards (Pysense/track ect) to also put that to sleep as well.

        G 2 Replies Last reply Reply Quote 0
        • P Offline
          Paul Thornton
          last edited by

          We have a basic example of "wake on shake" available here: https://github.com/pycom/pycom-libraries/blob/master/examples/accelerometer_wake/main.py

          1 Reply Last reply Reply Quote 0
          • G Offline
            gabrielapb @Paul Thornton
            last edited by gabrielapb

            This post is deleted!
            P 1 Reply Last reply Reply Quote 0
            • P Offline
              Paul Thornton @gabrielapb
              last edited by

              @gabrielapb said in Wake up from deep sleep via accelerometer outputs?:

              While sleeping, the device should still be able to keep running the RTC and saving the measurements in a file.

              Unfortunately, sleeping means just that. It's asleep. you can have it wake up every "X" period. take a measurement and write it to the file then go back to sleep.

              Yes. When waking up it will indeed restart the script. You can use the wake reason to see why it was woken up and react accordingly.

              Ie run one set of functionality if the wake reason was the accelerometer. another if it was due to a timer.

              1 Reply Last reply Reply Quote 0
              • G Offline
                gabrielapb @Paul Thornton
                last edited by

                @paul-thornton Why are there 2 different libraries to put the expansion boards to sleep? (via pysense lib and deepsleep API)

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

                  @gabrielapb said in Wake up from deep sleep via accelerometer outputs?:

                  @paul-thornton Why are there 2 different libraries to put the expansion boards to sleep? (via pysense lib and deepsleep API)

                  The machine API does not know which hardware is connected. So it will send only the LoPy into sleep mode and not the pysense board. The pysense board will cut the power to the *Py, so it will be forced to sleep as well ;)

                  G 1 Reply Last reply Reply Quote 0
                  • G Offline
                    gabrielapb @crumble
                    last edited by gabrielapb

                    @crumble Thanks, I got this part, but now I am actually asking about this https://docs.pycom.io/datasheets/boards/deepsleep/api.html and https://docs.pycom.io/pytrackpysense/apireference/sleep.html, since both can be used to put Pysense to sleep

                    J P 2 Replies Last reply Reply Quote 0
                    • J Offline
                      jcaron @gabrielapb
                      last edited by

                      @gabrielapb the first one is specifically for the Deep Sleep shield which has equivalent functionality to the Pysense for deep sleep control only (it was a workaround for some of the early modules which used too much power while in machine.deepsleep).

                      You should definitely use the Pysense lib.

                      1 Reply Last reply Reply Quote 1
                      • P Offline
                        Paul Thornton @gabrielapb
                        last edited by

                        @gabrielapb said in Wake up from deep sleep via accelerometer outputs?:

                        @crumble Thanks, I got this part, but now I am actually asking about this https://docs.pycom.io/datasheets/boards/deepsleep/api.html and https://docs.pycom.io/pytrackpysense/apireference/sleep.html, since both can be used to put Pysense to sleep

                        DeepSleep() is there for those that dont need the extra Pytrack/Pysense functionality. the versions inside the Pytrack/Pysense class are the same as DeepSleep() but included in the Pytrack/Pysense libs as a convinience. .

                        @jcaron has this perfectly. use the Pysense lib.

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

                        Pycom on Twitter

                        Pycom