Debugging GPS

So you can find your way to the black stump and beyond.

Debug GPS Issues

The image as it stands is set up for use with the Adafruit Ultimate GPS hat out of the box. With the GPS hat taking the device assignment /dev/serial0.

I also have a Ubox Glonass / GPS USB stick that likes to take the assignment /dev/ttyACA0. So if you are not using the Adafruit Ultimate GPS Hat you will need to modify the GPSD configuration to match your particular device.

If you do not know what device assignment your GPS device is taking. First step is to look at the output from the lsusb command and check that the device is visible to the OS. If it is take a look output of the dmesg command and you should be able to see when the OS initialises the device and the device assignment it has been given.

From the screenshot above we can see the device is available at /dev/ttyACM0.

Changing the GPSD device

On the image the automatic starting of the default GPSD service has been disabled. With service being started from the script /root/scripts/car-network.sh. Open with the vi or nano text edition and near the bottom you will a see a line that looks similar to:

/usr/sbin/gpsd /dev/serial0 -F /var/run/gpsd.sock

Update the device assignment to match your GPS device. Save the change and reboot the Nomadic Pi for the changes to take effect.

Test The Device

If you're confident the GPSD daemon is looking at the right device. You will want to confirm everything is working.

This can be done with either of two commands on the system. The first is gpsmon it will show you some details about the amount of satellites it is receiving data from.

In the screenshot above we can see the device is unable to see any satellites so we don't have a GPS fix.

Below the table up we should see lines of data appearing. this is NMEA information coming from the device. This tells you that even though you don't have a fix things are working.

The second command you can use is cgps. It is almost identical in operation to gpsmon although I find the layout a little cleaner.

Above we can see the device has only recently got a fix (152 seconds). It is able to receive data from 9 satellites in total and is using the data from 3 to determine the location.

Below you should be able to see live data from the GPSD service. As before GPS fix or not this normally means everything is working as intended.

No GPS Fix?

If you have done the steps above you see GPS data flowing from the device. But you are yet to get a GPS fix, no need to panic.

If the device is new the time required to get a fix for the first time can be lengthy ( up to an hour ). Upon receiving a satellite signal the device needs to download an almanac. This contains information of the location of other satellites.

After the device gets its first fix. The time taken to get a fix in the future should be fairly short.

If you are still not getting a fix ensure the device has a clear view of the sky. Sounds simple but GPS will not work inside a building. Outside satellite signals may also be obstructed by tall buildings and mountains.

TIME TO HIT THE ROAD ?

Download the image file, write it to an SD card and get started building the perfect entertainment system for your vehicle.

Download Now!