semuconsulting / pynmeagps

Python library for parsing and generating NMEA 0183 GNSS/GPS protocol messages.
BSD 3-Clause "New" or "Revised" License
80 stars 28 forks source link

Output number of satellite in view #21

Closed Buttosaii closed 1 year ago

Buttosaii commented 1 year ago

Hi, is there a command or function to output the number of satellite seen by the GNSS?

semuadmin commented 1 year ago

Hi @Buttosaii,

This is the sort of thing you could Google yourself (e.g. search on "NMEA number of satellites seen"), but in short the answer is yes, you can use the numSV (number of Space Vehicles i.e. satellites) attribute in NMEA messages like GGA, GNS or GSV, e.g.,

from serial import Serial
from pynmeagps import NMEAReader
stream = Serial('/dev/ttyACM0', 38400, timeout=3)
nmr = NMEAReader(stream)
(raw_data, parsed_data) = nmr.read()
if hasattr(parsed_data, "numSV"):
    print (f"Message type {parsed_data.identity}; Number of satellites tracked:  {parsed_data.numSV}")

Hope this helps.

FYI the u-blox support forum is also a useful resource for technical queries though, as I say, this sort of information is in the public domain.