Homepage Wiki Forum Buy

GPS

From GNUBLIN

severity (level) requirement Gnublin family
Gnublin logo advanced.png Kernel compile, Toolchain All

Contents

Gnublin and GPS

You can use a GPS Receiver on the Gnublin-board and log your location data. The logged data can be viewed afterwards with a map-program like Google Earth or Merkaator or you can view the logged data directly in a webbrowser.

150px‎

We used the GlobalTop Gms-d1 GPS receiver (MediaTek MT3329) from the embedded-projects shop.

http://shop.embedded-projects.net/index.php?module=artikel&action=artikel&id=552

This receiver got a builtin USB to Serial converter, so you can just load the right module and can go on exploring the World of GPS.


Preparation and connection

Solder

First you must solder the Pins D+, D-, VCC, and GND with the same wires of an USB cable. The advantage is, that the USB connection is at once the power supply for the GPS receiver

Pin assignment USB:

Number Wirecolor Purpose
1 Red VCC(5V)
2 White - Data
3 Green + Data
4 Black GND

Identify the drivers

To identify the drivers you shoul connect the GPS Receiver to a PC/Laptop running Linux and then type dmesg after you plugged the receiver in:

[49804.367201] cdc_acm 2-1.2:1.1: ttyACM0: USB ACM device [49804.367867] usbcore: registered new interface driver cdc_acm [49804.367870] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

If the module is not included in your kernel on the SD-card you have to compile it manually. For this GPS receiver you should search for the module cdc_acm.

Loading the module

To load the module on the Gnublin-board you can use the following command:

modprobe cdc_acm

This is how the output looks like.

root@gnublin:~# modprobe cdc_acm usbcore: registered new interface driver cdc_acm cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters

Plugin the receiver

root@gnublin:~# usb 1-1: new full speed USB device using lpc-ehci and address 2 usb 1-1: New USB device found, idVendor=0e8d, idProduct=3329 usb 1-1: New USB device strings: Mfr=3, Product=4, SerialNumber=0 usb 1-1: Product: GPS Receiver usb 1-1: Manufacturer: MTK cdc_acm 1-1:1.1: ttyACM0: USB ACM device

In the last line you can see that the driver module is creating a new special device file named ttyACM0 if you got udev on your board.

Readout and logging

Creating device file and logging

If you got a Gnublin-board without udev, you have to create the special device file ttyACM0 manually, to make the communication work with the receiver .

mknod /dev/ttyACM0 c 166 0

After this step you can readout the device with a simple cat command. Some example output:

root@gnublin:~# cat /dev/ttyACM0 GPRMC,............. $GPVTG............ $GPGSA,........... $GPRMC,............ $GPVTG,............ $GPGGA,............ $GPGSA,...........

(Of course there are not only dots in the output,but rather your coordinates in form of a code)

You can use two small programs to convert these raw data to a *.gpx file. You can visualize this file on a webpage or on some map programs like Google Earth and Merkaartor.

Installing GPSD

GPSD is a GPS-daemon which gets the data from the GPS receiver and make the data available to other programs. You will need the following debian-packages:

gpsd (not compatible with the package fso-gpsd!) gpsd-clients(contains the helpful gpxlogger and other small programs) libgps19

You can get all of the packages at http://packages.debian.org After you have installed the packages (for instructions how to install look at this article you can test the functionality of GPSD with the following command:

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

This command starts the GPSD not as usual as a daemon, so you can see much data outpot on the shell.

Logging GPS daata with gpxlogger

To log your GPS data you can use the program gpxlogger which is included in the package gpsd-clients

First you have to start gpsd with the right device, for example gpsd /dev/ttyACM0. After this you can start the gpxlogger with the following command.

gpxlogger -i 5 localhost:2947 > LOG.gpx


Please Note You must exit the program gpxlogger with the command CTRL+C or by sending a SIGINIT-signal (Value 2) with the command kill to save the file LOG.gpx !!

kill -2 gpxlogger-Process-ID

Visualize the logged data

You can view the logged GPX-file on a PC/Laptop either with a map-program like Google Earth/Merkaartor/GPX-Viewer or on a webpage with a webbrowser:

http://www.maplorer.com/view_gpx_3D.html

You can get Merkaartor with the apt-get command. To install Google Earth you need the '.deb file from their homepage. GPX-Viewer must be compiled out of the sources. The methode with the webpage is the most comfortable way to view the logged GPS data. To view the logged data on the webpage you only have to click on the browse button and select the *.gpx file. After this you can additional select the methode you traveled (car,boat,etc..)

Error handling

To avoid some errors, you should delete the socketfile (/var/run/gpsd.sock) before you start GPSD the first time.

In other languages