Innacurate NMEA messages

When I look at latitude and longitude in u-center, I get very accurate coordinates. But the NMEA messages in u-center’s text console, and in my Python script output in VSCode, are off by about 0.3 degrees. Both latitude and longitude.

Any help would be appreciated! Thanks :slight_smile:

What do you mean by “look at latitude and longitude in u-center” and how do you know that the coordinates are “very accurate”?

If you are using a non-RTK GPS module, the NMEA messages carry all of the available data.

Please identify the GPS module, post some examples of the output and describe how that differs from your expectations.

When I open u-center, top right hand corner, there is a black rectangle showing Latitude, Longitude, Altitude, Fix Mode, etc.

GPS module: ZED-F9P. I know the coordinates are accurate because I put them into Google Maps and saw my exact location.

Output and expected output: In my code I’m using the $GNRMC message to get latitude and longitude. When I print the message in Python or look for it in u-center’s text console, I see:

[‘$GNRMC’, ‘…’, ‘…’, ‘1100.00000’, ‘S’, ‘11100.00000’, ‘E’, ‘…’, ‘’, ‘…’, ‘’, ‘’, ‘…’, ‘…’]

(when my true location is ‘1130.00000’, ‘S’, ‘11070.00000’, ‘E’ )

The latitude and longitude in u-center are more accurate by 0.3 degrees.

That doesn’t look like a valid fix to me.

$GNRMC

Format: $GNRMC,<1>,<2>,<3>,<4>,<5>,<6>,<7>,<8>,<9>,<10>,<11>,< 12>*xx<CR><LF> E.g: $GNRMC,072446.00,A,3130.5226316,N,12024.0937010,E,0.01,0.00,040620,0.0,E,D*3D Field explanation:

<0> $GNRMC
<1> UTC time, the format is hhmmss.sss
<2> Positioning status, A=effective positioning, V=invalid positioning
<3> Latitude, the format is ddmm.mmmmmmm
<4> Latitude hemisphere, N or S (north latitude or south latitude)
<5> Longitude, the format is dddmm.mmmmmmm
<6> Longitude hemisphere, E or W (east longitude or west longitude)
<7> Ground speed
<8> Ground heading (take true north as the reference datum)
<9> UTC date, the format is ddmmyy (day, month, year)
<10> Magnetic declination (000.0~180.0 degrees)
<11> Magnetic declination direction, E (east) or W (west)
<12> Mode indication (A=autonomous positioning, D=differential, E=estimation, N=invalid data)
* Statement end marker
XX XOR check value of all bytes starting from $ to *
<CR> Carriage return, end tag
<LF> line feed, end tag

Sorry, you are not making any sense to me.

As YellowDog pointed out, this is not a valid NMEA sentence. Post the original NMEA sentences, directly from the module.

['$GNRMC', '...', '...', '1100.00000', 'S', '11100.00000', 'E', '...', '', '...', '', '', '...', '...'] 

Sorry I was trying to be brief, but I just confused everyone :frowning:

This is what my GNRMC message looks like:

$GNRMC,022645.00,A,4038.33130,N,11251.22668,W,0.033,161122,D,V*0A

u-center data viewer looks like:

Longitude: 112.2222668

Latitude: 40.5633130

Lat and Long are both off by about ±0.3 degrees compared to my true location which is displayed in the u-center dashboard). I know from using Google Maps that the u-center dashboard is correct, and the GNRMC message (as well as all other NMEA messages) are not accurate.

compared to my true location, which is displayed in the u-center dashboard

Where do you think u-center gets the information about your “true location”?

Please describe your complete setup.

Where do you think u-center gets the information about your “true location”?

Hence my confusion. The NMEA messages do not appear to be accurate, but u-center does. At the very least they do not match. I open the Text Console and look at the messages side-by-side with the data view in the top right hand of the main window and they are not the same numbers.

My setup: A SparkFun GPS-RTK-SMA Breakout - ZED-F9P connected via USB to a Laptop (Windows 10). The module is using default configuration. The antenna is a u-blox GNSS Multi-Band Magnetic Mount Antenna - 5m (SMA)

Hi everyone,

Thanks for your patience and help. There was an error in the logic of my Python script.

For any future viewers with the same problem, here is the Stack Overflow version of this question with the comments that led me to the answer.

https://stackoverflow.com/questions/744 … 8#74459098

The code before I asked this question:

import serial

gps = serial.Serial('com5', baudrate=9600)

while True:
    ser_bytes = gps.readline()
    decoded_bytes = ser_bytes.decode("utf-8")
    data = decoded_bytes.split(",")
    if data[0] == '$GNRMC':
        lat_nmea = (data[3],data[4])
        lat_degrees = float(lat_nmea[0][0:2])
        if lat_nmea[1] == 'S':
            lat_degrees = -lat_degrees
        lat_minutes = float(lat_nmea[0][2:])
        lat = lat_degrees + (lat_minutes/60)
        lon_nmea = (data[5],data[6])
        lon_degrees = float(lon_nmea[0][:3])
        lon_minutes = float(lon_nmea[0][3:])
        lon = lon_degrees + (lon_minutes/60)
        if lat_nmea[1] == 'S':
            lat_degrees = -lat_degrees
        print("%0.8f" %lat,", " "%0.8f" %lon)

The code after the error was pointed out:

import serial

gps = serial.Serial('com5', baudrate=9600)

while True:
    ser_bytes = gps.readline()
    decoded_bytes = ser_bytes.decode("utf-8")
    data = decoded_bytes.split(",")
    if data[0] == '$GNRMC':
        lat_nmea = (data[3],data[4])
        lat_degrees = float(lat_nmea[0][0:2])
        lat_minutes = float(lat_nmea[0][2:])
        lat = lat_degrees + (lat_minutes/60)
        lon_nmea = (data[5],data[6])
        lon_degrees = float(lon_nmea[0][:3])
        lon_minutes = float(lon_nmea[0][3:])
        lon = lon_degrees + (lon_minutes/60)
        if lat_nmea[1] == 'S':
            lat = -lat
        if lon_nmea[1] == 'W':
            lon = -lon
        print("%0.8f" %lat, "%0.8f" %lon)

Note the if statements were moved to the end. The NMEA messages still don’t match the output, but I suppose something is happening at some point that I don’t understand. The code works, which I suppose is the important part.

Thanks again everyone :slight_smile: