GPS Daemon
gpsd is a service daemon that monitors one or more GPSes or AIS receivers attached to a host computer through serial or USB ports, making all data on the location/course/velocity of the sensors available to be queried on TCP port 2947 of the host computer, see gpsd for more information.
Get the Address of the GPS Device
-
Before plugging the GPS device into the USB socket, enter:
ls /dev
-
It will return a list of all the connected devices. Plug the GPS device into the USB, you can check that the device is connected by using the command:
lsusb
-
It shows all the connected devices, the Stemedu GPD device shows as U-Blox AG.
$ lsusb Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 003: ID 1546:01a7 U-Blox AG [u-blox 7] Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
-
Running the first command again and the GPS device will now be listed. The Stemedu USB GPS module is typically listed at /dev/ttyACMO.
Configure the GPS Device Service Daemon Connection
Before starting the GPS Device Service, a GPS daemon must be running. The device service can connect to a daemon running on either the same host or a different host.
Linux comes with a daemon called gpsd
that can process the information delivered by a GPS device. To install gpsd
use the command:
sudo apt-get install gpsd
To start the GPS daemon locally, complete the following steps:
-
First, stop the GPS daemon to ensure that it is not already running or connected to an unintended device using the following commands:
sudo systemctl stop gpsd sudo systemctl stop gpsd.socket
-
Check that the GPS daemon port is not in use, using the following command, replacing
<gpsd_port>
with the port number of your GPS daemon. The default port number is usually2947
.netstat -aon | grep <gpsd_port>
The result is empty if the port is not in use.
-
Ensure the GPS daemon has privileges to attach to the device using the following command. Replace
</dev/tty>
with the address of your GPS device on the host.sudo chmod 777 </dev/tty>
-
Start the GPS daemon, using the following command. Replace
</dev/tty>
with the address of your GPS device on the host.gpsd -N -n -G </dev/tty> -D1
-
Check that the GPS daemon port is now in use using the following command, replacing
<gpsd_port>
with the port number of your GPS daemon.netstat -aon | grep <gpsd_port>