bg

Receive and parse data from the Garmin Geko301 GPS receiver

Task:

I am trying to receive TEXT data from the Garmin Geko 301 GPS receiver. Geko is the small and light waterproof GPS unit with a simple operating system. I want to put position data into Microsoft Excel. The GPS data logger's simple text (ASCII) output contains time, position, and velocity data in the fixed-width fields (not delimited) defined in the following table:

    FIELD DESCRIPTION:      WIDTH:  NOTES:
    ----------------------- ------- ------------------------
    Sentence start          1       Always '@'
    ----------------------- ------- ------------------------
   /Year                    2       Last two digits of UTC year
  | ----------------------- ------- ------------------------
  | Month                   2       UTC month, "01".."12"
T | ----------------------- ------- ------------------------
i | Day                     2       UTC day of month, "01".."31"
m | ----------------------- ------- ------------------------
e | Hour                    2       UTC hour, "00".."23"
  | ----------------------- ------- ------------------------
  | Minute                  2       UTC minute, "00".."59"
  | ----------------------- ------- ------------------------
   \Second                  2       UTC second, "00".."59"
    ----------------------- ------- ------------------------
   /Latitude hemisphere     1       'N' or 'S'
  | ----------------------- ------- ------------------------
  | Latitude position       7       WGS84 ddmmmmm, with an implied
  |                                 decimal after the 4th digit
  | ----------------------- ------- ------------------------
  | Longitude hemishpere    1       'E' or 'W'
  | ----------------------- ------- ------------------------
  | Longitude position      8       WGS84 dddmmmmm with an implied
P |                                 decimal after the 5th digit
o | ----------------------- ------- ------------------------
s | Position status         1       'd' if current 2D differential GPS position
i |                                 'D' if current 3D differential GPS position
t |                                 'g' if current 2D GPS position
i |                                 'G' if current 3D GPS position
o |                                 'S' if simulated position
n |                                 '_' if invalid position
  | ----------------------- ------- ------------------------
  | Horizontal posn error   3       EPH in meters
  | ----------------------- ------- ------------------------
  | Altitude sign           1       '+' or '-'
  | ----------------------- ------- ------------------------
  | Altitude                5       Height above or below mean
   \                                sea level in meters
    ----------------------- ------- ------------------------
   /East/West velocity      1       'E' or 'W'
  |     direction
  | ----------------------- ------- ------------------------
  | East/West velocity      4       Meters per second in tenths,
  |     magnitude                   ("1234" = 123.4 m/s)
V | ----------------------- ------- ------------------------
e | North/South velocity    1       'N' or 'S'
l |     direction
o | ----------------------- ------- ------------------------
c | North/South velocity    4       Meters per second in tenths,
i |     magnitude                   ("1234" = 123.4 m/s)
t | ----------------------- ------- ------------------------
y | Vertical velocity       1       'U' (up) or 'D' (down)
  |     direction
  | ----------------------- ------- ------------------------
  | Vertical velocity       4       Meters per second in hundredths,
   \    magnitude                   ("1234" = 12.34 m/s)
    ----------------------- ------- ------------------------
    Sentence end            2       Carriage return, '0x0D', and
                                    line feed, '0x0A'
    ----------------------- ------- ------------------------

If a numeric value does not fill its entire field width, the field is padded with leading '0's (e.g., an altitude of 50 meters above MSL will be output as "+00050"). All of the data in the text sentence (except for the sentence start and sentence end fields) may be replaced with underscores to indicate invalid data.

Data view mode
Fig.1. GPS data captured by the data logger software

Requirements:

  • Advanced Serial Data Logger Professional, Enterprise, or a trial version.
  • ASCII Data Query and Parser

It is assumed that:

You've configured communication parameters (baud rate, the number of data bits, flow control, etc.) in the data logger and can receive any data without communication errors.

Solution:

The image above shows that the data flow is simple, where each record has a fixed length and a fixed position of each item, but doesn't contain non-printable characters and doesn't show ending characters of a data packet. We need to recognize the ending characters of each data record. Please, enable display output for non-printable characters with a character code below than 0x20h. You need to create a port configuration. Please, click the "Plus" button in the main window if you didn't make it before and set the following options.

Serial data view setup
Fig.2. Serial data view setup

Then click the "OK" button and try to receive the data from a port. You should receive the data as in the figure below.

