Thursday, 4 October 2012

GiSTEQ USB Dongle in Linux

I ordered a GiSTEQ USB dongle (SKU: C5-GR110-01) a while ago and it finally arrived today! I've been in the mood to play with NTP sync etc from a GPS dongle for a while and ordered one with the SkyTraq chipset instead of the commonly found SiRFstar III. This was mainly due to a reported problem resulting in the NMEA offset drifting and being unreliable...

The main aim being to geek out rather than anything serious as these dongles arn't built with timing as a primary purpose (there are more reliable Stratum 1 time servers available on the net for free...)

I of course immediately started playing around with getting the device working in Linux, the device appears as:

Bus 006 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

Status of the GPS:

Green LED continually on: Location not fixed yet, may take a while
Green LED flashing: Location has been fixed

If you cat /dev/ttyUSB0 and see characters than don't make any sense, ie. lines that don't start with $GP your baud rate might be a problem... You can adjust the baud rate in Linux to 38400 with the following command: stty -F /dev/ttyUSB0 38400

The lines you want to be seeing:


The above lines were the main ones I saw coming through, now to make sense of the important (well to me at least) ones... You can find a nice list of all the codes and analysis of each at:


GPGGA - GPS Location Fix Data
Time (UTC/Zulu): 143830.462 => 14:38:30 462 millisecomds
Latitude: 2547.2945
North/South of Latitude: S
Longitude: 02815.8548
East/West of Longitude: E
Fix Quality: 1 (0 - None, 1 - GPS Fix, 2 - DGPS Fix)
Number of Satellites in Use (not View): 05
Horizontal Dilution of Precision: 1.7
Altitude: 1441.4
Altitude Unit: M - meters
Geoidal separation: 17.8 (WGS-84 Earth ellipsoid - Average sea level)
Geoidal separation Unit: M - meters
Age of Differential GPS data (seconds): blank
Differential reference station ID: 0000
Checksum: *74


GPVTG - Track made good and ground speed
True Track degrees: 119.8
Relative to True North: T => True
Magnetic Track degrees: 99.1
Magnetic Track true: M
Speed over ground: 000.0
Speed in units: N => Knots
Speed over ground: 000.0
Speed in units: K => kilometers/hour
Checksum: A*0C

I'll blog about the Gisteq as a time source soon but in the meantime I wrote a quick BASH script to display the results in a loop:

# Gisteq GPS USB Dongle

echo "Setting the baud rate to 38400..."
stty -F /dev/ttyUSB0 38400

while read input; do
 if [ "$line_id" = "GPGGA" ]; then
  value_array=(`echo $input | tr "," "\n"`)
  gps_time=`echo $gps_time | awk '{for(i=1;i<=length($0)-4;i+=2){printf("%s:",substr($0,i,2))}}'|awk '{sub(/:$/,"")};1'`
  echo "UTC Time: $gps_time"
  echo "Latitude: $latitude $latitude_direction"
  echo "Longitude: $longitude $longitude_direction"
  if [ $gps_fix -gt 0 ]; then
  echo "GPS Fix: $gps_fix"
  echo "Satellites in use: $satellites"
  echo "Altitude: $altitude meters"
 elif [ "$line_id" = "GPVTG" ]; then
  value_array=(`echo $input | tr "," "\n"`)
  echo "Speed: $speed kph"
  echo "######################"
done < /dev/ttyUSB0

No comments:

Post a Comment