Old nmea conversion to new

32 views
Skip to first unread message

John Hoogenboom

unread,
Jun 7, 2020, 8:54:11 AM6/7/20
to kplex
Good day, is it possible to use kplex to convert from old NMEA to new NMEA strings?
In my case connect a old wind instrument to a new Garmin plotter.

Alan Hails

unread,
Jun 8, 2020, 5:12:57 PM6/8/20
to kplex
John, not directly, but, yes, indirectly kplex can enable what you want to do.

Kplex needs to accept as an input a correctly formatted NMEA sentence to then output it to your networked Garmin plotter - that is formatted as an NMEA version wind sentence the Garmin will accept.  

By making a hardware serial connection to your computer [PC, Beaglebone Black, Raspberry PI, etc.] typically via USB, then writing a C or other program to read and parse your old format wind sentence you then compose a new NMEA formatted wind data sentence, including, of course, a new NMEA checksum you must calculate.  You can then get that sentence to kplex by sending it out via stdout.  In C, for example , snprintf() publishes the sentence to stdout.  

At runtime you can "pipe" your program's stdout to kplex with, for example,  ./YourProgramName | kplex -d 9 file:direction=in.  Kplex will from then on accept your reformatted NMEA wind sentences and TCP network broadcast them to your network connected Garmin plotter.

Alternatively, kplex could output the new formatted Wind sentences to a serial port to which you connect your Garmin plotter, typically via a USB-to-Serial converter then wired to an NMEA input port on your Garmin.

Hope that's clear and helpful.

Keith Young

unread,
Jun 13, 2020, 5:34:01 AM6/13/20
to kplex
What Alan said :-)

A hook for a user-supplied "conversion" script/program had always been on the "to do" list but was never implemented: A lot of people might be happy writing a python script to read standard input, convert, and write to standard output but might want to use kplex to do all the messy networky stuff.

To augment Alan's excellent suggestions you can use kplex to do both the reading (from serial, network, whatever) and writing with your script in the middle of a pipeline.  e.g. if you're reading your old wind data from /dev/ttyUSB0 at 4800baud:
kplex -f-  serial:device=/dev/ttyUSB0,direction=in file:direction=out | YourProgram | kplex file:direction=in

...where "-f-" tells the first kplex instance not to use a configuration file and only use command line interfaces which in this case is a serial input and standard out as output ("file:" with no "filename" defaults to stdin/stadout).

For added complexity but greater neatness you can do it all from within one kplex instance:
* Create 2 FIFOs in the filesystem (with mkfifo), one input one output
* Have your kplex config output only the old style wind sentences to the output fifo
* Have your kplex config input form the second fifo
* filter all other outputs to discard the old style wind data
* Have your program/script read old style data from kplex's output FIFO, convert, and write back to kplex's input FIFO

...more detail on request but this may be more complexity than you're looking for
Reply all
Reply to author
Forward
0 new messages