NMEA 0183

NMEA 0183 is a combined electrical and data specification for communication between marine electronics such as echo sounder, sonars, anemometer, gyrocompass, autopilot, GPS receivers and many other types of instruments. It has been defined by, and is controlled by, the National Marine Electronics Association. It replaces the earlier NMEA 0180 and NMEA 0182 standards. In leisure marine applications it is slowly being phased out in favor of the newer NMEA 2000 standard, though NMEA0183 remains the norm in commercial shipping. 
The electrical standard that is used is EIA-422, although most hardware with NMEA-0183 outputs are also able to drive a single EIA-232 port. Although the standard calls for isolated inputs and outputs, there are various series of hardware that do not adhere to this requirement.
The NMEA 0183 standard uses a simple ASCII, serial communications protocol that defines how data are transmitted in a "sentence" from one "talker" to multiple "listeners" at a time. Through the use of intermediate expanders, a talker can have a unidirectional conversation with a nearly unlimited number of listeners, and using multiplexers, multiple sensors can talk to a single computer port.
At the application layer, the standard also defines the contents of each sentence (message) type, so that all listeners can parse messages accurately.
While NMEA0183 only defines an RS422 transport, there also exists a de facto standard in which the sentences from NMEA0183 are placed in UDP datagrams (one sentence per packet) and sent over an IP network.
The NMEA standard is proprietary and sells for at least US$2000 (except for members of the NMEA) as of September 2020. However, much of it has been reverse-engineered from public sources.
Serial configuration (data link layer).
There is a variation of the standard called NMEA-0183HS that specifies a baud rate of 38,400. This is in general use by AIS devices.
Message structure.
As an example, a waypoint arrival alarm has the form:
Another example for AIS messages is:
Vendor extensions.
Most GPS manufacturers include special messages in addition to the standard NMEA set in their products for maintenance and diagnostics purposes. Extended messages begin with "$P". These extended messages are not standardized.
Software compatibility.
NMEA 0183 is supported by various navigation and mapping software. Notable applications include:
Sample file.
A sample file produced by a Tripmate 850 GPS logger. This file was produced in Leixlip, County Kildare, Ireland. The record lasts two seconds.
Note some blank fields, for example:
C implementation of checksum generation.
The checksum at the end of each sentence is the XOR of all of the bytes in the sentence, excluding the initial dollar sign. The following C code generates a checksum for the string entered as "mystring" and prints it to the output stream. In the example, a sentence from the sample file is used.
int checksum(const char *s) {
 int c = 0;
 while (*s)
 c ^= *s++;
 return c;
int main()
 char mystring[] = "BNALF,1,1,0,B,W,V,220003,0,0,VISUAL ALARM";
 printf("String: %s\nChecksum: 0x%02X\n", mystring, checksum(mystring));
 return 0;
python implementation of checksum generation.
Code below calculate NMEA CRC from the formulated NMEA string. The code based on the http://code.activestate.com/recipes/576789-nmea-sentence-checksum/.
calculate NMEA string CRC
IN: NMEA string between $ and *, ex '$GPGSV,3,3,10,26,37,134,00,29,25,136,00*76' would be '$GPGSV,3,3,10,26,37,134,00,29,25,136,00*76'
OUT: checksum to place after *
def calculateNMEAchecksum(NMEAstring):
 calc_cksum = 0
 for s in NMEAstring:
 #it is XOR of ech Unicode integer representation
 calc_cksum ^= ord(s)
 calc_cksum = hex(calc_cksum) #get hex representation
 calc_cksum = f'{calc_cksum}'[2:] #cut 0x
 return calc_cksum
Status.
NMEA 0183 continued to be maintained separately: V4.10 was published in early May 2012, and an erratum noted on 12 May 2012. It is not clear whether there is any active development. The latest NMEA announcement on the subject is older than the V4.10 standard.
There is an update of November 27, 2018 to 4.11.