NMEA 0183
Le standard NMEA-0183 est un format texte de messages structurant des données produites (essentiellement) par des récepteurs GPS via une liaison série (Baud rate: 4800 Number of data bits: 8 (bit 7 is 0) Stop bits: 1 (or more) Parity: none Handshake: none). NMEA-0183 est un format de données textuel des relevés GPS acquis par les terminaux GPS puis retournés à un hôte (par un port série par exemple). Il couvre un large spectre de données de navigation. Ces données sont envoyées par le récepteur en mode heartbeat à fréquence fixe (0,5 Hz par exemple).
Format
Documentation http://www.sparkfun.com/datasheets/GPS/NMEA%20Reference%20Manual1.pdf
Syntaxe
Chaque message est structuré de la manière suivante :
$AABBB,CC,DD,...*CK<CR><LF> $ marqueur de début du message AA pour l'identifiant de l'émetteur (''talker'') BBB pour la phrase (''sentence'') CK ''Checksum'' * <CR> Carriage Return \r <LF> Line Feed \n
le code C de la fonction de checksum
#define uchar unsigned char uchar calcChecksum(uchar checksum, uchar c){ if ( c == '$' ) return 0; if ( c != '\r' && c != '\n' && c != '*' ) { checksum ^= c; } return checksum; }
le code Arduino de la fonction de checksum
byte calcChecksum(byte checksum, byte c){ if ( c == '$' ) return 0; if ( c != '\r' && c != '\n' && c != '*' ) { checksum ^= c; } return checksum; } byte calcChecksumBuf(byte checksum, byte buf[], int i, int len){ for(;i<len; i++){ checksum=calcChecksum(checksum,buf[i]); } return checksum; }
Liens
Messages de sortie
Chaque message est une ligne de texte commencant par $ et se terminant par [CR][LF] et contient les champs suivants
$IDMSG,D1,D2,D3,...Dn*CS[CR][LF]
ID: Talker id (GP pour GPS)
MSG: Message id
Di: Msg data fields
CS: Ckecksum 2 hexa for 8 bits
Most common message Ids are
- GGA : GPS fix data (NMEA Version 2.1)
- GLL : Geographic position - Latitude/Longitude
- GSA : GPS DOP and active satellites
- GSV : GPS satellites in view
- RMC : Recommended minimum specific GPS/Transit data
- VTG : Track made good and ground speed
- ZDA : SiRF Timing Message
- MSS : MSK Receiver Signal
- 150 : OkToSend
- ...
Exemples
$GPGGA,164503.0,4511.636,N,00546.242,E,1,6,3.25,00220,M,048,M,,*66 $GPVTG,000.0,T,002.0,M,000.00,N,000.00,K*4C $GPRMC,214434,A,3753.666,N,12203.162,W,0.0,0.0,270901,15.4,E,A*33 $GPGGA,214616,3753.667,N,12203.167,W,1,04,5.6,121.1,M,-27.4,M,,*79 $GPGSV,3,1,10,01,69,062,47,03,12,106,37,04,12,279,00,08,12,250,00*77 $GPGLL,3753.667,N,12203.167,W,214616,A,A*54 $GPBOD,,T,,M,,*47
Messages d'entrée
$IDMSG,D1,D2,D3,...Dn*CS[CR][LF]
ID=PSRF
MSG=
- 100 : SetSerialPort : Set PORT A parameters and protocol
- 101 : NavigationInitialization : Parameters required for start using X/Y/Z (Input coordinates must be WGS84)
- 102 : SetDGPSPort = Set PORT B parameters for DGPS input
- 103 : Query/Rate Control = Query standard NMEA message and/or set output rate
- 104 : LLANavigationInitialization = Parameters required for start using Lat/Lon/Alt (Input coordinates must be WGS84)
- 105 : Development Data On/Off = Development Data messages On/Off
- 106 : Select Datum = Selection of datum to be used for coordinate transformations.
- MSK : MSK Receiver Interface = Command message to a MSK radio-beacon receiver.
Messages
Message GLL - Geographic Position - Latitude/Longitude
contains the latitude and longitude of the present vessel position, the time of the position fix and the status.
$GPGLL,llll.lll,a,yyyyy.yyy,a,hhmmss.s,A*hh[CR][LF]
- 1,2 Latitude, N (North) or S (South)
- 3,4 Longitude, E (East) or W (West)
- 5 UTC of position
- 6 Status: A = Valid, V= Invalid
- hh Checksum
Message GGA - GPS Fix Data
includes time, position and fix related data for the GPS receiver.
$GPGGA,hhmmss,llll.lll,a,nnnnn.nnn,b,t,uu,v.v,w.w,M,x.x,M,y.y,zzzz*hh[CR][LF]
- 1 UTC of Position
- 2,3 Latitude, N (North) or S (South)
- 4,5 Longitude, E (East) or W (West)
- 6 GPS Quality Indicator: 0 = No GPS, 1 = GPS, 2 = DGPS
- 7 Number of Satellites in Use
- 8 Horizontal Dilution of Precision (HDOP)
- 9, 10 Antenna Altitude in Meters, M = Meters
- 11, 12 Geoidal Separation in Meters, M=Meters. Geoidal separation is the difference between the WGS-84 earth ellipsoid and mean-sea-level.
- 13 Age of Differential GPS Data. Time in seconds since the last Type 1 or 9 Update
- 14 Differential Reference Station ID (0000 to 1023)
- hh Checksum
Message VTG - Track Made Good and Ground Speed
conveys the actual track made good (COG) and the speed relative to the ground (SOG).
$GPVTG,x.x,T,x.x,M,x.x,N,x.x,K*hh[CR][LF]
- 1 Track made good in degrees true.
- 2 Track made good in degrees magnetic.
- 3,4 Speed over the ground (SOG) in knots.
- 5,6 Speed over the ground (SOG) in kilometer per hour.
- hh Checksum
Remark: Velocity is always described as horizontal speed and heading
Outils
Mac OS X
Ligne de commande
screen /dev/tty.usbserial 4800
Linux
awk -F, '/\$GPGGA/ {print strftime("%Y-%m-%d "), $2, (substr($3,0,2) + (substr($3,3) / 60.0)) $4, (substr($5,0,3) + (substr($5,4) / 60.0)) $6, $10; fflush();}' /dev/tty.usbserial
Windows
Bibliothèques
Arduino
MBed
- https://os.mbed.com/users/Sir_Binky/code/TinyGPSplus/
- https://os.mbed.com/users/todotani/notebook/gps-nmea-parser/
STM32
Java avec RXTX
Javascript & Node.js
git clone https://github.com/infusion/GPS.js.git cd GPS.js/ npm install -g npm install express --save npm install socket.io --save npm install sylvester --save npm install kalman --save npm install serialport --save cd examples/ cd maps/ # Edit server.js for setting port and baudrate node server.js open http://localhost:3000 cd .. cd dashboard/ # Edit server.js for setting port and baudrate node server.js open http://localhost:3000