Why $GPRMC nmea is different than AT+QGPSLOC=2?

I’m trying 2 ways of obtaining Geo coordinates:
AT+QGPSLOC=2 - which returning right coorditates,

and reading nmea sentences over ttyUSB1 - which returning kinda shifted coordinates (by some kilometers)

why coordinates of $GPRMC nmea from ttyUSB1 are different than those returned by AT+QGPSLOC=2?

Hi @dima,

The $GPRMC NMEA message output has the following sentence structure:

eg. $GPRMC,225446,A,4916.45,N,12311.12,W,000.5,054.7,191194,020.3,E*68

       225446       Time of fix 22:54:46 UTC
       A            Navigation receiver warning A = OK, V = warning
       4916.45,N    Latitude 49 deg. 16.45 min North
       12311.12,W   Longitude 123 deg. 11.12 min West
       000.5        Speed over ground, Knots
       054.7        Course Made Good, True
       191194       Date of fix  19 November 1994
       020.3,E      Magnetic variation 20.3 deg East
       *68          mandatory checksum

Below is the latitude and longitude display format of AT+QGPSLOC command:

You can also check out this tutorial for reading GNSS/GPS data:

Thank you.


$GPRMC nmea coordinates returned by BG96 do not correspond to longitude/lattitude coordinates
returned by Google Maps, but AT+QGPSLOC=2 does.

Could you please share a sample sentence returned by $GPRMC nmea and AT+QGPSLOC=2?

Yes sir.
this is result of gpstest.py

this is result of AT+QGPSLOC=2

this is result of AT+QGPSLOC=1

coordinates 28.59473,-81.21044 returned by AT+QGPSLOC=2 correspond to what GoogleMaps says about my location. 100%

coordinates returned by gpstest.py or AT+QGPSLOC=1: latitude : 28 deg 35.684609 min(N), longitude : 081 deg 12.631488 min(W) , or (28.35684609, -81.12631488) are really 28 miles away from my location.

Hi @dima,

Format of AT+QGPSLOC=1 command:

ddmm.mmmmmm N/S (Quoted from GPGGA sentence)
dd --> 00-89 (degree)
mm.mmmmmm --> 00.000000-59.999999 (minute)
N/S --> North latitude/South latitude

Strip the dd from the message i.e.: ddmm.mmmm

Which becomes
variable1 = dd
variable2 = mm.mmmm
variable3 = variable2 / 60

Note: To convert this to the decimal format, we start by keeping the DD portion and simply divide the MM.MMM by 60 to firm the MMM portion of the decimal format.

Rejoin values to make dd.dddd

dd.dddd = variable1.variable3

Your result: 2835.682564 N , 08112.614136 W

Lat: ddmm.mmmm: 2835.682564 N
Lat: dd + mm.mmmm: 28 + 35.682564
Lat: dd + dd.dddd: 28 + (35.682564 / 60)
Lat: dd.dddd: 28.5947094

Long: dddmm.mmmm: 08112.614136 W
Long: ddd + mm.mmmm: 081 + 12.614136
Long: ddd + dd.dddd: 081 + (12.614136 / 60)
Long: ddd.dddd: -81.2102356 (As this is west it is negative, east is positive)

1 Like

@ensar sweet!
in your answer the crucial decision is division / 60

Thank you very much!