Tuesday, March28, 2017 L-36.com

Using Bluetooth GPS with Android

Updated July 13, 2013


My favorite GPS interface app, "Bluetooth GPS Provider", just got better. I love this app because it likes to stay connected, which is very important to me. The downside of that has been that it would drain all system resources if you forget to turn it off. Now you can set a timeout so that it will still aggressively do whatever it needs to to stay connected yet eventually stop once you turn your external GPS puck off. This article has been updated to reflect the new preference settings.

NOTE to Jelly Bean Users (Android 4.1 and 4.2)

"On devices running Android 4.2, developer options are hidden by default, helping to create a better experience for users. You can reveal the developer options at any time by tapping 7 times on Settings > About phone > Build number on any compatible Android device."

Background

Regular readers of L-36.com realize that I am writing an Android Racing app for sailing. In addition, I have consulted on two of the existing sailing apps and one of the stand alone boxes. Most recently I have worked with the author of Bluetooth GPS Provider to get modifications that make that driver ideal for my app. In this article, I will explain why you might want an external GPS receiver, what the various Android drivers do, and why I picked Bluetooth GPS Provider as my preferred app. Finally, I will explain all of the Preferences in Bluetooth GPS Provider, something you will not find anywhere else.

Why Use External GPS

Most all Android Cell Phones have built in GPS as do most of the new tablets. Given that, why would you want to use an external GPS unit?
  • Greater Accuracy I have not found a built in GPS unit that supports differential GPS usually referred to as WAAS in the US. This is not a problem for most applications but if you are trying to return to the starting line, the added accuracy is critical. From my testing, built in GPS units have an accuracy of about 30 feet peak so returning to a starting line might fine you twice that or 60 feet off. At 10 feet a second, that is 6 seconds or in my case about two boat lengths. A differential GPS unit seems to be about twice as accurate so that becomes one boat length. I consider that an acceptable error and certainly one is better than two.
  • Faster acquisition An external unit can be on all the time so that any program that starts won't have to wait for the GPS unit to acquire the satellites. As it takes up to 15 minutes to get the best accuracy, this can be a big deal. It is true that it does not take that long to re-acquire if only a few minutes have gone by, but it is still a factor.
  • Battery Life The external units will run many hours on their batteries. A phone will burn through its battery very quickly if the GPS unit is left on. While you will likely still make it to the end of the race, you might not be able to phone home and brag about your win.
  • Location Stability If you are using a phone and moving around, you are adding and subtracting from the speed reading of the GPS unit. When only moving a few knots, that can make a big difference. If you leave your Bluetooth GPS Receiver in one spot, it no longer matters what you do with your phone.

Which Bluetooth GPS Unit

The heart of any GPS unit it the chipset that is used. The two main ones are MTK v2 and Sirf III. Newer versions are coming out from time to time. There is a Sirf IV unit out but nobody has put one in a Bluetooth unit as far as I can tell. Mostly the differences are involved in the sensitivity of the unit and the ability to work in "urban canyons". I really don't think it makes much of a difference on the water except that having the GPS unit in the cabin means it has to work through the interference of the cabin top.

I bought the unit on the left because I also wanted a unit that would track my course. This unit will store something like 400,000 points and as I track every second that is something like 4 days continuous, more than enough. It has the latest MTK chipset and will do 5Hz, although I use it at 1Hz. There is a cheaper version of the Qstarz unit that will do 10Hz but does not store the tracks.

The unit at the right uses a Sirf III chipset and does not have a tracker. It is one of the more respected of the Sirf units and one I considered buying.

I recommend the Qstarz Q-1000-XT for its high quality, reasonable support software, and tracking feature.

GPS Driver Apps

