2

we're trying to read data from a digital yacht AISnet base station on a Pi. From what I've read, Digital Yacht has drivers for both osx and windows (but not linux for this unit) and their job is to create a virtual com port so that the device can send an NMEA 1083 stream as if it's doing RS-232 serial communication. We are OK with parsing the NMEA data ourselves, but I don't know much about drivers. Wondering if anyone has any experience getting NMEA data from a digital yacht or similar device in to the Pi?

  • There is a chance the GPS unit will just spit out the sentences over the USB as serial data. Have you tried plugging it in? What do dmesg and lsusb report? – joan Apr 8 '17 at 19:34
2

Well, I'm answering my question because it was easier than I thought. The linux "gpsd" project provided everything we need, because GPS units use the same protocol, NMEA 1083. I found all docs I needed on the gpsd site:

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

You can install the gpsd daemon, and then connect to it with client code or with telnet and see all the AIS messages it picks up, already parsed to json messages. Fantastic!

  • 1
    So basically it operates like every other GPS device. You plug it in and it spits out the sentences. – joan Apr 9 '17 at 8:39
  • yup! I had no idea what I was looking for was GPS (we're using an AIS box) so it took while to discover that gpsd did what we want. – Iain Duncan Apr 9 '17 at 16:25
0

Getting GPS's Data: GPS receives data from output NMEA0183, tcp: // 2947, class: TPV & amp; tag: GPGGA.

Next is the step in the terminal to access GPS data:

  1. Install: gpsd, gpsd-clients. (Note: install both use apt-get install)
  2. Reboot (sudo reboot or sudo init 6)
  3. Sudo dpkg-reconfigure gpsd (Note: configuration baudrate = 9600, 8 N 1 data format).
  4. Serial tests with the command: gpspipe -r or cat /dev/ttyS* or /dev/ttyUSB* (Note: the * sign matches the read, use command ls /dev/ttyS*, /ttyS*, /ttyAMA* or /ttyUSB* or others).
  5. If point 3 fails, stop and disable socket 2947 for a while. Try to type with the command & then reboot Raspberry Pi immadiately:

    $ sudo systemctl stop gpsd.socket

    $ sudo systemctl disables gpsd.socket

  6. Then start and enable gpsd socket with command:

    $ sudo systemctl start gpsd.socket

    $ sudo systemctl enables gpsd.socket

  7. Start daemon using command:

    $ sudo gpsd /dev/ttyS0 –F /var/run/gpsd.sock

  8. For live straming:

    $ cgps –s or $ cgps or gpsmon

In practice way to get stream data GPS from NMEA Output, you can also use a simple command:

$ timeout 10s gpspipe -w -n 10 | grep -m 1 speed

$ timeout 10s gpspipe -w -n 10 | grep -m 1 speed | jq

Using json query / jq for pretty printing.

In python script:

def getGPS():
    gpspipe= "timeout 10s gpspipe -w -n 10 |  grep -m 1 speed"
    p = subprocess.Popen(gpspipe, stdout = subprocess.PIPE, shell = True)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.