MobilePenBerry/gps.md
2021-12-27 12:39:28 +01:00

2.1 KiB

GPS: Glonass G-7020 VK-172 GPS

I got myself the G-7020 GPS Module to connect my RPi via USB. Here is how it works

# requirements
sudo apt install gpsd gpsd-clients python-gi-cairo minicom

Check if gpsd is already running

ps -aux | grep gpsd
kill <gpsd id>

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 here). You will need to disable the gpsd systemd service by running the following commands:

sudo systemctl stop gpsd.socket
sudo 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 here won't work!):

sudo systemctl enable gpsd.socket
sudo systemctl start gpsd.socket

Check if port 2947 is free or blocked:

netstat -tulpn

Now list all ports and find the new one

ls /dev/tty*

or use system to show new devices

dmesg | grep tty

Test if the choosen port gets data

cat /dev/ttyACM0

If you wish to go that route, for whatever reason, before doing anything else, make sure gpsd is not running.

sudo killall gpsd

and remove any sockets gpsd might have left behind,

sudo rm /var/run/gpsd.sock

Change from binary to NMEA:

gpsctl -f -n /dev/ttyUSB0
stty -F /dev/ttyACM0
#set baud rate of GPS
stty -F /dev/ttyACM0 9600

Now test your device

minicom -b 9600 -o -D /dev/ttyACM0

To leave minicom press 'Ctrl-A' then 'X' and ENTER

and test gpsd

gpsd -b -n -N -D4 -s 9600 -S 2948 /dev/ttyACM0 

You can configure your GPS device by editing /etc/default/gpsd:

START_DAEMON="true"
USBAUTO="true"
DEVICES="/dev/ttyACM0"
GPSD_OPTIONS="-b -n -S 2900"
GPSD_SOCKET="/var/run/gpsd.sock"

After that restart the service and watch the results

sudo service gpsd restart
xgps 
cgps -s