Setting Everything Up
Save Subscribe
New Subscription
Please sign in to subscribe to this guide.
You will be redirected back to this guide once you sign in, and can then subscribe to this guide.
The easiest way to get started is to use an inexpensive USB to TTL adapter cable with your GPS module.
You can of course use the HW UART directly on the Pi, but as you can see in this tutorial (Freeing UART on the Pi) it's a bit more complicated, and there are no secondary consequences with the USB adapter.
This tutorial will assume that we are using the USB to TTL cable mentioned above, and that we are running on Raspbian. Raspbian already has the drivers for PL2303-based cables pre-installed, so you just need to plug it in and it should show up as /dev/ttyUSB0).
The first thing you'll need to do is to hook your Ultimate GPS Breakout up to the Pi with the adapter cable. The following diagram shows you what you need to know, essentially just connecting the cables of the same color together.
- GPS Vin to USB 5V or 3V (red wire on USB console cable)
- GPS Ground to USB Ground (black wire)
- GPS RX to USB TX (green wire)
- GPS TX to USB RX (white wire)
While the module on the Ultimate GPS Breakout has an exceptionally sensitive antenna and may work indoors as is, you may want to pick up an external GPS Antenna and an SMA to u.FL adapter cable if this is for indoor use. This will allow you to keep the Pi and GPS breakout indoors, but run the antenna out a window or at least near one for improved reliability and signal integrity.
Once you plug the USB cable into the Pi, the adapter should show up as /dev/ttyUSB0 (though the '0' may be different if you have other ttyUSB adapters present).
You can see a list of all ttyUSB devices by entering the following into the console (I'm using the 'terminal' feature in Adafruit's browser-based WebIDE here for convenience sake!):
Download File
Copy Code
ls /dev/ttyUSB*
If you have any problems, you can enter the following command to see the USB devices on your Pi:
Download File
Copy Code
sudo lsusb
Which should show you the USB adapter (Prolific PL2303), as follows:
If you just want to do a quick check to see what data is coming out of the GPS, you can enter the following command, followed by Ctrl-C to quit:
Download File
Copy Code
sudo cat /dev/ttyUSB0
The next step is installing some software on your Raspberry Pi that understands the serial data that your GPS module is providing via /dev/ttyUSB0.
Thankfully other people have already done all the hard work for you of properly parsing the raw GPS data, and we can use (amongst other options) a nice little package named 'gpsd', which essentially acts as a layer between your applications and the actual GPS hardware, gracefully handling parsing errors, and providing a common, well-defined interfaces to any GPS module.
To install gpsd, simply run the following commands from the console:
Download File
Copy Code
sudo apt-get install gpsd gpsd-clients
... which will install the required packages (an internet connection will be required for this step!)
Raspbian Jessie systemd service fix
Note if you're using the Raspbian Jessie or later release you'll need to disable a systemd service that gpsd installs. This service has systemd listen on a local socket and run gpsd when clients connect to it, however it will also interfere with other gpsd instances that are manually run (like in this guide). You will need to disable the gpsd systemd service by running the following commands:
Download File
Copy Code
sudo systemctl stop gpsd.socketsudo systemctl disable gpsd.socket
Should you ever want to enable the default gpsd systemd service you can run these commands to restore it (but remember the rest of the steps in this guide won't work!):
Download File
Copy Code
sudo systemctl enable gpsd.socketsudo systemctl start gpsd.socket
After disabling the gpsd systemd service above you're ready to try running gpsd manually. Now run the following command to manually start gpsd and point it at the GPS breakout on the USB serial adapter port:
Download File
Copy Code
sudo gpsd /dev/ttyUSB0 -F /var/run/gpsd.sock
... which will point the gps daemon to our GPS device on the USB to TTY adapter cable (simply substitute '/dev/ttyUSB0' for another destination if required).
After a few seconds, gpsd should open up the proper socket and if the GPS is locked we should be able to get some data from the GPS module.
To test this, we can use the following command:
Download File
Copy Code
cgps -s
If you have a fix, you'll see something like the following information in the terminal window:
If you have any problems and cgps always displays 'NO FIX' under status and then aborts after a few seconds, you may need to restart the gpsd service. You can do that via the following commands:
Download File
Copy Code
sudo killall gpsdsudo gpsd /dev/ttyUSB0 -F /var/run/gpsd.sock
Introduction Using your GPS
This guide was first published on Jan 24, 2013. It was lastupdated on Mar 08, 2024.
This page (Setting Everything Up) was last updated on Mar 08, 2024.
Text editor powered by tinymce.
Related Guides
Esenciales para CircuitPython
ByKattni Rembor
4
Beginner
Adafruit Ultimate GPS Logger Shield
Bylady ada
52
Intermediate
Updated
Reverse Geocache Box
ByTyler Cooper
55
Intermediate
CircuitPython Essentials
ByKattni Rembor
403
Beginner
Updated
Adafruit Ultimate GPS
Bylady ada
178
Beginner
Adding a Single Board Computer to Blinka
ByM. LeBlanc-Williams
12
Intermediate
CircuitPython Libraries on Linux and the NVIDIA...
ByM. LeBlanc-Williams
6
Intermediate
Arduino GPS Clock
ByTony DiCola
70
Beginner
Track Your Treats: Halloween Candy GPS Tracker
ByTony DiCola
35
Beginner
Drive a 16x2 LCD with the Raspberry Pi
ByMichael Sklar
29
Beginner
Adafruit's Raspberry Pi Lesson 3. Network Setup
BySimon Monk
89
Beginner
Adafruit NFC/RFID on Raspberry Pi
ByKevin Townsend
73
Intermediate
Adafruit's Raspberry Pi Lesson 12. Sensing Movement
BySimon Monk
70
Beginner
Introducing the Raspberry Pi Zero
Bylady ada
106
Beginner