gpsd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: No sentence logs


From: tangoing . mill745
Subject: Re: No sentence logs
Date: Wed, 13 Mar 2024 11:37:05 -0700

On Tue, Mar 12, 2024 at 11:43:21AM -0700, Gary E. Miller wrote:

> > The library is adafruit-circuitpython-gps. I know *that* part works
> > because I have a test script that just dumps the data to stdout, and
> > I get what I expect.

> And, once again, what did you get?  My mind reading is not working
> lately.  Please send a raw capture.

I'm trying a different tack now, so this will wait. Running gpsd is kind
of wasteful for me anyway; the end goal is to feed the time info to
chrony. I initially included gpsd in the picture because I worried
about binary compatibility for the shm segment, but now I see that
chrony has hand written code for this anyway, bypassing libgps. So it's
in fact safer for me to do the same and code to the chrony interface
directly.

> > I do the udp part myself in another python script that is
> > completely analogous.

> Care to share that here?  Someone else may also want to use it.

Ok. Here's the raw dump script, only minimally modified from one
provided gracefully by adafruit:

  import time
  import board
  import busio
  import adafruit_gps

  # If using I2C, we'll create an I2C interface to talk to using default pins
  i2c = board.I2C()  # uses board.SCL and board.SDA

  # Create a GPS module instance.
  gps = adafruit_gps.GPS_GtopI2C(i2c)  # Use I2C interface

  # Turn on the basic GGA and RMC info (what you typically want)
  # penultimate bit turns on ZDA
  gps.send_command(b"PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0")

  # Set update rate to once a second (1hz) which is what you typically want.
  # gps.send_command(b"PMTK220,1000")

  # Or decrease to once every two seconds by doubling the millisecond value.
  gps.send_command(b'PMTK220,2000')

  # Main loop runs forever printing data as it comes in
  while True:
      data = gps.readline()
      # print(data)  # this is a bytearray type

      if data is not None:
          # convert bytearray to string
          data_string = "".join([chr(b) for b in data])
          print(data_string, end="")
          data = None
          time.sleep(2.0)

And here my modified version with udp echoing:

  import time
  import board
  import busio
  import adafruit_gps
  import codecs

  # setup a client socket
  from socket import socket, AF_INET, SOCK_DGRAM

  LOCALHOST = "127.0.0.1"
  # 2947 is the gpsd server port, so use something similar
  GPSD_RCV_PORT = 12947

  sender = socket(family=AF_INET, type=SOCK_DGRAM)
  sender.connect((LOCALHOST, GPSD_RCV_PORT))

  # If using I2C, we'll create an I2C interface to talk to using default pins
  i2c = board.I2C()  # uses board.SCL and board.SDA

  # Create a GPS module instance.
  gps = adafruit_gps.GPS_GtopI2C(i2c)  # Use I2C interface

  # Initialize the GPS module by changing what data it sends and at what rate.
  # These are NMEA extensions for PMTK_314_SET_NMEA_OUTPUT and
  # PMTK_220_SET_NMEA_UPDATERATE but you can send anything from here to adjust
  # the GPS module behavior:
  #   https://cdn-shop.adafruit.com/datasheets/PMTK_A11.pdf

  # Turn on the basic GGA and RMC info (what you typically want)
  # gps.send_command(b"PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0")
  # 1 in the penultimate slot means ZDA
  gps.send_command(b"PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0")

  # Set update rate to once a second (1hz) which is what you typically want.
  # gps.send_command(b"PMTK220,1000")
  # Or decrease to once every two seconds by doubling the millisecond value.
  gps.send_command(b'PMTK220,2000')

  # Main loop runs forever sending data as it comes in
  while True:
      data = gps.readline()
      # print(data)  # this is a bytearray type

      if data is not None:
          sender.sendall(data)
          # print(codecs.decode(data))

> Can it you also send to the receiver to configure it?

Yes, see above

> Care to share what you configured your receiver to send?  gpsd tries to
> work with whatever it can get, but many ways tobe suboptimal.

GGA, RMC and ZDA. I didn't see anything else in the dump.

> Is this a u-blox?  If so, why send NMEA insteaad of ubx?

It's this one:

https://learn.adafruit.com/adafruit-mini-gps-pa1010d-module

-- 
Ian



reply via email to

[Prev in Thread] Current Thread [Next in Thread]