No GPS? No problem! Using GPSDirect to develop location-aware apps (Part 3)

By John P Mechalas, Published: 12/17/2012, Last Updated: 12/17/2012

This is a three-part series on adding a GPS to your non-GPS-enabled system using GPSDirect from TurboIRC.COM Software & Research.

Part 1. Introducing GPSDirect

Part 2. Using an external, handheld GPS.

Part 3. Using an Android* smartphone as a GPS receiver

Part 3. Using an Android* smartphone as a GPS receiver

In the final installment of this series we'll hook up an Android smart phone to GPSDirect via Bluetooth and use the phone as an external GPS. Bluetooth will provide the wireless link and the virtual COM port, the phone will provide the GPS receiver, and software on the phone will provide the NMEA data stream that feeds GPSDirect.

At this point you are probably thinking to yourself, "That's a lot of glue," and you are right. This solution, while it works, is really a solution of last resort. If you have a working GPS mouse or receiver and you have an easy way to hook that up to your ultrabook or tablet, then you should do that. You only resort to something crazy like using your phone as a GPS when you have no other options. It's not that it's difficult, it's just that it involves a lot of glue, and glue can be frustrating.

I spent my first eighteen years at Intel working as a UNIX systems administrator and systems adminisrtation, especially on UNIX, is all about glue: making this software package talk to that one, or getting data out of a component that wasn't designed to give you data, or writing scripts to automate things that aren't designed for keyboardless operation. Making a device or software system do something it wasn't really designed to do is a narrow, rickety bridge spanning a deep chasm filled with rocks that are teeming with air-breathing sharks. If just one piece breaks the whole thing comes crashing down and you fall to your doom wondering what went wrong. My roots are in systems administration so I live for stuff like this, but it's not for everyone.

But that's enough stalling. Let's get down to business.

What you need

Before you get started you need to make sure that you have the following:

  1. An Android-based smart phone with a GPS receiver in it
  2. Bluetooth support in your ultrabook or tablet

The version of Android doesn't matter so long as the app you install (see below) supports your build. I've used both Gingerbread and ICS with success.

Installing the GPS-over-Bluetooth software on your phone

To make your phone work as a dedicated GPS unit we have to make it behave like one and that means coaxing it into sending NMEA output over a serial port. Since mobile phones don't come with serial ports, or dedicated NMEA output, that means running software that can talk to the GPS and redirect its NMEA sentances to a virtual serial port over a Bluetooth connection. I have tried several apps for this purpose and my preferred one is Bluetooth GPS Output by Meowsbox because it is simple and reliable, two very important qualities when you are chaining multiple components together as we are doing here. The trial version will operate for 10 minutes at a time, and the paid version is only $1.49 as of December, 2012.

Pairing your computer and phone

If you have already paired your phone with your computer, I recommend that you delete that pairing and create a new one while Bluetooth GPS Output is running. One of the advantages to doing this is that your computer will automatically find and create the virtual COM ports as part of the pairing process. If you don't want to delete your existing pairing, then you'll need to create the outgoing virtual COM port manually.

These instructions assume you are already familiar with pairing Bluetooth devices.

1. Launch Bluetooth GPS Output from your phone.

2. Make your phone discoverable via the application menu (see the image at right). This is a convenient shortcut.

3. On your computer, search for Bluetooth devices and locate your phone in the list of available devices and initiate the pairing.

Identifying the outgoing COM port

Once the pairing is complete, you need to determine which of the virtual COM ports on your computer is the outgoing port and which is the incoming one. The pairing process will create one of each. The terminology here is a little confusing: an outgoing port is a port where the current device, in this case your computer, initiates the connection and has nothing to do with the direction in which data flows (serial ports are bi-directional, anyway). Unfortunately, device manager is of no help in this regard:

To identify the port, you'll need to go to your bluetooth settings and examine the COM ports there.

Here we can see my outgoing port is on COM3. This is the port that we connect to in GPSDirect.


Running Bluetooth GPS Output

If the app is not still running on your phone, start it back up. You will get a screen similar to the below, displaying how many satellites are being tracked, which ones are available (based on the almanac data), and the signal strength from each.

You are now ready to connect with GPSDirect. Note that you may have to go in to the app's "advanced settings" menu and change the output type to "emulated only":

I have had trouble with the automatic setting working on some phones.

Here we can see GPSDirect grabbing position data from the phone:

And here's the location on the map in both the phone and Windows 8:

Bluetooth GPS Output will continue to run unless you explicitly exit it by hitting the "back" hard button from within the program. You can use the "home" button to switch to another app and keep it running in the background. If at some point you want to exit, just switch back to the app and hit the "back" button.


And there you have it: two methods of adding GPS hardware to your development system, and enabling it in the Location API, that you can do today with GPSDirect. Depending on what hardwware you have lying around, you might even be able to do this for little or no cost, which is even better. This ability to attach an external GPS receiver, GPS mouse, or even your phone and use it as a location source for Windows is invaluable for those developing location-aware applications.


<-- Back  



Product and Performance Information


Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804