Sunday 4 August 2019

GPS Logging on the Bluefly with the XA1110

This post is about using onboard logging capability of the XA1110 GPS on the Bluefly. It gets technical, and then I finish by suggesting for most pilots that you probably do not need it.

For many years the Bluefly varios have had the ability to stream a GPS signal to an app like xcsoar or XCTrack on Android (for the Bluetooth model), or to xcsoar on the Kobo (for the TTL_GPS model). Most pilots will use the logging capabilities of those apps to keep a record of their flights or to submit them for competition flying. However, the XA1110 has a small onboard memory and can record its own log. This post tells you how to use it if you feel like experimenting.

What models does this post relate to?

Any model of the bluefly which is connected to the XA1110 GPS. This includes:


The XA1110 GPS uses the MediaTek MT3333 chipset which has the 'Locus' function that the logging is based on. If you have another GPS using this chipset, or perhaps even some other MediaTek chipset, then you might find you can interact with its Locus memory in a similar way.

Why would you want to do this?

Upfront, I would say that in many cases you probably do not want to do mess with the logging capabilities of the XA1110. For most of our flying adventures keeping a GPS track log is nice to have but is not essential. If you keep your android or iphone battery charged then it is probably better to record a log on whatever app you are using.

However, if you want a backup to your backup, then switching on the Locus of your XA1110 might be for you. One day, if the competition director is pleasant, it might be your last resort to prove that you made goal. Although, it is important to note that the IGC that you might produce from GPS Babel is unsigned.

How the XA1110 Locus GPS Log works

The Locus log is pretty simple:
  • If the GPS has a fix, and logging is 'started', then logging will begin.
  • The logging interval can be changed from 1 second to 12 hours (in theory).
  • Each log point stores time, latitude, longitude, and GPS altitude (each point uses 16 bytes).
  • The memory size is 128k, which means it can store 8192 points. At 1s track intervals that is only 2.27 hours, but at 10s intervals it provides almost 24 hours of logging. I think that is reasonable for the kind of use case I am considering in this blog post (a backup to the backup).
  • Once the log reaches the end, the GPS just begins to overwrite points from the start of the log. 
The main drawback of the log is that it is painful to access. You need to send specific commands to the XA1110 to configure, start and restart logging (see the XA1110 Software User Guide for more information). I had hoped that if we start logging that it would continue it after the GPS had rebooted, but I found this only works if VBACKUP is connected and the GPS hot starts. The log needs to be manually started on each cold start.

Firmware update 

In order to simplify the commands, a few days ago I uploaded new firmware (BlueFlyVario_12.M25). This firmware includes one new hardware setting gpsLogInterval (code BGL).

Updating the firmware on the TTL_GPS model is a pain as you will need to remove your Bluefly from the Kobo, connect it to a USB_Serial converter, then updated it using the ds30loader application from a Windows PC. It is much easier for the Bluetooth_USB model. In either case, if you manage to update your firmware then it works like this:
  • If gpsLogInterval is set to 0, then it turns off the log. 
  • In all other cases, the Bluefly sends the following commands to the XA1110 on startup (or when gpsLogInterval is changed):
    • A test command (PMTK000)
    • The command to set the log interval (PMTK187,1,{BGL Value})
    • The command to start logging (PMTK185,0)
    • The command to query the locus (PMTK183)
  • This results in an output from the Bluefly like:
$PMTK001,0,3*30
$PMTK001,187,3*3E
$PMTK001,185,3*3C
$PMTKLOG,16,0,a,31,10,0,0,0,3837,48*20
$PMTK001,183,3*3A

You can decipher this using the XA1110 Software User Guide if you feel you must, but the bottom line is that it shows that logging is happening at 10s intervals. 

BFVDesktop application update

