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

    Changing the GPS frequency and configuring which NMEA sentences the gps posts.

    Scheduled Pinned Locked Moved Expansion Board
    pytrackgpsnmea0183frequencypmtk
    8 Posts 4 Posters 3.1k 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.
    • F Offline
      fsergeys
      last edited by

      Hello,

      I have been browsing the gps lib library but could not find any API for updating the GPS frequency and configuring the NMEA sentences the gps posts
      Has anyone done this. I need it to set to 5Hz.
      What I know from other gps's (like the one from ada fruit), is that at that speed you need to disable some of the nmea sentences in the gps itself otherwise, the 9800 baudrate won't be able to keep up displaying all information.
      Which brings me to the next topic: the PMTK sentences for configuring the L-76-L. Does anybody has the documentation of the L-76-L on which the registers to use to build up the PMTK sentences?
      I couldn't find them on http://www.quectel.com/UploadFile/Product/Quectel_L76-L_GNSS_Specification_V1.2.pdf

      Many thanks in advance

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

        @fsergeys
        look better at full spec on page 21 there is sample
        http://quectel.com/UploadImage/Downlad/Quectel_L76_Series_Hardware_Design_V3.0.pdf

        think about people first, then computers

        F 2 Replies Last reply Reply Quote 1
        • F Offline
          fsergeys @livius
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • F Offline
            fsergeys @livius
            last edited by

            @livius
            I had not noticed these documents, but then I discovered there are actually more spec files after you register on the quectel website.
            Then I found this document documenting all the pmtk's
            http://www.quectel.com/UploadImage/Downlad/Quectel_L76_Series_GNSS_Protocol_Specification_V3.3.pdf
            As soon as I have my boards, I will tweak the library code and maybe reuse some of this code.
            https://github.com/inmcm/micropyGPS/blob/master/micropyGPS.py

            Thx

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

              How has this gone?

              Curious, as I'm looking into the same issue(s).

              F 1 Reply Last reply Reply Quote 0
              • F Offline
                fsergeys @combaindeft
                last edited by

                @combaindeft I have 50% of the code, but since we voted for another feature to be implemented first. I haven't finished it. Planned for half of march. I'll keep you posted.

                F 1 Reply Last reply Reply Quote 0
                • F Offline
                  fsergeys @fsergeys
                  last edited by fsergeys

                  @combaindeft
                  Got it implemented yesterday and works like a charm. Hope it helps you

                  print("GPS module configuration")
                  #Stop logging to local flash of GPS
                  self.stoplog = "$PMTK185,1*23\r\n"
                  self.i2c.writeto(GPS_I2CADDR, self.stoplog)
                  
                  # Use GPS, GONASS, GALILEO and GALILEO Full satellites
                  self.searchmode = "$PMTK353,1,1,1,1,0*2B\r\n"
                  self.i2c.writeto(GPS_I2CADDR, self.searchmode)
                  
                  # Only out RMC messages
                  self.rmc = "$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n"
                  self.i2c.writeto(GPS_I2CADDR, self.rmc)
                  
                  # Increase output rate to 5Hz
                  self.fivehz = "$PMTK220,200*2C\r\n"
                  self.i2c.writeto(GPS_I2CADDR, self.fivehz)
                  
                  # Set the speed threshold
                   self.speedth = "$PMTK386,0.4*39\r\n"
                   self.i2c.writeto(GPS_I2CADDR, self.speedth)
                  

                  2 more TIPS:

                  1. This is a neat tool to calculate you Hex sums: http://www.hhhh.org/wiml/proj/nmeaxor.html
                  2. If you readout the NMEA messages and you're looking for the end of the sentence, then only look for \r not \r\n. For some reason, if the GPS logs all messages, the end of each NMEA sentence is ended with \r\n, but not if only RMC messages are outputted. (That one kept me scratching my head for a while ...)
                  def getNMEASentence(self):
                          nmea = b''
                          while True:
                              nmea += self._read().lstrip(b'\n\n').rstrip(b'\n\n')
                              #print(nmea)
                              matchObj = re.search(b'\$G[P,N]+RMC',nmea)
                              if matchObj:
                                  matchStr = matchObj.group(0)
                                  rmc_idx = nmea.find(matchStr.encode('ascii'))
                                  rmc = nmea[rmc_idx:]
                                  e_idx = rmc.find(b'\r')
                                  if e_idx >= 0:
                                          rmc = rmc[:e_idx].decode('ascii')
                                          nmea = nmea[(rmc_idx + e_idx):]
                                          gc.collect()
                                          break
                              else:
                                  continue
                          return rmc
                  

                  (The code is not beautiful, but we are prototyping now ...)

                  T 1 Reply Last reply Reply Quote 3
                  • T Offline
                    this.wiederkehr @fsergeys
                    last edited by this.wiederkehr

                    @fsergeys said in Changing the GPS frequency and configuring which NMEA sentences the gps posts.:

                    GALILEO and GALILEO Full satellites

                    Do you know what the difference between the two is? Also I wonder what is the default configuration for the tracking system?

                    I think the application note regardig I2c mentions to perform a dummy write after each command prior to get back to reading see my example here:

                    https://forum.pycom.io/topic/2442/pytrack-and-gps-balloon-mode/3

                    and the sequence chart in the application note:

                    http://www.quectel.com/UploadImage/Downlad/Quectel_L76-L_I2C_Application_Note_V1.0.pdf <- requires login.

                    and here is the code to perform checksum testing yourself:

                    requires the sentence to be a bytes object.

                        def _checksum(self, sentence):
                            l = sentence[0]
                            for c in sentence[1:]:
                                l = l ^ c
                            return l
                    
                        def _test_checksum(self, sentence):
                            if self._checksum(sentence[1:-3]) == int(sentence[-2:], 16):
                                return True
                            return False
                    
                    1 Reply Last reply Reply Quote 2

                    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