0

This question already has an answer here:

I would like to ask if it possible to get NMEA code/string from a GPS module that connected to one of the GPIO of a Raspberry?

marked as duplicate by goldilocks raspbian May 24 at 11:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

You don't mention which GPS module you have, so I can not provide a definitive yes, but given the right GPS module it is possible using the UART (tx/rx pins). Another alternative depending on your module is to use one of the USB ports (either directly connected for modules that have a usb cable or via a USB to TTL cable). Adafruit has a complete tutorial covering the use of a GPS module with the Raspberry Pi.

  • hi @SteveRobillard right now my collegue told me that our GPS antenna provide NMEA code/string by means of its either TTL and RS323 – CeciliA Jan 9 '17 at 5:23
  • read the linked tutorial – Steve Robillard Jan 9 '17 at 5:24
  • You can also search this site for nema – Steve Robillard Jan 9 '17 at 5:26
  • Sir @SteveRobillard is there a way i can get the NMEA string using python? – CeciliA Jan 9 '17 at 5:34
  • 1
    Don't be sorry take it as a lesson learned, we were all noobs once and I learned this lesson from the very first system administrator I ever worked with. – Steve Robillard Jan 9 '17 at 6:29
1

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)

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