Why do I need an app to use a Bluetooth GPS receiver? The Android OS will try to use the internal GPS receiver if you just run it. While it is possible for an app to be written to use an external unit, most are not and none of the sailing ones are. They all depend on installing an app that tricks the phone or tablet into thinking the external unit is the one to use. I have tested three such apps.
  • Bluetooth GPS This is a pretty good app. and it has several nice features including a map of the GPS Satellite constellation. The problem I had with it is that I lost Bluetooth lock in the middle of a race start and have found that it is a bit temperamental in acquiring lock. I have had to power cycle both the tablet and GPS unit which will often end in "service discovery failed". This led me to look for another app.
  • Bluetooth Mouse I must say I spent the least amount of time with this app. The problem I had was that I didn't find it better than Bluetooth GPS, and the time reported was not GPS time but rather system time. My app takes advantage of the fact that most all race committees are using GPS time so an app that also uses GPS time does not have to sync with the gun, it is already synch'ed.
  • Bluetooth GPS Provider This app does an excellent job of locking the Bluetooth channel. It is very aggressive in that task and I found it excellent in that regard. It might even be so aggressive to a fault as if the GPS unit is off, this app will consume all the resources of the tablet trying to acquire lock to the point that you cannot watch a YouTube video. Knowing that is all it takes for that to not be a problem as all you have to do it turn the app off or not start it in the first place if you don't need GPS. However, if you do need GPS, there is nothing more important than acquiring lock if it is lost so this turns out to be a great feature. The problem with the app was that it did not use GPS time, but system time. But that was then and now it uses GPS time.

Get Bluetooth GPS Provider

As I said above, Bluetooth GPS Provider did an excellent job of acquiring and re-acquiring Bluetooth lock. That is very important if the GPS unit and the phone are not right against each other. If lock is lost for some reason, it is critical that it come back quickly. This app does that. However, I found in my first race using it that I was 15 seconds off and had to use my Sync button to get on race committee time. The reason was that the time reported by the app was system time and it was off by 15 seconds. I contacted the developer and he graciously fixed this so that the app now reports GPS time. Now it has all the essential functionality needed for using my Bluetooth GPS Receiver and I highly recommend the app. The app is available from the Play Store by searching on Bluetooth GPS. The app you want is the one by mobile-j.de.

Using Bluetooth GPS Provider

The first thing you need to do is to pair your phone or tablet to the Bluetooth GPS Receiver. Turn on your GPS unit and go into your system settings and select Bluetooth. Do a Scan if necessary and select your GPS unit. You might have to enter a Pass code. I used "0000" and I think that will work in most cases.

After installing the app and running it, press Start. You should see a bar graph of the various satellites as well as some text that gives information on the accuracy of your readings.

In this case, the GPS unit has not been on very long. That is reflected in the lack of satellites locked (5) and tracked (7). The H-dilution is a number you probably don't care much about unless you know what it is but less than 1 is good. The altitude of -5.7 will get closer to reality as the unit gets a better lock. Fix Quality is important. In this case the fix quality of 1 means that I have satellite lock but I do not have WAAS lock. That would be a Fix Quality reading of 2 and takes about 15 minutes to get. It is nice that the app shows when WAAS lock is acquired. The final reading is accuracy and that reading is in meters.

Preference Settings

