Connecting the Adafruit Ulitmate GPS to a Raspberry Pi
I have connected the Adafruit Ultimate GPS to the Raspberry Pi using the Serial Python module. My C code GPS software works as well.
I am using the first version of the Raspberry Pi for this.
Coming from a FreeBSD world, it took me a while to figure out the device names for the various Linux serial port names, namely:
- /dev/ttyAMA0 ; Raspberry Pi built in serial port (used by the Adafruit GPS)
- /dev/ttyUSB0 ; the first USB to Serial port adaptor that has been plugged into a USB port (used by my VP-200 GPS unit)
It didn't help that I first tried using the first version RPi motherboard and it had issues with USB power supply running my USB2Serial port adaptor. So it took a while to work out what was going wrong.
At the moment, I am using the Adafruit Pi Header adaptor to extend the GIOP pins out onto the breadboard. The GPS serial and power pins just connect to the appropriate GIOP pins:
GPS | RPi GIOP |
VIN | 5V |
GND | GND |
RX | TX |
TX | RX |
I installed serial-python: sudo apt-get install python-serial and gpsd onto the RPi: sudo apt-get install gpsd gpsd-clients Then I could start it via: sudo gpsd /dev/ttyAMA0 -F /var/run/gpsd.sock and then run a CLI data viewer:
pi@raspberrypi:~$ cgps -s
+-------------------------------------------++---------------------------------+
| Time: 2012-10-17T10:50:56.000Z ||PRN: Elev: Azim: SNR: Used: |
| Latitude: 33.736086 S || 9 71 190 29 Y |
| Longitude: 115.212406 E || 12 44 253 46 Y |
| Altitude: 60.8 m || 15 41 333 00 Y |
| Speed: 1.9 kph || 17 26 137 00 Y |
| Heading: 240.9 deg (true) || 4 24 080 00 N |
| Climb: -12.0 m/min || 40 23 293 23 N |
| Status: 3D FIX (42 secs) || 26 19 007 00 N |
| Longitude Err: +/- 21 m || 2 18 033 16 N |
| Latitude Err: +/- 18 m || 25 12 272 32 N |
| Altitude Err: +/- 22 m || 14 04 214 29 N |
| Course Err: n/a || 193 00 000 00 N |
| Speed Err: +/- 155 kph || |
| Time offset: 0.383 || |
| Grid Square: OB36qf || |
+-------------------------------------------++---------------------------------+
And from GPSd, here is xgps viewing some satellites from my West facing window. You can clearly see my problem.
I have had problems with gpsd reliability, in that it might run for an hour or so then just stop. My Python program: get-gps.py, apart from a few rare data exception bugs left in my program, has run continuously for over 24 hours. You can read more about my escapades with logging West facing GPS data here and a bit more here.