Changing the GPS frequency and configuring which NMEA sentences the gps posts.
-
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.pdfMany thanks in advance
-
@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
-
@combaindeft
Got it implemented yesterday and works like a charm. Hope it helps youprint("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:
- This is a neat tool to calculate you Hex sums: http://www.hhhh.org/wiml/proj/nmeaxor.html
- 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 ...)
-
@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.
-
How has this gone?
Curious, as I'm looking into the same issue(s).
-
@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.pyThx
-
This post is deleted!
-
@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