If you click on the settings tab you will see the Preferences tab. Clicking that gives the list of all the settings that can be changed. It should be noted that you do not need to change any of these settings. This app just works and the default settings are just fine. However, it is always nice to know what the settings are and if you do have a special need, to know that they can be changed.
  • Choose GPS receiver: Press this to go to a menu of available Bluetooth devices that are paired with the tablet or phone. You can select your GPS unit from the list but the app seems to find your GPS unit without telling it anything once it is paired in your main settings menu.
  • Force: Force means that the "Network Location Provider" will report the GPS position instead of the triangulated position from cell phone towers and public wifi.. This might be needed by some rare apps. Usually don't check this.
  • Switch Bluetooth: The app will turn the devices Bluetooth function on and off. This might save battery life when the app is off.
  • GPS Connect Method: The four options are the different ways the app can get a bluetooth socket. If "Try All" is choosen the app will try all four options. Often that's fine but some devices have problems with that and need the connection method explicitly set.

    With the "Try All" there are some devices which "loose" bluetooth until the battery is pulled for 30 seconds.

    Unfortunately the quality of the bluetooth implementation varies a lot between devices. Maybe you could just try the different options. The meaning of the options is:
    • "Insecure Reflection": Get the socket by calling Android's "createInsecurfeRfCommSocket"
    • "Insecure": Use createInsecureRfCommSocketToServiceRecord
    • "Secure (Reflection)": Use createRfCommSocket
    • "Secure": createRfCommSocketToServiceRecord
    Which one works depends a lot on your phone (and your GPS device).

    If "Try All" sucessfully gets a connection the connect method will be automatically changed to the one that worked. (So reconnects are faster)

    Ihave tested all 5 settings with my Samsung Tablet connected to my Qstarz puck and they all work. In my case when I check "Try All" the app will switch the setting to "Insecure (Reflection)"
  • Prevent Stale Connections: On some (rare) devices it happens that reading from the bluetooth device blocks forever. So nothing will happen anymore. With this option checked there will be a timeout for all bluetooth related function calls. Some users reported that their device works better (more stable) with this option unchecked.
  • Autostop: When Bluetooth lock is lost, the app will stop. This will prevent the app from re-acquiring. Don't check this.
  • Start on Boot: The app will automatically start whenever the phone or tablet starts up. Be careful about using this as if there is no GPS unit, the app will aggressively try and acquire one and consume all system resources trying. Unless you always use an external GPS unit when using the phone or tablet, it might be better to start the app manually.
  • Warning Sound: Plays a sound when there is a connection problem. You must select your sound file. Select "Media Storage" as the action if your phone or tablet asks then select the warning sound you want.
  • Raw HDOP: Causes the app to report the Horizontal Dilution of Precision instead of the Accuracy when reporting the Accuracy. If you don't know what this is, don't check it.
  • GPS Base Error: Used to calculate the accuracy. See http://edu-observatory.org/gps/gps_accuracy.html for the details. For most users this shouldn't be really necessary.
  • DGPS Base Error: Used to calculate the accuracy. See http://edu-observatory.org/gps/gps_accuracy.html for the details. For most users this shouldn't be really necessary.
  • Reconnect Timeout: (No, 1 minute, 5 minutes, 10 minutes) The amount of time the tries to recreate a lost bluetooth connection. After that time the service stops.
  • Reconnect Aggressivity: (aggressive, medium, friendly): Choose how aggressiv the app is in trying to reconnect. i.e. this changes the wait time between retrying to get a bluetooth connection. (So with "friendly" it shouldn't drain the battery so much and other apps should get enough CPU time to work normally. Aggressive means 0 ms wait time, medium means 15000 ms and friendly means 30000 ms.
  • GPS Type: Select the type of chipset (MTK or Sirf) that is in the Bluetooth GPS device.
  • Switch to NMEA: If Sirf chipset is selected, switch from the sirf protocol to the NMEA protocol. Sirf chips have proprietary binary format or NMEA. The app doesn't work in binary mode so if using sirf it's a good idea to check this if you are using other software which switches to binary mode from time to time.
  • Update Rate: If MTK chipset, allows higher update rates up to 10Hz if the bluetooth device supports higher rates. Although this might seem like a good idea, I have found that the speed and direction readings are much noisier at 5Hz and WAAS does not work at 10Hz. I am using 1Hz and interpolating when needed.
  • DGPS Mode: If MTK chipset, select either WAAS or RTCM formats for the differential data. It is a mystery why anyone would want to change this so leave it alone.
  • SBAS: Enable or disable differential GPS mode. Some users want to disable differential. You should probably leave this enabled.
  • Turn Ads Off: Please read the ads and click the ones that are of interest to you. This helps support the ad and helps motivate the developer to keep this wonderful app up to date. As this is an app that normally runs in the background, the ads are really not a bother. If there is no internet, there are no ads and the app works as if the ads were off.

Ad by Google

Disclaimer:
The information on this web site has not been checked for accuracy. It is for entertainment purposes only and should be independently verified before using for any other reason. There are five sources. 1) Documents and manuals from a variety of sources. These have not been checked for accuracy and in many cases have not even been read by anyone associated with L-36.com. I have no idea of they are useful or accurate, I leave that to the reader. 2) Articles others have written and submitted. If you have questions on these, please contact the author. 3) Articles that represent my personal opinions. These are intended to promote thought and for entertainment. These are not intended to be fact, they are my opinions. 4) Small programs that generate result presented on a web page. Like any computer program, these may and in some cases do have errors. Almost all of these also make simplifying assumptions so they are not totally accurate even if there are no errors. Please verify all results. 5) Weather information is from numerious of sources and is presented automatically. It is not checked for accuracy either by anyone at L-36.com or by the source which is typically the US Government. See the NOAA web site for their disclaimer. Finally, tide and current data on this site is from 2007 and 2008 data bases, which may contain even older data. Changes in harbors due to building or dredging change tides and currents and for that reason many of the locations presented are no longer supported by newer data bases. For example, there is very little tidal current data in newer data bases so current data is likely wrong to some extent. This data is NOT FOR NAVIGATION. See the XTide disclaimer for details. In addition, tide and current are influenced by storms, river flow, and other factors beyond the ability of any predictive program.