Raspberry Pi and USB GPS

Raspberry Pi and USB GPS

Just a couple of notes because this was trickier than expected, especially since all my experiences with Arduinos and GPSs have been fairly straightforward.

I bought a cheap USB GPS which turns out to be a Neo-7 - dmesg giving

[   28.770396] usb 1-1.5: New USB device found, idVendor=1546, idProduct=01a7
[   28.770426] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[   28.770443] usb 1-1.5: Product: u-blox 7 - GPS/GNSS Receiver
[   28.770459] usb 1-1.5: Manufacturer: u-blox AG - www.u-blox.com
[   28.771952] cdc_acm 1-1.5:1.0: ttyACM0: USB ACM device

So, 'simples' thinks I: install gpsd and gpsd-clients and then start gpsd with sudo gpsd /dev/ttyACM0 -n -F /var/run/gpsd.sock and running cgps -s will give me my location.

Not so fast there. cgps is giving me no fix and timing out.

First check the gps is working by simply looking at the serial output stream with
cat /dev/ttyACM0

Yep that works - there are the NMEA sentences and I can see the valid fix data. SO the problem must be with gpsd.

Long story short, after looking at syslog and realising it must be a socket problem I Googled around and found this page https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=138711 where I owe a big THANK YOU to Per Linderholm for his post suggesting changing /lib/systemd/system/gpsd.socket

Here's the relevant bit of his post

I think the problem is in how systemd is configured.

Try to change /lib/systemd/system/gpsd.socket
from

ListenStream=127.0.0.1:2947

which listens to localhost only
to

ListenStream=0.0.0.0:2947

which listens to "all" , and restart gpsd (or reboot).

Thanks Per that fixed it and now I get all my location data working nicely with cgps.

Alas, too soon I spoke Today I decided to rebuild the Raspberry Pi (don't ask!) and the above steps failed. I then remembered that I had previously tried something else from that link - delorian's hint that the socket needed deleting via:

sudo systemctl stop gpsd.socket
sudo systemctl disable gpsd.socket

Ah, now looking at syslog I can see gpsd is starting correctly and, yes indeed, cgps works!