Once a very long time ago I bought myself a GPS Bluetooth device that lets you receive NMEA strings over Bluetooth (serial) to any compatible application on your laptop. I intended to build a car based satnav but never got round to it.

Over the weekend I wanted to offline some maps (using GMapCatcher) and mark my location so I could track my location without needing internet connectivity. So the search for the long lost Bluetooth GPS unit started…(and was never found)

Looking at the pile of .NET Gadgeteer kit on my desk I thought why not build one, it is not complicated.

Step 1) The hardware

I clicked together be bare minimum of modules, a GHI mainboard, GPS module and a Bluetooth Module. Note: I did not add the Bluetooth module in the designer as Eduardo has a better driver (codeplex code, example)


Step 2) The software

All I want to achieve is to send NMEA strings to my laptop. The existing .NET Gadgeteer driver lets you get access to these easily using the event:

gps.NMEASentenceReceived += new GPS.NMEASentenceReceivedHandler(gps_NMEASentenceReceived);

Next I had to configure the up the Bluetooth module as a client, and get it ready to accept connections. The one thing that took me a few goes to get right was delay starting the module. Often when I ran Visual Studio in debug the device would work, but then when I ran it without the debugger it would fail. The problem was that the Bluetooth module takes a few seconds to get started (I just started the module in client mode using a delay timer).

void ProgramStarted()

            bluetooth = new Bluetooth(11);
            bluetooth.DebugPrintEnabled = true;
            client = bluetooth.ClientMode;
            bluetooth.DataReceived += new Bluetooth.DataReceivedHandler(bluetooth_DataReceived);
            bluetooth.BluetoothStateChanged += new Bluetooth.BluetoothStateChangedHandler(bluetooth_BluetoothStateChanged);
            bluetooth.DeviceInquired += new Bluetooth.DeviceInquiredHandler(bluetooth_DeviceInquired);
            delayStartTimer.Tick += new GT.Timer.TickEventHandler(delayStartTimer_Tick);
            gps.Enabled = true;          

I make sure that the GPS is running all the time, but I only want to send NMEA strings down the serial when it is connected. I just add/remove the delegate as required.

void bluetooth_BluetoothStateChanged(Bluetooth sender, Bluetooth.BluetoothState btState)
            if (btState == Bluetooth.BluetoothState.Connected)
                    gps.NMEASentenceReceived += new GPS.NMEASentenceReceivedHandler(gps_NMEASentenceReceived);                                   
            else {
                gps.NMEASentenceReceived -= gps_NMEASentenceReceived;               

Step 3)Testing

Firstly make sure that your laptop and Bluetooth device are paired up- check in device manager.


Next install/start GPSd, it will start-up and look around for a COM port, when it finds one it will open it and then close it. (This is because there is no need to the GPS data- yet)


I found the best way to check things are working is to load the Test script supplied with GPSd (Test_gpsd.bat) but I also increased the debug output option from “–D 2” to “-D 3”. Also as I was testing in doors without GPS coverage, this helps to show that all is well, albeit without a satellite fix.

When GPSd requires data it will open the port, and start reading the data and soon you start to see the GPS data coming through. The final step is to then start any application that can use GPSd and bingo – a GPS tracker/logger!

Notes: This took me about half an hour but then the harder parts of the testing took a bit longer.

1) Let the Bluetooth module startup – I left it 5 seconds as I am not in a rush

2)The GPS module antenna requires a ground plane, a 60mm square metal plate works well, but I would prefer a better more scientific way of working this out. I have both a metal plate and a bit of tinfoil and both work. – any tips?

3)Most apps only register with GPSd when they start. So sometimes you need to restart the apps and ensure the GPSd is running.