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

    Pysense pinout / wake on pin

    Scheduled Pinned Locked Moved Discussion
    pysense
    28 Posts 8 Posters 10.0k Views 10 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.
    • J Offline
      jcaron @sslupsky
      last edited by jcaron

      @sslupsky The Pysense/Pytrack firmware was updated to support wake on pin (along with changes to the libraries), so it’s no longer needed to patch the firmware.

      However you will still need to cut that pin to achieve good results.

      Note that this only applies to Pysense/Pytrack controlled deep sleep / wake on pin. If you use one of the more recent modules (WiPy 3, LoPy 4, FiPy...), you should use the module’s native deep sleep and wake on pin functionality.

      John BairdJ 1 Reply Last reply Reply Quote 0
      • John BairdJ Offline
        John Baird @jcaron
        last edited by

        @jcaron Hang on, I've read elsewhere that if you are using a pysense or pytrack you should use the deepsleep from the board library, yet here you say to use the one from the module. Which is it? Does using the board library only apply to older modules? If so, what classes as 'old'?

        I'm running a GPy on a Pysense board and need both deepsleep and wake-on-pin. Which should be called and what is the difference in functionality?

        Thx

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

          @john-baird The "old" boards (LoPy 1 but not LoPy 4, WiPy 2 but not 3, SiPy, possibly a few others) had an issue with deep sleep taking too much power.

          On those, machine.deepsleep would use >10 mA in deep sleep. More recent boards (WiPy 3, LoPy 4, FiPy, and I believe the GPy as well) don't have that issue, and use about 10 µA in deep sleep (with the possible complications related to LTE etc. of course).

          If you don't use external sensors, then machine.deepsleep is the recommended way of doing deep sleep.

          If you use a PySense or PyTrack, you have also to take into account the PIC and the sensors on those boards: machine.deepsleep will not shut them down, so they can continue drawing power during deep sleep.

          If you don't need those sensors during sleep, you can probably just power them off before going to sleep (and power them back on when you resume). The simplest way is probably to change the relevant PIC registers to cut the power to those. Not sure if there's enough information in the Pysense library for that, but it's not too difficult.

          Then you still have the PIC that remains active (for the UART-to-USB bridge, mostly). Don't know how much power than one draws. If you really want to minimise your power draw, you'll have to put the PIC to sleep as well, and I'm not sure if there's a way to do that without also cutting power to the module.

          If you need to wake up based on an interrupt from a sensor, you may also have to go through the PIC, though experience with that has not been quite positive (way too much power drawn when trying to use the accelerometer for wake up, for instance).

          So it all really depends on your exact scenario. In my case I was using LoPy 1 modules, so I had no choice but PySense-controlled deep sleep. With a GPy the situation is quite different.

          John BairdJ 1 Reply Last reply Reply Quote 1
          • John BairdJ Offline
            John Baird @jcaron
            last edited by

            @jcaron Thanks for the clarification. Sounds like a bit of a mess really. I was hoping we could end up with a fairly standard codebase, changing modules depending upon the communication methods required. If there are so many variations between revisions and further differences depending on which board you have them seated in, it doesn't sound like a common codebase would be that easy. If the board library contains a [board].deepsleep function I would have expected it to shut down the sensors I'm not using then call machine.deepsleep. Having to reverse engineer a library to find out how to drive the hardware directly sort of defeats one of the advantages of having Python ... but maybe that's just me :-)

            Thanks for the information, I appreciate it.

            1 Reply Last reply Reply Quote 0
            • P Offline
              prashanth @jcaron
              last edited by

              @jcaron what does cutting the pin actually refers too?

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

                @prashanth in our case, physically cutting the pin on the module so it’s isolated from the Pysense. That was the only way to have Pysense-controlled wake-on-pin work reliably with the sensor we used. YMMV.

                P 1 Reply Last reply Reply Quote 0
                • P Offline
                  prashanth @prashanth
                  last edited by prashanth

                  @prashanth I have cut the pin p9 as you said, but it is not able to detect it as interrupt. I have used 1 if py.peek_memory(0xE) & 0x02 else 0 to read the status of the pins. It actually prints the data when detected. But, only problem it is not able to detect as interrupt. It toggles between 1 and 0 using sensor. If possible please share any example code which you have tested will be helpful to me. Thank You

                  1 Reply Last reply Reply Quote 0
                  • P Offline
                    prashanth @jcaron
                    last edited by

                    @jcaron It's working as you said. Thank you

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

                    Pycom on Twitter

                    Pycom