NMEA Client for OpenWRT (Linino)

Hi folks,

My Mifi supports NMEA as a server. I'm looking to have Linino read this data and post it to a log. Only thing google shows me is how to build an NMEA server. I want the opposite of that. \

Windows and other setups are easy, but this is a stand alone setup with only the Yun listening to the Mifi inside an automobile. The idea is that it will periodically ping the GPS and upload it to a log giving it's location. Sort of a DIY Lojack so to speak. I know I could buy a GPS and have it do this, but it already exists on my Mifi, so I figured I should be able to tap into it somehow.

Do you mean this? http://www.nmea.org/

Some more details of the server on the MiFi would be helpful. Since it's a network oriented device, I assume you would need to open a TCP network stream to it and read data from it. You can easily do it on the Linux side, or YunClient will do it on the Arduino sketch side.

Once you have the connection open, the data will likely be a stream of NMEA sentences, just like you would receive from a GPS connected through a serial port. There is a lot of code out there for parsing NMEA sentences, you would just have to pass it the data from the network port instead of a serial port.

jessemonroy650:
Do you mean this? http://www.nmea.org/

Hi Jesse, to answer your question, I don't really know. Their site is somewhat nebulous to me, but it may be what the GPS standards are based on.

ShapeShifter:
Once you have the connection open, the data will likely be a stream of NMEA sentences, just like you would receive from a GPS connected through a serial port. There is a lot of code out there for parsing NMEA sentences, you would just have to pass it the data from the network port instead of a serial port.

Thanks ShapeShifter, it's what I'm looking for, but have only been able to find examples of folks trying to serve out NMEA GPS data. I've not found a good example to follow to act as the client to read the data. For windows, they have "drivers" that seem to translate the stream. Linux may be the same where there is a driver that translates it to a serial port to read the sentences. I guess I'm just looking for that (if it exists), along with an example or how-to doc somewhere.

supersleeper:
but it may be what the GPS standards are based on.

It is. NMEA is the National Marine Electronics Association, which is a collaborative organization of marine electronics manufacturers that have set the standard used by various equipment to talk together, even if the equipment comes from different manufacturers. GPS is one such piece of equipment, and standard NMEA sentences are the most common way of receiving data from a GPS unit.

The good news for you is that the transport of the data (serial link or network) is separate from the decoding of the data (parsing the data.) So as long as you can find NMEA parsing code that isn't hard-coded to receive from a serial port, you should be able to relatively easily feed it the data from a network port.

supersleeper:
Linux may be the same where there is a driver that translates it to a serial port to read the sentences.

I think you're missing the point. The NMEA data is already a serial stream of characters, you just have to process those characters. You do not need to translate from a network port to a serial port.

There is the transport mechanism (a serial port, network socket, data file, etc) and there is the decoder (the code that actually parses the NMEA data into values of position, course, speed, etc.)

You will need to develop three pieces:

  • Connect a network port to the MiFi and read the stream of data from that port. Search for YunClient examples for one way of doing that. It can also be handled on the Linux side.
  • Parse the NMEA data. There is a lot of code out there, you just need to find one that allows you to pass it data rather than one that insists on reading from a serial port. Or, you should be able to fairly easily modify a GPS library (like the one from Adafruit) to read from a network socket instead of a serial port (in Arduino sketches, the Serial classes, SoftwareSerial classes, and the network client classes all derive from a common Stream object, so once you change the initialization code to open a network socket instead of a serial port, the rest of the code should just plain work.)
  • Finally, you need a piece of code to take the parsed data from the GPS decoder and do something with it. That will depend on your project. Perhaps you want to log it to a file and periodically upload that data to a server?

So you will have three main pieces of code you need to tie together. The data received from the first part gets passed to the second part to decode it, and the decoded data goes to the third part to do something with it.

The three individual parts are fairly common activities, and you should be able to find examples of each part. But the combination of the three is much more esoteric, and you will likely have trouble finding a canned solution that does everything. You will likely need to invest some of your own time and effort to combine the three pieces into a cohesive system.

supersleeper:
Hi Jesse, to answer your question, I don't really know. Their site is somewhat nebulous to me, but it may be what the GPS standards are based on.

@supersleeper,
my entire point is that we need some kind of specification or model to work by. There are dozens of variations on the same GPS signals. They all have separate goals and requirements. It would be good to know these.

Jesse

Possible method (I have no hardware (Mifi)!):

At Mifi:

To use GPS over Wi-Fi
(NMEA), click Download GPS Over Wi-Fi Drivers at the bottom of page to download and install the drivers.

Change port number to 2947

At Yun:

gpsd-clients - 3.7-1 - gpsd is a userland daemon acting as a translator between GPS and AIS receivers and their clients. gpsd listens on port 2947 for clients requesting position/time/velocity information. The receivers are expected to generate position information in a well-known format -- as NMEA-0183 sentences, SiRF binary, Rockwell binary, Garmin binary format, or other vendor binary protocols. gpsd takes this information from the GPS and translates it into something uniform and easier to understand for clients. This package contains auxiliary tools and example clients for monitoring and testing the GPS daemon.
libgps - 3.7-1 - gpsd is a userland daemon acting as a translator between GPS and AIS receivers and their clients. gpsd listens on port 2947 for clients requesting position/time/velocity information. The receivers are expected to generate position information in a well-known format -- as NMEA-0183 sentences, SiRF binary, Rockwell binary, Garmin binary format, or other vendor binary protocols. gpsd takes this information from the GPS and translates it into something uniform and easier to understand for clients. This package contains the libgps library.

opkg update
opkg install gpsd-clients
opkg install libgps

Software from gpsd-clients:

/usr/bin/gpxlogger
/usr/bin/lcdgps
/usr/bin/gpsctl
/usr/bin/cgps
/usr/bin/gpspipe
/usr/bin/gpsdecode
/usr/bin/gpsmon

Documentation:

http://www.catb.org/gpsd/