01-06-2018, 08:00 PM
[img]<a href=[/img]
" />
1. connect gps device to USB of TB.
2. check from /etc the name such as ttyUSB0 etc
3. open a terminal and :
sudo pkill gpsd
4. Since this particular device works at 4800 baud rate, do necessary settings:
stty 4800 > /dev/ttyUSB0
5. Then do manual forcing of data
sudo gpsd -b /dev/ttyUSB0
6. check output using
cat /dev/ttyUSB0
this will throw GPS data continuously like ----
$GPGSA,.................................
$GPRMC,.............................
$GPGGA,..............................
7. You can also use following python code to get a single line output.
output will be as:
$GPGGA,XXXXX,YYYYYYY,N,ZZZZZZZZ,E,A,B,C,D,M,-E,M,,0000*7A
" />1. connect gps device to USB of TB.
2. check from /etc the name such as ttyUSB0 etc
3. open a terminal and :
sudo pkill gpsd
4. Since this particular device works at 4800 baud rate, do necessary settings:
stty 4800 > /dev/ttyUSB0
5. Then do manual forcing of data
sudo gpsd -b /dev/ttyUSB0
6. check output using
cat /dev/ttyUSB0
this will throw GPS data continuously like ----
$GPGSA,.................................
$GPRMC,.............................
$GPGGA,..............................
7. You can also use following python code to get a single line output.
output will be as:
$GPGGA,XXXXX,YYYYYYY,N,ZZZZZZZZ,E,A,B,C,D,M,-E,M,,0000*7A
Code:
# coding: utf-8
import serial
ser = serial.Serial('/dev/ttyUSB0', 4800, timeout =5)
while 1:
line = ser.readline()
splitline = line.split(',')
if splitline[0] == '$GPGGA':
latitude = line[2]
latDirec = line[3]
longitude = line[4]
longDirec = line[5]
print line
break