Gpsd

From Wildsong
Revision as of 06:11, 17 December 2024 by Brian Wilson (talk | contribs) (→‎Grove GPS, for Kali)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

What and why

gpsd is a service that listens to one or more gps receivers and makes the received data available over a network connection. It understands a wide variety of binary protocols.

What you get with gpsd

Besides the daemon "gpsd", of course...

In /usr/local/bin, you will find

  • lcdgps
  • gpxlogger
  • gpspipe
  • gpsmon
  • gpsdecode
  • gpsctl
  • cgps

Position

Time

Magnavox GPS reference station

I will be running gpsd in a docker container on Bellman to set up my Magnavox reference station.

docker pull forcedinductionz/docker-gpsd
docker run -it -p 2947:2947 --device=/dev/ttyAMA0 forcedinductionz/docker-gpsd -D2 /dev/ttyAMA0

By using docker I avoid installation issues of getting it going on a Mac. I still have to configure it. Not able to do that at the moment. (My GPS receiver is packed in a box.)

Grove GPS, for Kali

I am putting a GroveGPS (from M5Stack) on a Pi 5, so it can talk to the Kismet data logger. See also WiFi Wireless Projects. I tried using the GrovePi Zero hat and gave up on it, currently I have the GPS jumpered directly into the GPIO port on the Pi 5.

The blue led in the GPS module will be blinking when it's sending out NMEA data.

I am not seeing any output, I tried swapping TX and RX and I tried 9600 and 115200. But even if I got the bit rate wrong I should still see something. I tried using "minicom -D /dev/ttyAMA10".

I did NOT have to disable console login! There is a separate UART on a separate connector on the Pi 5 (which is compatible with the Pi Pico Debug Module)

I had to add a line near the start of /boot/config.txt "dtoverlay=uart0" and then reboot. There is now a second UART device, /dev/ttyAMA0.

After sorting out the wiring and enabling the port, I can see clean NMEA strings in minicom on /dev/ttyAMA0 not AMA10

With that out of the way I can set up gpsd.

GPSd setup

apt install gpsd gpsd-clients
systemctl enable gpsd.service

Edit /etc/default/gpsd to specify settings. DEVICE is /dev/ttyAMA0 and speed should be set to 9600 normally but gpsd can figure that part out. Finally, start the daemon and see if it's getting data.

gpspipe -r
┌──(kali㉿kali-raspberry-pi5)-[~]
└─$ gpspipe -r
{"class":"VERSION","release":"3.25","rev":"3.25","proto_major":3,"proto_minor":15}
{"class":"DEVICES","devices":[{"class":"DEVICE","path":"/dev/ttyAMA0","activated":"2024-12-17T06:09:15.496Z","native":0,"bps":9600,"parity":"N","stopbits":1,"cycle":1.00}]} {"class":"WATCH","enable":true,"json":false,"nmea":true,"raw":0,"scaled":false,"timing":false,"split24":false,"pps":false}
$GNGGA,060915.000,4610.46144,N,12350.28108,W,1,09,1.2,2.3,M,0.0,M,,*66
$GNGLL,4610.46144,N,12350.28108,W,060915.000,A,A*58
$GPGSA,A,3,05,20,25,29,,,,,,,,,2.4,1.2,2.1*3F
$BDGSA,A,3,14,28,33,37,42,,,,,,,,2.4,1.2,2.1*28
$GPGSV,3,1,12,05,59,084,12,11,12,064,,12,08,164,,15,06,143,*73
$GPGSV,3,2,12,18,45,255,,20,32,050,19,23,08,199,,25,36,191,18*75
$GPGSV,3,3,12,26,28,308,,28,05,257,,29,83,013,11,31,10,283,*78
$BDGSV,3,1,09,11,19,085,,14,39,105,25,21,07,028,,23,08,198,*6D

Ah joy!

Python integration

I need to put a short python script here...

Resources

gpsd home: http://gpsd.berlios.de/