I covered installing both bluetooth and bluez - the Linux bluetooth stack - in the earlier article, so this is a good place to start if these have not been installed.

Since by this point the bluetooth stack should be installed, we simply need to pair the device with our Pi as as we did with our keyboard, however, GPS devices are quite different from the HID keyboard that we paired earlier. So first things first, lets make sure we can view the see the device:

The majority of bluetooth GPS devices use the RFCOMM Layer to transmit simple streams of position data to any connected device. As such, we must bind our device to the RFCOMM layer within the bluetooth stack. But before we do that, we need to configure the RFCOMM device by editing the file '/etc/bluetooth/rfcomm.conf' as follows:

Testing the GPS device

Since we have bound the device to '/dev/rfcomm0', which is essentially a serial device, the simpliest method for testing what we've done so far is to 'cat' the device as we would a standard serial device, such as '/dev/ttyS0'. Providing this is has been sucessful we should see NMEA sentences streaming up the screen:

Processing the NMEA sentences

The NMEA sentances above are part of the NMEA_0183 data specification for the communication of marine electronic devices. The specification incorporates the data specification for a number of other such marine devices, including sonars, echo sounders, gyrocompasses and GPS devices, to name a few. As such, there is plenty of documentation that explains the protocol in great detail if one wanted to manually decode the sentences. However, we don't need to do that, we are using Linux!

gpsd is a GPS service daemon that connects to a GPS device attached to the host computer via USB or serial port. Once a GPS device is attached to gpsd, we can then attach gpsd-aware clients to the daemon, which will then recieve ...

Since bluetooth's rfcomm layer is a serial protocol we can connect directly to this

So lets get started... firstly we must install gpsd, this is available in the Raspbian repos. Since we will want to test our installation a client would be hand to ... so we can install with: # apt-get install gpsd # dpkg-reconfigure -plow gpsd