Tag Archives: GPS

GPS Position accuracy and how to tell if you have a good fix?

One of the main contributing factors to GPS position accuracy is the geometric configuration (the position in the sky) of the satellites used to obtain a position.
The best position fix is given when a satellite is directly overhead and another three are equally spaced around the horizon.

This aspect is called the 'geometry' of the system and is measured as DOP (Dilution of Precision).

The influence of satellite geometry on imprecision is demonstrated in the image below. When both satellites are widely separated (figure left) the position error (area in red) is smaller. If the satellites are close to one another (right figure), then the area of error is more spread out. This is valid when the uncertainty for determining the position,
known as the Range Error (R-E: yellow and blue areas), is the same for both satellites. R (R1 and R2) refers to the
measured distance of the satellites to the user (pseudorange).

HDOP overlap
Satellite precision error

 

There are a number of different DOP elements which can be used, we will focus on HDOP (Horizontal-DOP).

The HDOP can be seen when using gpsmon. The image below has HDOP highlighted;gpsmon HDOP

The HDOP can also be found in the GSA sentence.  Below it is shown as 1.3;

$GPGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39

A HDOP value of 1 or below would give you an accuracy of about 2.5M.

When in mountainous areas, forests and urban canyons, you can experience high HDOP values as  some of the available satellites will be obstructed. The satellites used will be closer together creating a large area of error as the signal from each satellite have a larger intersect.

Low accuracy in a city
Low accuracy in a city

Out on the open see, you should be able to see a low HDOP value as the satellites used would be spread out and has less area of a intersect.

HDOP
Good accuracy

How to save GPS data to a file using Python

Below is an example python script which will save GPS data (time, Lon, Lat, speed and sats in view) to a file.

The gpsd client libraries  will be used to get the data from GPSD. We will be using the TPV class to get time, latitude, longitude and speed.

We can get the number of satellites in view by getting the length of the satellites object.

This page shows how to get gpsd up an running on a Raspberry Pi

Every time the script is run, it will create a new file beginning with the current date and time.

In this example, I am writing in a csv format, where each GPS attribute is separated by a comma.

#! /usr/bin/python
from gps import *
import time, inspect


f = open(time.strftime("%Y%m%d-%H%M%S")+'_GSPData.csv','w')

gpsd = gps(mode=WATCH_ENABLE|WATCH_NEWSTYLE)

print 'GPStime utc\t\t\tlatitude\tlongitude\tspeed\tsats in view' # '\t' = TAB to try and output the data in columns.

f.write("GPStime utc,latitude,longitude,speed,sats in view\n")

try:

    while True:
        report = gpsd.next() #
        if report['class'] == 'TPV':
            GPStime =  str(getattr(report,'time',''))
            lat = str(getattr(report,'lat',0.0))
            lon = str(getattr(report,'lon',0.0))
            speed =  str(getattr(report,'speed','nan'))
            sats = str(len(gpsd.satellites))

            print  GPStime,"\t",
            print  lat,"\t",
            print  lon,"\t",
            print  speed,"\t",
            print  sats,"\t"

            f.write(GPStime + ',' + lat +',' + lon + ',' + speed + ',' + sats + '\n')

            time.sleep(1)

except (KeyboardInterrupt, SystemExit): #when you press ctrl+c
    print "Done.\nExiting."
    f.close()

New Products : BerryGPS and BerryGPS-IMU

We have released two new products:

BerryGPS - GPS for the Raspberry Pi

BerryGPS-IMU - GPS and IMU for the Raspberry Pi

Both GPS modules use the  M10478-A2 from Antenova, which is a high quality GPS module which is able to track 22 satellites and has an internal antenna. This means no external antenna is needed if the module has clear access to sky.  Both feature a SuperCap to store ephemeris data for up to four hours. This and many more features are included.

Raspberry Pi GPS
BerryGPS

 

 

 

Both have been specifically designed for the Raspberry Pi Zero, however they will work with any version of Raspberry Pi.

 

The BerryGPS-IMU also includes all the components found on the BerryIMU.  And is compatible with the existing code in our repository. The BerryGPS-IMU present a lot of sensors in a very, very small package.

 

 

Raspberry Pi GPS
BerryGPS-IMU

 

 

 

Raspberry Pi GPS
BerryGPS-IMU on a Raspberry Pi Zero

 

BerryGPS-IMU
BerryGPS-IMU on Raspberry Pi 2

berrygps-skull