I have also updated the BFVDesktop application. Version 0.61 includes the gpsLogInterval hardware setting. In addition, there are a few PMTK commands in the Hardware Commands drop-down to query the locus (PMTK185,0), erase the log (PMTK184,1), and download the log  (Query Locus Data - PMTK622,0). To download a log use these steps:
  • Make sure you can see GPS sentences. You might need to set uart1BRG to 16 to make sure that data rate of U1 (which the XA1110 is connected to) is set to 115200.
  • Note your outputMode setting, then adjust it to 4 (to disable the bluefly output). You should still see GPS sentences. 
  • Send PMTK622,0 to begin downloading the log. You should see sentences like:
$PMTKLOX,0,1366*6B
1563683257,2019-07-202T04:27:37Z,2,-35.39281,149.20744,681
1563683258,2019-07-202T04:27:38Z,2,-35.392807,149.20744,681
$PMTKLOX,1,0,0100000A,1F000000,01000000,00001F0A,00000000,00000000,00000000,00000000,00000000,00000000,00000000,0000001F,FFFFFFFF,FFFFFFFF,FFFFFFFF,000C8C14,B9E9335D,023D920D,C21B3515,43A9028F,BAE9335D,023C920D,C21B3515,43A9028D*5F
1563683259,2019-07-202T04:27:39Z,2,-35.39281,149.20744,681
1563683260,2019-07-202T04:27:40Z,2,-35.39281,149.20744,681
1563683261,2019-07-202T04:27:41Z,2,-35.39281,149.20744,681
1563683262,2019-07-202T04:27:42Z,2,-35.392803,149.20744,681
1563683263,2019-07-202T04:27:43Z,2,-35.392803,149.20746,681
1563683264,2019-07-202T04:27:44Z,2,-35.392803,149.20746,681
$PMTKLOX,1,1,BBE9335D,023D920D,C21B3515,43A9028D,BCE9335D,023D920D,C21B3515,43A9028A,BDE9335D,023D920D,C21B3515,43A9028B,BEE9335D,023B920D,C21B3515,43A9028E,BFE9335D,023B920D,C21C3515,43A90288,C0E9335D,023B920D,C21C3515,43A902F7*5B
1563683265,2019-07-202T04:27:45Z,2,-35.392807,149.20746,681
1563683266,2019-07-202T04:27:46Z,2,-35.39281,149.20746,681
1563683267,2019-07-202T04:27:47Z,2,-35.39281,149.20746,681
1563683277,2019-07-202T04:27:57Z,2,-35.39282,149.20746,681
  • Note the PMTKLOX sentences are from the XA1110 GPS in the funky 6 x 16 byte format. The other sentences are CSV separated interpretations from the BFV Desktop application.
  • It takes about 1 minute to download the log over a 115200 connection. 
  • You will find two files in your BFVDesktop folder. 
    • locus_record.csv is all valid track points that were decoded from the locus log. You might use this to view the points in excel
    • locus_record.mtk are the complete log PMTKLOX sentences. Use GPSBabel to convert that 'MediaTek Locus' file to any tracklog format you want (like FAI/IGC...). 
    • Note that the points are not ordered by date. You will probably need to do some manual editing to create a log that makes sense. 
    • Also note that the points are not split into flights. Again, some manual editing will be required to work out when your flight started and finished (remember, this is the backup to the backup...)
  • When you are done, set your outputMode back to whatever you started with. 
Notes for a Kobo

I have not tested this on a Kobo yet. However, if you have a TTL_GPS setup on a Kobo (with the updated firmware), and you want to get your locus record, then I would experiment with the following procedure:
  • Create a custom xci file to create some menu options send the appropriate commands to the Bluefly. 
  • Turn on NMEA logging to record the raw output from the Bluefly. 
  • Send the PMTK622,0 command to begin downloading the PMTKLOX. 
  • Copy the NMEA log, and edit it excel to copy all of the PMTKLOX sentences to a new file. 
  • Convert that file using GPS Babel. 
If updating the firmware is beyond you, then you might be able to create some other mechanism to send the appropriate commands to commence logging when xcsoar events occur. 

The bottom line

If you have read this far, then you probably have worked out that the XA1110 Locus thing with the Bluefly is probably to much hard work for not much benefit. I really just did this to prove to myself that I could. If you really want to do it then I suggest you experiment before relying on it as a backup.