GPS data logger. Data received.
Fig.3. GPS data logger. Data received.

It's another view of the received data. All non-printable characters have been replaced with their code like #1B. Now, it is clear that a single data packet (in a green rectangle) begins with "@" and ends with "#0D" (underlined by red).

Now, we are ready to configure modules. First, please, select the "ASCII data parser and query" plugin (fig.4a, pos.1) from a drop-down list. Then, enable a parsing option for data received (fig. 4a, pos. 2) and select necessary data export plugins. The DDE server (fig.4b, pos.3) will help us to check that the data packet is parsed and exported. The "Local database" plugin will create Microsoft Access (MDB) files.

GPS data logger. Data parser plug-in
Fig.4a. GPS data logger. Data parser plugin.

GPS data logger. Data export plug-ins
Fig.4b. GPS data logger. Data export plugins.

Now, please, open the ASCII parser and query configuration window by clicking the "Setup" button near a drop-down box (fig.4a, pos.1). The dialog window below will appear on the desktop (fig.5).

GPS data logger. The configuration window of the parser plug-in
Fig.5. GPS data logger. The configuration window of the parser plugin.

The configuration process should be straightforward if you have examined your data flow in the data logger window (Fig.3). You should type in the same as in the data logger window in fields 1 and 2. Field #1 marks the beginning of the data block, and field #2 marks the end. Field #1 is the start marker of the data packet ("@" in this example), and field #2 is the end of the data packet ("#0D" in this example). Values, which you should type, are underlined by the red color on the fig.3. You should specify a timeout value in field #3, which will be used if the module will not receive ending characters in the specified interval.

The next page is a significant part of the parser configuration. The data parser uses this information for data extraction from the data packet. The data packet from this example contains 3 data items, which should be placed on different variables. Later, these variables (we need two variables only: the first character and weight) will be used in a data export module and placed in different columns of the Microsoft Access database.

GPS data logger. Parser items
Fig.6. GPS data logger. Parser items.

Any new items may be added by clicking the "Add item" button (pic.6, pos. 7). Before adding an item, the program will ask you about an item description. You can type any characters here, which will help you to remember a variable's content. We had added all seven variables with corresponding descriptions.

Each parser item has several properties:

  1. Item name. This name will be bound to a column in the data export plugin. It is a limited text description and cannot contain spaces and a few other characters;
  2. Parser's type. It is a method that the program uses for data extraction. Our parser has a few methods from simple to the most powerful. In this example, where data is being placed in a random place, we can use the simple method - fixed position. This method allows extracting any number of characters from any fixed position of the data packet;
  3. Data type. It is the data type of the characters extracted. If you specify a data type other than the "STRING" data type, the module tries to convert the string value to the specified data type. The module allows configuring several options that will be used at the conversion (see the "Data format" tab). In this example, several items have the "Integer" data type, the "iDate" item has the "Datetime" data type, and all other items have the "String" data type. Therefore, we'll use all options from the "Data formats" page;
  4. Default value. The value specified here is to be used when data cannot be extracted from a data packet;
  5. Fixed position. It is the position of the first variable's character in our data block. The minimum value is 1;
  6. Fixed length. It is the number of characters, which will be transferred to a variable. The minimum value is 1.

All other items have the same parameters, a position, a length and a data type.

In the next tab, you can specify basic format options as per (fig.7). If you had specified the data type "String" in the item's parameters, then the first two options allow you to remove blank spaces from a value. Our called and caller number contain blank spaces at the start of a value. The second option allows you to convert the date-time string to a field with the "datetime" data type. We specified YYDDMMHHNNSS here, according to the specification above. For a detailed description of formatting characters, please, see the help file.

GPS data logger. Format of items
Fig.7. GPS data logger. Format of items.

Other options are unnecessary in our case because all our items do not have the date or time data type.

Click the "OK" button and close the parser configuration window. Then click the "OK" button in the options window.

Now that our parser is ready, it is time for testing it. Connect your device and power it on if necessary. Check to see if you can receive a data block from the specified serial port. If the parser had been correctly set up, then you should see all parser items and their values (fig.8) in the DDE server window below.

GPS data logger. The DDE server window
Fig.8. GPS data logger. The DDE server window.

All parser items are now ready for export to the Access database.

Related articles: Receive and parse data from the Garmin Geko301 GPS receiver