Saturday, 20 August 2022

Kobo Nia Install

This post outlines how to install the BlueFlyVario_USB_TTL_GPS_IGC_v22 on the Kobo Nia. This combination of the best TTL_GPS Bluefly and the cheapest current model Kobo will give you a fully featured xcsoar based flight instrument. 

Make sure you read to the end of the post before you begin. The Nia makes a good flight instrument, but there are some limitations.

There are many other models of Kobo and many ways to install a Bluefly. See BlueFlyVario_TTL_GPS_v11 Assembly with the Kobo Glo for an example and links to many other blog posts for other models. Also, see Nev’s page for much more information: http://gethighstayhigh.co.uk/kobo-self-build/.

Preparation

Order your Bluefly from the shop. This assembly shows the USB_TTL_GPS_IGC model, but you could also use the cheaper TTL_GPS model. The main advantage of the more expensive model is onboard IGC recording and easier Bluefly firmware upgrades. 

Get a Kobo Nia from your local retailer or the internet. 

Download a few things:

  • xcsoar. The latest releases are not compatible with the Nia and at the time of writing this post you need to use a 6.8 version. I used 6.8.17
  • The 3d printable files for the new v22 TTL_GPS case, lid and button. 
    • This is optional, but does make the install a bit neater. 
    • I printed these items in PLA on an old 3d printer and there was a little clean up with a knife required to make them fit, especially around the button. 
  • Get this Bluefly.xci file for the xcsoar menu
Make sure you have the latest firmware update for the Bluefly. See here

Prepare the Nia

Before anything, make sure you Nia is working normally as an ebook. Create a Kobo account, do the suggested firmware updates, then shut it down.

Take the back cover off the Nia. You should be able to pry it loose around the edge. It will look like this:


Backup the sdcard by creating a full disk image with of it with win32diskimager. See step 3 here.

Install xcsoar: replace the sdcard, start the kobo, connect a USB cable, in the kobo app press connect to show the drive on your computer, then copy KoboRoot.tgz as described in the Kobo xcsoar installation instructions

Install the Bluefly 

I like to remove the couple of screws near the edge of the boar and pry up the PCB to keep it clear of the underlying metal when soldering. 


Wires are soldered onto the TTL port. In this example I have used solid core 30AWG winding wire. Use a hot soldering iron but work quickly so you don't damage the PCB. Check carefully for jumped solder tracks. Note the small 3mm hole drilled through the bezel of the kobo that all of the wires go through. I could have made this smaller. 


Solder each of the wires to the Bluefly. Make sure that the connections are:
  • Kobo GND - Bluefly GND
  • Kobo RX - Bluefly Tx
  • Kobo TX - Bluefly Rx
  • Kobo V - Bluefly V
Put the neoprene on the pressure sensor of the Bluefly (black squishy side on the sensor - do not remove the sticky part or you will block the holes). Use the heatshrink to hold it in place (shrink with a hairdryer or hot air gun). 


The case is placed so it hangs over the edge of the kobo bezel (so the GPS antenna works). In this install I used quality black double sided tape to secure the case to the bezel. The final result is shown below. 


Configure XCSoar

In the devices menu of xcsoar  (Menu|Config|Devices) edit device A with the following settings:
  • Port: ttymxc0
  • Baud rate: 115200
  • Driver: Bluefly
Click Monitor to see the data flowing in from the Bluefly. It will take a few minutes of the vario sitting outside with a clear view of the sky and no interference to get a GPS fix. 

Quit xcsoar and at the boot menu press Nickel to boot to the Kobo erReader mode. Connect your the kobo to a computer and upload the Bluefly.xci file you downloaded earlier to the xcsoar directory. Disconnect the cable and reboot back to xcsoar. 

Back in xcsoar add the xci file to create the Bluefly menu (Menu|Config|System|Look|Language,Input|Events) (you will need to be using Expert mode). You will need to quit and restart xcsoar for it to take effect. 
  • The xci file adds a bunch of menu options which send commands and settings to the Bluefly. 
  • It also adds a special gce event which restarts the Bluefly when the xcsoar detects a landing. This forces the IGC file on the Bluefly to be saved. 
Now, Menu|Bluefly|Simulate Button to check it is working. This is the same as short pressing on the button of the Bluefly to toggle the sound on and off. 

Next, Menu|Bluefly|Bluefly Config then set outputMode to LX at 5Hz. 

Finally, Menu|Bluefly|Devices|Edit and change the driver to LXNAV. 

The reason for the last two steps is to send $LXWP0 messages from the Bluefly for alt and vario information (instead of the default Bluefly PRS output mode). It reduces the loads on the processor (I think). Also these sentences have a checksum so if the there is a transmission error you will not get funky altitude/vario information. 

Limitations of the Nia

I really like the screen on the Nia. If you do the installation as described in this post then it will work for you, but there are some technical limitations that you should be aware of if you decide to do things a little differently:
  • There is not a specific version of xcsoar that has been built for the Nia. xcsoar kobo versions try to work out what model of kobo it is running on during startup then selects particular linux drivers and a bunch of other kobo linux things. The 6.8 versions work, and I expect that a future 7.x version will work, but at the moment suggested fixes have not been included in a release. 
  • The underlying kobo linux operating system uses the ttl serial port we connect the Bluefly to during the device boot process. If it reads characters from the Bluefly at a critical point in the first few seconds then the boot will hang (this is why there is is nothing sent from the Bluefly until after startDelayMS). Additionally, there are around 2500 characters sent from the kobo to the Bluefly in the first 10 seconds. The most recent firmware on the Bluefly addresses both of these issues. 
  • The kobo linux serial processing driver only has so much capacity and it is possible that from time to time there will be buffer overflows on the kobo side. Practically, this results in characters not being received by xcsoar. By using sentences with a checksum bad sentences are just ignored and we can recover gracefully. 
Further Steps

While the Kobo is on, connect the Bluefly to the BFVDesktop application via USB-C cable. You should be able to see the data and configure many more settings on the Bluefly than are able to be set up from the xci file. The default startDelayMS is 2000, but for most users I recommend increasing this to 10000 to more fully avoid the start up process. You can also download igc files from the Bluefly using the BFVDesktop application or GPSDump. 

In addition, you should be able to download xcsoar's igc files from the Kobo eReader application when the kobo is connected to a computer.

There is a lot more information on configuring XCSoar on the web, and Nev's page has great tips