Set Up GPSD

If you’re using a USB GPS module like the VK-172, u-blox, or Neo-6M, you can get it running on a Raspberry Pi in just a few steps using gpsd. This guide walks you through the entire process, from hardware connection to live data display.

🔌 Step 1: Plug In Your USB GPS

Plug the GPS module into a USB port on the Raspberry Pi.

Check which device it appears as:

ls /dev/tty*

Typical results:

  • /dev/ttyUSB0
  • /dev/ttyACM0

Confirm it’s the GPS using:

dmesg | grep tty

📦 Step 2: Install gpsd and Tools

Update your system and install:

sudo apt update
sudo apt install gpsd gpsd-clients python3-gps -y

⚙️ Step 3: Configure gpsd

Edit the gpsd configuration file:

sudo nano /etc/default/gpsd

Update it as follows (replace /dev/ttyUSB0 with your device if different):

START_DAEMON="true"
GPSD_OPTIONS="-n"
DEVICES="/dev/ttyUSB0"
USBAUTO="false"
GPSD_SOCKET="/var/run/gpsd.sock"

The -n option allows gpsd to poll the GPS even if no client is connected.

🔁 Step 4: Enable and Restart gpsd

sudo systemctl enable gpsd
sudo systemctl restart gpsd

📡 Step 5: Test with cgps or gpsmon

Check if GPS data is being received:

cgps -s

or

gpsmon

If the GPS has a fix, you’ll see:

  • Latitude / Longitude
  • Altitude
  • Fix quality (2D/3D)
  • UTC time
  • Satellite count

🛠️ Troubleshooting

If cgps shows “No fix” or times out:

sudo systemctl stop gpsd.socket gpsd
sudo killall gpsd
sudo gpsd -N -n /dev/ttyUSB0 -F /var/run/gpsd.sock

Then re-run cgps.

🐍 Bonus: Access GPS Data with Python

Install the Python GPS module (already included in the earlier step):

import gps

session = gps.gps(mode=gps.WATCH_ENABLE)
for report in session:
    if report['class'] == 'TPV':
        print(report.lat, report.lon)

🧭 Recommended USB GPS Modules

ModelChipsetNotes
VK-172u-blox 7Compact, affordable
GT-U7u-blox 7Includes antenna
Neo-6Mu-blox 6Requires USB adapter

✅ Final Notes

  • GPS modules may need a minute or two to get an initial fix.
  • Make sure your GPS has a clear view of the sky for best accuracy.
  • You can use GPSD with other apps, log data to a file or database, or integrate it with services like InfluxDB and MQTT.

+ There are no comments

Add yours