1

What I am trying to accomplish

I am trying to attach this specific GPS module to my raspberry since I really like the size. https://www.sparkfun.com/products/13670

enter image description here

And it was suggested in the following post.

How do I attach a GPS receiver?

I actually like the suggestion but I have two questions - I can't seem to find any resource with instructions on how to get that specific GPS device working. For other devices i've seen the sudo command to install them.

-Secondly, I see alot of these devices display their information in a certain console. I would like to know, Can I take the latitude / longitude results and place it in a python script so I can use as I like? Thank you

SDsolar
  • 2,208
  • 8
  • 24
  • 42
Niana
  • 127
  • 4
  • Yes, you can use Python. It can read the data stream directly. However, interpreting that data takes a bit of work. You'll want to search around to find someone else who has done it. Meanwhile, you can see the consoles you described here: https://raspberrypi.stackexchange.com/questions/68816/how-can-i-set-up-my-g-mouse-usb-gps-for-use-with-raspbian - Have you seen cgps -s and xgps? – SDsolar Jun 22 '17 at 21:58

2 Answers2

2

There is nothing to install.

The GPS unit will automatically transmit NMEA sentences over the serial link in a standard format.

You can decode the sentences yourself in a programming language of your choice are use one of the GNU GPS packages to decode and display the data.

joan
  • 67,803
  • 5
  • 67
  • 102
  • This Q&A describes the setting up of the daemon and software to interpret the data stream. https://raspberrypi.stackexchange.com/questions/68816/how-can-i-set-up-my-g-mouse-usb-gps-for-use-with-raspbian – SDsolar Jun 22 '17 at 21:55
1

Like @Joan said, there is nothing to install for the GPS module (sort of).

It is UART, so you can hook it up a few different ways:


Direct UART

The Pi has two UART pins on the header already, so you can hook up the module to those pins. The only problem is that the module uses 5v logic, which would most likely harm the Pi, as it is only 3v3 tolerant. So you would need a voltage divider from 5v to 3v or a level converter hooked up to the TX pin (pin 3) of the module. [Pins are numbered from right to left with the PCB below the connector.]

Refer to page 4 of the data sheet.

Here are the connections:

GPS ––––––––––––––––––––––– Pi

Vin (Pin 1) –––––––––––––––––– 5v (Pin 2 or 4)

GND (Pin 2) –––––––––––––––– GND (Pin 6, 9, or 14)

TX (Pin 3) –Voltage Converter– RX (Pin 10)

RX (Pin 4) –––––––––––––––––– TX (Pin 8)

Note: You don't have to put a voltage converter on the RX pin of the GPS.

To interface with the device, you will need to disable the serial console of the RPi. To do this, enter sudo raspi-config scroll to Advanced, then Serial, hit no, and reboot your Pi.

Finally, you need to install screen with:

sudo apt-get install screen -y

Once that is finished, interface your GPS with:

screen /dev/ttyAMA0 9600

Sometimes screen doesn't work for the Pi's UART pins, in that case use the last two commands of this tutorial.


USB

Since the module communicates with 5v UART, you can buy a cheap UART to USB (PL2303hx) converter. Pin connections are as such:

USB Converter ––– GPS

5v –––––––––––––– Vin (Pin 1)

GND –––––––––––– GND (Pin 2)

TX –––––––––––––– RX (Pin 4)

RX –––––––––––––– TX (Pin 3)

[Pins are ordered from right to left, where the PCB is under the connector.]

To interface with the module you will need to install screen with:

sudo apt-get install screen -y

Then, look in /dev with ls /dev and look for something like tty.usbserial or tty.USB0 something along those lines.

The data sheet for the module says it has a 9600 baud rate, so to interface with the device:

screen /dev/tty.usbserial 9600

Remember to replace tty.usbserial with what yours is in /dev.

That's it for USB!


Hope this helped!

Patrick Cook
  • 6,245
  • 5
  • 35
  • 61
  • Thank you for the comprehensive guide, yet I still one inquiry. I may simply go with the USB so to make this work I will need the GPS device(obviously) > then JST SH Jumper 6 wire (https://www.sparkfun.com/products/574) . Then male to female breadboard wire then the USB right? – Niana Mar 12 '16 at 23:05
  • @Niana You can wire the GPS to the USB converter any way you'd like. The way you've described should work fine. – Patrick Cook Mar 12 '16 at 23:10
  • 1
    Still waiting for my GPS in the mail however, will screen allow me to access/ pass data from the device to a python script? – Niana Mar 18 '16 at 00:45
  • @Niana no, have a look `pyserial` – Patrick Cook Mar 18 '16 at 00:57