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

    Accelerometer wake-up features added to Pytrack and Pysense

    Scheduled Pinned Locked Moved Announcements & News
    library
    22 Posts 10 Posters 11.6k Views 11 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.
    • sebS Offline
      seb
      last edited by

      The board only features a 3 axis accelerometer. Without either a gyroscope or a magnetometer it is not possible to detect the yaw of the board.

      1 Reply Last reply Reply Quote 0
      • M Offline
        Meirssv
        last edited by

        I tried the example, everything has the latest firmware, I used the latest lib's (with the new pycoproc.py lib) but I cannot make this example script work.

        I tried with 2 different PyTrack-boards (all flashed with latest firmware) and tried it with a LoPy and a SiPy, both having the latest firmware. The device NEVER wakes up from movement. And it ALWAYS shows a red led flash, indicating activity...

        I assume this example script will:

        • wake up after 5 minutes if no movement detected
        • wake up when movement detected
        • will flash red when activity detected
        • will flash green when no activity detected

        Am I correct about my assumptions? If so, did I forget something obvious because it doesn't work?

        catalinC 1 Reply Last reply Reply Quote 0
        • catalinC Offline
          catalin @Meirssv
          last edited by

          Hi @meirssv, I've tried on several boards and the wakeup is done every time. Just shake the board harder, or decrease the threshold and/or duration to make it more sensitive to movement:

          # enable the activity/inactivity interrupts
          # set the acceleration threshold to 2000mG (2G) and the min duration to 200ms
          acc.enable_activity_interrupt(2000, 200)
          

          On the other hand, the led flashes red every time, even if the wakeup was done by reset, or timeout. Here more investigation will be done.

          Catalin,

          Have you checked out our docs for the answer? (Now with an easy search function) https://docs.pycom.io
          Check out our newly revamped device management platform, Pybytes! https://pybytes.pycom.io/

          M T 3 Replies Last reply Reply Quote 0
          • M Offline
            Meirssv @catalin
            last edited by

            @catalin said in Accelerometer wake-up features added to Pytrack and Pysense:

            Just shake the board harder, or decrease the threshold and/or duration to make it more sensitive to movement

            Tried that already... did not help. But I now just spotted an item on the forum referring to DFU update 0.0.8... that is only 9 days ago. I am beginning to wonder if I have 0.0.8... Will check it out and report back.

            1 Reply Last reply Reply Quote 0
            • M Offline
              Meirssv @catalin
              last edited by

              @catalin

              Well, it seems like I missed the latest DFU upgrade for PyTrack as I was still on 0.0.7. After upgrading to 0.0.8 it now wakes up! activity() like you mentioned however always returns true...

              catalinC 1 Reply Last reply Reply Quote 0
              • catalinC Offline
                catalin @Meirssv
                last edited by

                @meirssv, Ok, great!

                While we fix that, you could use the wakeup reason, to verify if the accelerometer awoke the system

                # display the reset reason code and the sleep remaining in seconds
                # possible values of wakeup reason are:
                # WAKE_REASON_ACCELEROMETER = 1
                # WAKE_REASON_PUSH_BUTTON = 2
                # WAKE_REASON_TIMER = 4
                # WAKE_REASON_INT_PIN = 8
                print("Wakeup reason: " + str(py.get_wake_reason()) + "; Aproximate sleep remaining: " + str(py.get_sleep_remaining()) + " sec")
                

                Catalin,

                Have you checked out our docs for the answer? (Now with an easy search function) https://docs.pycom.io
                Check out our newly revamped device management platform, Pybytes! https://pybytes.pycom.io/

                M 1 Reply Last reply Reply Quote 0
                • M Offline
                  Meirssv @catalin
                  last edited by

                  @catalin said in Accelerometer wake-up features added to Pytrack and Pysense:

                  @meirssv, Ok, great!

                  you could use the wakeup reason to verify if the accelerometer awoke the system

                  Yes, I already figured that one out. You could even check the remaining seconds < 1s... Thanks!

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    ThomasP @catalin
                    last edited by

                    Hi @catalin, I'm new in programming and it looks like I've missed something.
                    When I try this script it returns 96 as a Wakeup reason. The red led is on all the time.

                    What should I do ? I'm using Pysense board and everything is updated.

                    catalinC 1 Reply Last reply Reply Quote 0
                    • catalinC Offline
                      catalin @ThomasP
                      last edited by

                      Hi @thomasp, on the first call, the return value could have some garbage; but the valid values are (1, 2, 4 or 8).
                      Could you put it to sleep: py.go_to_sleep() and wake it up immediately pressing the Reset button (from the Pysense)? You should obtain value 2, of the py.get_wake_reason()
                      Here are the Sleep functions explained: https://docs.pycom.io/chapter/pytrackpysense/apireference/sleep.html

                      Catalin,

                      Have you checked out our docs for the answer? (Now with an easy search function) https://docs.pycom.io
                      Check out our newly revamped device management platform, Pybytes! https://pybytes.pycom.io/

                      T 1 Reply Last reply Reply Quote 0
                      • T Offline
                        ThomasP @catalin
                        last edited by

                        @catalin

                        Well I tried and It doesn't work. Now I can't connect my board anymore. It says "Failed to connect (Error : Port is not open)." or "Failed to connect (Error: Writing to COM port (WriteFile): Unknown error code 22)."

                        Each time I run the script with these commands, the program doesn't execute the line. I mean it starts looping but stay at the same line and I can't do anything. I have to unplug the board to be able to restart the script.

                        catalinC 1 Reply Last reply Reply Quote 0
                        • catalinC Offline
                          catalin @ThomasP
                          last edited by catalin

                          @thomasp There seems to be a problem with COM port (serial port). What program are you using to connect/upload scripts? Atom with pymakr plugin?
                          Once the go_to_sleep() is executed, the serial connection is disconnected, and it comes back after the Pysense is awaken; and next, the script is executed again. This situation loops, and becomes difficult to catch the serial COM ready for connection.
                          So, for development purpose, maybe you should not have go_to_sleep() in the script, but execute it manually, on the REPL console (>>>).
                          The script can be stopped with Ctrl+C.

                          Catalin,

                          Have you checked out our docs for the answer? (Now with an easy search function) https://docs.pycom.io
                          Check out our newly revamped device management platform, Pybytes! https://pybytes.pycom.io/

                          T 1 Reply Last reply Reply Quote 0
                          • T Offline
                            ThomasP @catalin
                            last edited by

                            @catalin
                            Yes I'm using Atom with pymark as recommanded. How do I wake up my board ? I'm pressing the restart button and shaking it but I can't connect it.
                            It never stops connecting and disconnecting it.

                            catalinC 1 Reply Last reply Reply Quote 0
                            • catalinC Offline
                              catalin @ThomasP
                              last edited by

                              @thomasp
                              Yes, it seems the script keeps on re-executing quickly after wakeup.

                              Try safe-boot procedure; if you don't have Expander board, could be tricky: https://docs.pycom.io/chapter/toolsandfeatures/bootmodes.html

                              On Windows platform, maybe Realterm can catch the serial https://realterm.sourceforge.io; on linux+mac that would be minicom and allow you to give Ctrl+C to stop the scripts.

                              Catalin,

                              Have you checked out our docs for the answer? (Now with an easy search function) https://docs.pycom.io
                              Check out our newly revamped device management platform, Pybytes! https://pybytes.pycom.io/

                              T 1 Reply Last reply Reply Quote 0
                              • T Offline
                                ThomasP @catalin
                                last edited by

                                @catalin

                                I can now run a simple program but I can't use pycom.rgbled().
                                It says : "OSError: the requested operation is not possible"
                                And sometimes I get : "An error occurred: Not enough memory available on the board.
                                Upload failed. Please reboot your device manually."

                                But I tried all the reboot and reset but It doesnt work.
                                So I used the command to Reset the Filesystems but still the same errors appears.

                                I updated firmware just in case but no result.
                                The led is flashing blue every 4 seconds.

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

                                  @ThomasP

                                  Could you create a new forum thread for the issues you are facing and I will help you get your board set up and running.

                                  1 Reply Last reply Reply Quote 0
                                  • K Offline
                                    KenM
                                    last edited by

                                    Hi,

                                    I have an extra I2C sensor on the Pysense. (water pressure)
                                    I would like to wake up my lopy4 if it's above a certain value.

                                    Can this be done?
                                    And which code should I change/update?

                                    Thanks

                                    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