-------------------------Monitor------------------------ The Newsletter for PC-Based Data Acquisition and Control Issue 52 www.windmill.co.uk November 2002 --------------------ISSN 1472-0221---------------------- Welcome to November's issue of Monitor. This month how to connect NMEA 0183 instruments (GPS receivers, sonar, etc) to a PC. CONTENTS ======== * Interfacing NMEA Instruments - NMEA sentence structure - Connecting to a PC - Software to Capture NMEA data * Excel Corner * Printing the Windmill Help Topics ________________________________________________________ ________________________________________________________ Interfacing NMEA Instruments ________________________________________________________ Although each electronic measuring instrument may do a necessary job on its own, it is far more useful when its information is integrated with that from other pieces of equipment. Depth data from sonar and position data from a GPS receiver combined to plot a contour map for example. The NMEA interfacing standard ensures that conforming instruments all speak the same language. This language can be understood by PC software like the free version of Windmill. 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). Today we're concentrating on NMEA 0183. * NMEA 0183 Sentence Structure ============================ 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 GLL Geographic position, Latitude, Longitude 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. $GPGLL,5330.25,N,00215.31,W,134531,A*2D
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.25 minutes, ie 53 degrees, 30 minutes and 25 seconds. N - North (or S for South). 00215.31 - Longitude 2 degrees and 15.33 minutes, ie 2 degrees, 15 minutes and (around) 2 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. - 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. * Connecting to a PC ================== NMEA 0183 instruments have serial ports. With a suitable cable they can generally by 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). Issue 42 of Monitor gave details on RS232 connections. The NMEA 0183 Interface Standard specifies the communication settings as Baud Rate: 4800 Data Bits: 8 Parity: None 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. * Software to Capture NMEA data ============================= After connecting your NMEA devices to the computer you need some software to capture the data and save it in a file. The free Windmill 4.3 software we offer all subscribers does this - as does the newer and easier to configure Windmill 6 with COMIML software - https://www.windmillsoft.com/daqshop/rs232-modbus.html. 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 parse the data sentence, storing each type of data in a channel. For example, with our sentence $GPGLL,5330.25,N,00215.31,W,134531,A*2D to obtain a latitude reading you might - search for "$GPGLL," - extract next 7 characters and store the result in Channel 0. * Further Reading =============== For more on the National Marine Electronics Association, or to purchase a copy of the standard, see http://www.nmea.org/ A fuller list of talker and sentence identifiers is at http://vancouver-webpages.com/peter/nmeatype.txt For examples of how Windmill is capturing data from NMEA 0183 instruments see https://www.windmill.co.uk/fluorescence.html https://www.windmill.co.uk/mapping.html https://www.windmill.co.uk/train.html For more on connecting GPS receivers to a PC see https://www.windmill.co.uk/gps.html For information on NMEA 2000 see http://www.cankingdom.org/download/Download%20files/Basics/ME-a-Mar99-20001.doc ________________________________________________________ ________________________________________________________ Excel Corner: Inserting a Line Break in a Cell ________________________________________________________ When using an Excel spreadsheet for analysis or display, how do you control where the line break appears in a cell with a long text entry? Pressing the Enter key just moves you to the next cell. To force a line break press the Alt key at the same time as the Enter key and Excel will insert a carriage return. For more tips on using Excel with Windmill see https://www.windmill.co.uk/excel/ https://www.windmill.co.uk/excel/excel-charting.html ________________________________________________________ ________________________________________________________ Printing the Windmill Help Topics ________________________________________________________ All the Windmill programs come with on-line Help. If you wish to print the entire Help file you do not have to do so topic by topic. Instead you can simply: - press the Contents button and display the Contents window - then select a Heading and press the Print button. All topics under this heading will be printed. To print the contents of a pop-up window: - use your right mouse button to click the pop-up - then select Print Topic. You can download the latest version of each Help file from https://www.windmill.co.uk/help.html ________________________________________________________ * Copyright Windmill Software Ltd * Reprinting permitted with this notice included * For more articles see https://www.windmill.co.uk We are happy for you to copy and distribute this newsletter, and use extracts from it on your own web site or publication, providing the above notice is included and a link back to our website is in place. An archive of previous issues is at https://www.windmill.co.uk/newsletter.html and an index of articles at https://www.windmill.co.uk/newsletter.html Windmill Software Ltd, PO Box 58, North District Office, Manchester, M8 8QR, UK Telephone: +44 (0)161 833 2782 Facsimile: +44 (0)161 833 2190 E-mail: [email protected] https://www.windmill.co.uk/ https://www.windmillsoft.com/
To receive Monitor every month please fill in your e-mail address below. We will not pass your address to any third parties, nor send you any unsolicited e-mail.