Having now resolved (hopefully) the hardware issues with the GPS and display mounted simultaneously it was time to check out the GPS reception and ensure that I was seeing good NMEA data on the serial interface.
My problem is that the area where I do most of the experimentation has no close area where GPS signals would be available, and the Pi display currently is shown on a large 27" display I can't relocate.
The solution of course is to use the Pi LCD display as there are Python libraries to write to this. But I need to display something meaningful on the LCD - I picked the number of satellites available as the data for this - it doesn't mean you have a fix, but it does indicate if your GPS receiver is able to receive the sat's signal.
# Simple routine to read GPS data from the serial stream and search for # the number of sats in view in the GPGSV sentence. import sys, math, time import microstacknode.gps.l80gps import pifacecad gps=microstacknode.gps.l80gps.L80GPS() cad=pifacecad.PiFaceCAD() cad.lcd.backlight_on() cad.lcd.cursor_off() cad.lcd.blink_off() cad.lcd.write("Starting...") a=1 while a: with open("/dev/ttyAMA0") as gpsData: for line in gpsData: sentence = line.split(',') print(sentence[0][:6],".") if (sentence[0][:6] == '$GPGSV'): cad.lcd.clear() cad.lcd.write("Sats= " + sentence[3])
Therefore I wrote a small program that read from the GPS library and displayed the output. Unfortunately these libraries raise exceptions when a GPS fix is not available. (To me this is not a good thing, these libraries should be a little more defensive. For instance if you ask for the GSV data (GPS Satellites in View) with no fix the library effectively gets an array out of bounds exception as the GSV sentence returns less data points when there is no fix.)
The next best thing was to read the NMEA serial port (/dev/ttyAMA0) directly as a file. A few versions later I had something that would start-up, read the NMEA stream, look for a $GPGSV sentence header, decode it and report the number of visible satellites on the Pi LCD display. Running this via a battery box USB supply allowed me to take the entire assemblage outside and check that yes, indeed I was seeing one, 2, 3, ... up to 10 satellites using the high gain antenna.
Therefore I was happy I can accept input from the GPS and will probably go back to using the gps client libraries but I will have to trap exceptions when a fix isn't available. However the libraries do do a lot of the heavy lifting with respect to data element decoding. This is what others have done in their code and this exercise helped me to understand why that was needed.
The other interesting thing was that after some time I found my 4xAA battery box could no longer support the PI, to the extent it would refuse to boot. This was only after ~1.5 hours of use, so I am curious now as to the power consumption of the Pi, GPS & LCD configuration. At some point I'll put my meter on this to measure it.
Next step is to store the GPS data in a file and make this process auto-running in the linux environment. Then I can move the LCD display code to a client process that interrogates the data file.