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

    Pytrack Turning off the gps receiver.

    Scheduled Pinned Locked Moved Expansion Board
    15 Posts 3 Posters 116 Views 3 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.
    • A Offline
      AM @Gijs
      last edited by

      @Gijs

      from pytrack import Pytrack
      py = Pytrack()
      py.gps_standby(True)

      I tried it. It will shut off the pytrack as well. Let me know if you have any more I ideas I can try.

      1 Reply Last reply Reply Quote 0
      • G Offline
        Gijs
        last edited by

        I remembered doing some research into this some time ago just after posting my last reply and indeed I could not get the function to work properly. From what I remember, using pytrack.sensor_power(False) or pytrack.sd_power(False) would instead power down the GPS. If I'm correct, the issue is on the heap of 'pysense accelerator wakeup' issues and is being looked at.

        Gijs

        A 1 Reply Last reply Reply Quote 1
        • A Offline
          AM @Gijs
          last edited by

          @Gijs I tried the functions separately and together but it didn't work.

          ReceivedMsg = ReceivedMsg.decode("utf-8")
              print(ReceivedMsg)
          
              if  ReceivedMsg == "test":
               print("GPS OFF")
          
          
               Pytrack().sensor_power(enabled=False)
               Pytrack().sd_power(enabled=False)
          

          OUTPUT

          Sending data: {"lon_d": **.37385, "lat_d": **.36488, "battery": 4.641541, "temperature": 0, "humidity": 0}
          CoAP POST message ID: 65223
          ID: 64967
          Code: 69
          Type: 2
          Token: b''
          ReceivedMsg: b'test'
          b'test'
          test
          GPS OFF
          CoAP GET message ID: 65479
          Sending data: {"lon_d": **.37385, "lat_d": **.36488, "battery": 4.651577, "temperature": 0, "humidity": 0}

          robert-hhR 1 Reply Last reply Reply Quote 0
          • G Offline
            Gijs
            last edited by Gijs

            Could you verify for me, do you have the Pytrack v1 or pytrack v2?

            I was mistaken before. The Pytrack 1 does not support cutting power to the GPS, as it is connected to the power supplied by the development module. Instead, it is possible to switch off the backup power supply (which is connected to pin RC7 on the PIC, as mentioned in the other post, Im not exactly sure how that disables everything, but I guess its internal in the GPS)

            On the Pytrack 2, the power rail is switched by RC7 on the PIC, which is toggled by sensor_power(...), not gps_standby(...), though, you need to use the latter to activate the standby mode.

            A 1 Reply Last reply Reply Quote 1
            • A Offline
              AM @Gijs
              last edited by

              @Gijs The current board I have is the pytrack v1. Just to make sure I understood correctly I should upgrade to pytrack v2 to be able to disable the gps receiver without turning the board off. Also the last part if I have v2 Should I use the sensor_power function or the standby function to turn it off.

              1 Reply Last reply Reply Quote 0
              • robert-hhR Offline
                robert-hh @AM
                last edited by

                @AM I just made a little test: You can indeed use the pytrack.write() method.

                from L76GNSS import L76GNSS
                from pytrack import Pytrack
                py = Pytrack()
                l76 = L76GNSS(py, timeout=30)
                l76.write("PMTK161,0")
                

                At that point the l76 module will switch off, reducing the power consumption by ~20mA, but also cuts the I2C. Next step: tell how to revive the module. The only way I found until now is power cycling. It may be possible to reset the chip, but there is nothing documented.

                robert-hhR G 2 Replies Last reply Reply Quote 3
                • robert-hhR Offline
                  robert-hh @robert-hh
                  last edited by robert-hh

                  @robert-hh Resetting the L76 with a low pulse at Pin 9 of the package starts it again. Unfortunately, this pin seems not connected to the PIC. So is is not possible to force the wakeup by software. Since Pin 9 is at an edge, you can think about a hardware solution, wiring Pin 9 of the L76 to an output Pin of the xxPy module. The you can create a low pulse by your script. Soldering that wire is not too complicated with a fine tip.

                  P.S.: It's a pity that Pycom does not publish schematics. That would make life easier for users. People who want to create clones should have not difficulties of reverse engineer the boards. So again, like in most similar cases, it's the 'good' ladies and gents who suffer.

                  A 1 Reply Last reply Reply Quote 3
                  • A Offline
                    AM @robert-hh
                    last edited by

                    @robert-hh Thanks a lot for your help. I tried your idea, got I2C error. I will try to make it wok if not will go for the Pytrack v2 and use it with the standby function.

                    CoAP GET message ID: 6088
                    Caugh exception: I2C bus error
                    Caugh exception: I2C bus error
                    Caugh exception: I2C bus error
                    Caugh exception: I2C bus error

                    robert-hhR 1 Reply Last reply Reply Quote 0
                    • robert-hhR Offline
                      robert-hh @AM
                      last edited by robert-hh

                      @AM Yes, that's what I have seen too. When the L76 module is sent to standby mode, it will not respond to I2C any more. To revive it, you have either to do a power cycle or reset the L76 module itself. I did the wiring between the reset pin of the L76 module and P11 of a LoPy4 module, and indeed resetting works. The L76 responds again to I2C messages and gets a fix.
                      The picture below show the wire, which runs to Pin 8 of the connector, which in turn is connected to P11.
                      Pytrack_with_wire.jpg

                      A 1 Reply Last reply Reply Quote 3
                      • G Offline
                        Gijs @robert-hh
                        last edited by

                        @robert-hh I was not aware of this, thanks! If you dont mind, Ill put it in the documentation

                        robert-hhR 1 Reply Last reply Reply Quote 0
                        • robert-hhR Offline
                          robert-hh @Gijs
                          last edited by

                          @Gijs Sure

                          1 Reply Last reply Reply Quote 0
                          • A Offline
                            AM @robert-hh
                            last edited by AM

                            @robert-hh Thanks for the input will give it a try. When you have test it how long did it take to regain the full functionality?.

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

                              @Gijs @robert-hh I got the Pytrck 2.0 . I test with the standby, sensor_power Functions. also with

                                def gps_state(self, gps=True):
                                      # enable or disable back-up power to the GPS receiver
                                      if gps:
                                          self.set_bits_in_memory(PORTC_ADDR, 1 << 7)
                                      else:
                                          self.mask_bits_in_memory(PORTC_ADDR, ~(1 << 7))
                              

                              It disable and then automatically restart the receiver.

                              Sending data: {"lon_d": xxxxx, "lat_d": xxxxx, "battery": 4.766989, "temperature": 0, "humidity": 0}
                              CoAP POST message ID: 27515
                              ID: 26235
                              Code: 69
                              Type: 2
                              Token: b''
                              ReceivedMsg: b'test'
                              b'test'
                              test
                              GPS OFF
                              CoAP GET message ID: 27771
                              Caugh exception: I2C bus error
                              Sending data: {"lon_d": null, "lat_d": null, "battery": 4.756954, "temperature": 0, "humidity": 0}
                              CoAP POST message ID: 28027
                              CoAP GET message ID: 28283
                              Sending data: {"lon_d": 10.37374, "lat_d": xxxx, "battery": xxxxx, "temperature": 0, "humidity": 0}
                              CoAP POST message ID: 28539
                              

                              Is there a way to disable it and it stays disabled until I enable it again.

                              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