NMEA to OPC. How to get GPS data through the OPC interface?
Does your NMEA software support an OPC Interface (www.opcfoundation.org)?
Sample NMEA data from GPS and Sounder:
- Advanced NMEA Data Logger Professional, Enterprise or a trial version;
It is assumed that:
You've created a configuration (usign the "Green Plus" button in the main window and configured communication parameters (baud rate, number of data bits, flow control etc) in the nmea data logger and can receive any data without communication errors.
Selecting NMEA sentences of GPS and the sounder
The GPS devices outputs several sentences that begin with GPGLL, GPGGA, GPVTG or GPRMC. "GP" means that this is a data from a GPS device. "SD" - sounder. GLL, GGA, RMC, DBT - NMEA sentence names. We may process and extract only the following NMEA sentences, because these sentences contain all necessary data
- GGA (GPS fix data) contains GPS coordinates: latitude, longitude, altitude;
- VTG (Vector track an speed over the ground) contains speed in km/h;
- DBT (Depth below transducer) contains sounder data (depth below keel) in meters.
A detailed description of all NMEA sentences you may easily find in Google.
Configuring the NMEA parser
Now, we are ready for configuring modules. First, we should configure the NMEA parser (fig. 1, 2). Now, please, open a configuration window of the NMEA parser plug-in (click the "Setup" button near a drop-down box fig. 1, pos.1). The dialog window will appear on the desktop (fig. 2).
Fig.1. NMEA data parser
Fig.2. NMEA data parser. Common settings
You may use the default settings here, because our NMEA devices output standard NMEA sentences. On the next page (fig.3) you should unselect all sentences except three sentences: DBT, GGA and VTG (fig. 3, pos. 1).
Fig.3. NMEA data parser. NMEA sentences
Please, click the "OK" button and close the configuration window of the parser.
Activating OPC server
Ok. We are going to the next stage.
1. Activate the OPC server, using the checkbox before the plugin name (fig. 4);
Open the configuration window of the OPC Server plug-in (fig. 5) by selecting the module in the list and clicking the "Setup" button on the "Data Export" tab.
Fig.4. Activating the OPC server
Fig.5. OPC server. Connection parameters
Here you can see the OPC server name and GUID. Using these parameters, you can connect from an OPC client to the OPC server. Go to the "Predeclared items" tab and click the "Import all" button (fig. 6, pos. 1). The OPC server will import all OPC tag names from the parser. If you'll select other NMEA sentences in the parser later, then click the "Import all" button again.
Fig.6. OPC server. OPC tag names
Getting variable names for NMEA data: GPS latitude, longitude, altitude, speed and sounder data
Click the "OK" button twice and close all configuration windows. All plugins will be activated. Now, the NMEA parser and the OPC server are ready and we can test it. Connect your device and/or power it on and try to receive data packets with NMEA data. When data will appear in the main window you can open a configuration window of the OPC server and watch all available OPC tags (fig. 7). Each NMEA sentence will be splitted to several parser items. All parser items will be automatically converted to OPC tags. You may select necessary data in the OPC client by selecting corresponding OPC tags.
Fig.7. OPC server. Active OPC tags
We've configured the NMEA parser and it prepares several parser items. Their names you may see on the fig.7. Now, you can simultaneously export these parser items to any database (MS SQL, MySQL or Access) or Excel.