How to connect an usb GPS receiver with a Linux computer?

Posted by jack wu on

I created this step by step instructions on Ubuntu. Possibly there might be a slight difference if you are using another Linux distribution, but they should be very similar. 

1. Plug in the GPS receiver

After plugging in a GPS / GNSS receiver through the USB port, your GPS should be automatically configured. To verify, type the below command.

ls /dev/tty* 

You will see the “/dev/ttyACM0” has been created automatically. To further verify if the GPS has been bound to this folder. please type 

sudo cat /dev/ttyACM0

The GPS input stream shows similar to the below

If you can see the above, which means your GPS receiver works with your Linux computer. 

 

2. Install gpsd

The next step of installation is to bind the “gpsd” daemon to the GPS receiver so that the applications running on Linux can access the GPS receiver through the “gpsd” daemon. 

The purpose of “gpsd”.

“gpsd” is used to connect applications with the GPS receiver hardware. It manages USB GPS devices so the applications don't have to. In Linux, if you set up the “gpsd” properly with GPS receivers hardware, most GPS location aware applications can get the GPS data by calling “gpsd”. Furthermore, “gpsd” shares the GPS receiver to all applications running on this Linux machine.

 

To install "gpsd", type

sudo apt install gpsd

The computer responded with something like the below screenshot.

3.Test gpsd with xgps (optional)

If you are confident the GPS is already working properly, just skip this section and go to section 4.

To start the gpsd in interactive mode, type the below command.

sudo gpsd -D 5 -N -n /dev/ttyACM0

It shows.

Now the GPS signal should be available for applications. It is not mandatory but good to confirm that. It can be tried by a tool called  “xgps”. xgps is included in the gpsd-clients package. 

 

To Install gpsd-clients, open another terminal session & type

sudo apt install gpsd-clients

 

Above screenshot shows the "gpsd-clients" has been successfully installed. Now type

xgps

xgps should look similar to this when the GPS signal is available.

 

 

 

 

4. Make gpsd available on boot.

To make gpsd automatic startup on boot, update the /etc/default/gpsd file a below

 

 

Please make sure 

GPSD_OPTIONS="/dev/ttyACM0"

is included in the "gpsd" config file above. Restart your computer.

 

5. Ready to serve.

Now your GPS applications can make use of "gpsd" to acquire GPS data. For example, below shows  the “Marble” application running on Linux which gets GPS data from "gpsd".

 

 

We have tested the below USB GPS/GNSS receivers

work with this instruction. They can be purchased from gpswebshop.com

Share this post



Newer Post →