Data Logging from NMEA Devices
by Jill Studholme
The NMEA interfacing standard ensures that conforming instruments all speak the same language. This language can be understood by PC programs like Windmill software, and data from many different instruments can be logged to one time-stamped file. Depth data from sonar and position data from a GPS receiver can be combined to plot a contour map for example.
The standard was developed by the US-based National Marine Electronics Association in the 1980s. The NMEA 0183 standard uses ASCII messages which can be sent over RS232 serial links. In 2000 a new standard was released - NMEA 2000. This uses CAN (Controller Area Networks). This article concentrates on NMEA 0183.
The standard specifies communication in coded sentences in ASCII (text) format. Each sentence begins with the dollar character, $, and ends with a carriage return and a line feed. Between the beginning and the end are identifier and data fields, separated by commas. The first two characters following the $ comprise the "talker" identifier, describing the type of instrument sending the data. For example $GP for GPS receiver or $ZA for atomic clock. Other talker identifiers include:
AP Magnetic Autopilot CV Communications - Radio-Telephone (VHF) DF Direction Finder EP Emergency Position Indicating Beacon (EPIRB) ER Engine Room Monitoring Systems GP Global Positioning System (GPS) HC Magnetic Compass HE North Seeking Gyro IN Integrated Navigation LC Loran C OM Omega receiver P Proprietary Code RA RADAR SD Depth Sounder SN Electronic Positioning System, other/general SS Sounder, Scanning TI Turn Rate Indicator VD Velocity Sensor, Doppler, other/general DM Velocity Sensor, Speed Log, Water, Magnetic VW Velocity Sensor, Speed Log, Water, Mechanical WI Weather Instruments YX Transducer ZA Timekeeper Atomic Clock ZQ Timekeeper Quartz
Following the talker ID is a three letter code identifying the type of sentence. For example:
DBT Depth below transducer GGA Global positioning system fix data GLL Geographic position, Latitude, Longitude HDT Heading true MTW Water temperature MWD Wind direction MWV Wind speed and angle RMC Recommended minimum specific GPS/transit data RSD RADAR system data VBW Water referenced and ground referenced speed XDR Transducer measurements ZDA Time and date
Next are the comma separated data values.
Here is an example of a complete NMEA sentence.
Following the $ marking the beginning of the code comes the 2-letter code identifying the instrument sending the data. In this case it is GP for GPS receiver. The 3-letter sentence identifier, GLL, tells us that the data that follows will give geographic position, latitude and longitude. The data shown is:
5330.12 - Latitude 53 degrees and 30.12 minutes, ie 53 degrees, 30 minutes and 7 seconds. N - North (or S for South). 00215.31 - Longitude 2 degrees and 15.31 minutes, ie 2 degrees, 15 minutes and 19 seconds. W - West (or E for East). 124531 - UTC Time of 13:45 and 31 seconds (hhmmss). UTC stands for Co-ordinated Universal Time. This time scale is kept by time laboratories around the world and is determined using precise atomic clocks. It is equivalent to Greenwich Mean Time (GMT). A - Data valid (or V for data invalid). *77 - The checksum. This is an optional calculation resulting in 2 hexadecimal digits to check that the sentence has been properly transmitted. <CR><LF> - Carriage return and line feed to mark the end of the sentence. These are non-printing characters that might not be seen but will be transmitted as ASCII characters 013 and 010.
The maximum sentence length is 80 characters. If data is unavailable two commas with nothing in between are sent.
The standard allows a manufacturer to define its own proprietary sentences. These allow more functionality but are unique to each manufacturer. These type of sentences start with "$P". This is followed by a 3-letter manufacturer ID and a 1-letter sentence identifier.
NMEA 0183 devices have serial ports. With a suitable cable they can be plugged into the PC's RS232 serial connector. Software like Windmill can then collect and interpret the data being sent from the instrument to the PC. Some manufacturers may use non-standard cables and plugs. It is often easiest, therefore, to buy the cable from your instrument supplier but you can make or modify your own. The NMEA signal or output line needs to be connected to the RS232 receiver or input line (line 2 on a 9-pin plug). The NMEA ground or earth needs to be connected to the RS232 ground or earth (5 on a 9-pin plug). Our Serial Ports and RS232 Connections page gives details on RS232 connections.
The NMEA 0183 Interface Standard specifies the
communication settings as
Baud Rate: 4800
Data Bits: 8
Stop Bits: 1 (or more)
These should work for all instruments but, depending on your device, you may be able to use a higher baud rate.
You will need to tell the data acquisition software about the communication settings your instrument is using.
After connecting your NMEA devices to the computer you need some software to capture the data and save it in a file, such as Windmill with the COMIML driver. Windmill also lets you chart data and export it to other programs like mapping packages, spreadsheets and databases.
When using Windmill you have to specify how to extract data from the sentance, storing each type of data in a channel. For example, with our sentence
to obtain a latitude reading you might
- search for "$GPGLL,"
- extract next 7 characters
and store the result in Channel 0.
For more on the National Marine Electronics
Association, or to purchase a copy of the standard,
For examples of how Windmill is capturing data from NMEA 0183 instruments see
For more on connecting GPS receivers to a PC see