pyserial for GPS data

Arun p das arunpdasuit at
Thu Mar 15 09:19:26 CET 2012

I have a USB GPS dongle using this for getting  position information. I
installed gpsd daemon so that any clients can read data from that. It is
working fine
used xgps, cgps as clients.

*gpsd -n -N -D2 /dev/ttyUSB0 *

import gps, os, time
g = gps.gps(mode=gps.WATCH_NEWSTYLE)
while 1:
#if gps.PACKET_SET:
print 'latitude ' , g.fix.latitude
print 'longitude ' , g.fix.longitude
print 'time utc ' , g.utc,' + ', g.fix.time

Used the following program to read gps data but it is not giving accurate
readings as cgps,xgps clients. I tried to read directly from the serial
port using the following program but its giving non printable characters as
output as it should return something like


*import serial*
*ser = serial.Serial( port='/dev/ttyUSB0', baudrate=4800,timeout=1) *
*while True:*
* print line,*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list