Friday, 12 December 2014

Firmware

From version 10 the BlueFlyVario models include a bootloader so you can upgrade the firmware. The firmware is the chunk of code on the microprocessor which makes the Bluefly wield its magic. Current firmware versions use about 60% of the code space on the microprocessor, so there is some flexibility to add a few features within the limits of the hardware. Normally you need a special microcontroller programmer to update the firmware, however with the bootloader you can do it over a serial connection without the special programmer. In this post I will describe how the the bootloader works and how to update the firmware.

The ds30loader bootloader

The bootloader is a small section of code which runs before the main Bluefly code. For a whole range of reasons I selected the ds30loader that Michael worked on a few years ago as an open source project (it is GNU licensed, it is used in other devices, I could make it work... etc. ). This same bootloader is used in the bus pirate and other open products. Since Michael did the open source project the bootloader is also available in a commercial version, but I used the GNU licensed one as I wanted to customise it.

You can download the modified source code for the bootloader from my github. You do not need the source, but some people might find it interesting. The source for the bootloader is in assembly and is set up as an XC16 MPLABX project. The bootloader is modified from Michael's original version with the following features:
  • The various settings (configuration bits, timeouts, processor, etc) recommended to be adjusted have been made to match the Bluefly hardware.
  • The bootloader mode will only be entered if RA0 is positive. This corresponds to programming pad #5 on the Bluefly hardware (PGEC). As programming pad #2 is positive then the bootloader mode will be entered if pins #2 and #5 are shorted.
  • When in bootloader mode the green LED is lit but there are no normal startup beeps. This provides some feedback so you know you are in bootloader mode.
To use the bootloader you will need the ds30loader gui PC application. You can download it directly from here.

Firmware Versions

The firmware is contained in a .hex file. From version 10 I started a new numbering system for firmware. I will put all version 10 firmware versions on the support page of the website. The numbering scheme works like this:
  • BlueFlyVario_{DEVICE_TYPE}_v{MODEL_NO}.{TYPE_NO}{SUB_VERSION_NO}.hex where:
    • {DEVICE_TYPE} = Bluetooth, TTL_GPS or USB
    • {MODEL_NO} is associated with a particular series of hardware. (i.e. version 10 for the version 10 models).
    • {TYPE_NO} is associated with the DEVICE_TYPE (Bluetooth = 1, TTL_GPS = 2 and USB = 3).
    • {SUB_VERSION_NO} is the version of the firmware.

For example BlueFlyVario_Bluetooth_v10.102.hex is the second release of firmware for model 10 Bluetooth hardware.

Step 1 - Get the software

Get the ds30loader gui application using the link above and make sure it runs on your pc. Download the right version of the firmware you will need.

Step 2 - Prepare the hardware

You will need access to the programming pads on the pcb so you can short pads #2 and #5. You might need to disassemble the Bluefly so you can access the pads. A small hole in the heatshrink might be sufficient. See the image below for an indication of which pads I am talking about.



You will also need to establish a serial connection. You can test your serial connection using the BFV Desktop application or a terminal emulator like Realterm:
  • Bluetooth version: you should add the vario as a device to the PC (you might need to use code 1234 to pair it via the Devices and Setting menu, it depends on your Bluetooth adapter). You will need to work out what serial port it was assigned by looking at its properties.
  • TTL_GPS version: you will need a TTL to serial adapter. Depending on how you installed the TTL_GPS you might need to solder things. Again you need to work out what serial port the TTL to serial adapter has been assigned.
  • USB version: the serial port is assigned when the device is first connected to your PC.
Step 3 - Open the ds30laoder application

Open up the ds30loader application. Adjust the settings to match the following:
  • Hex file: Browse to the location of the firmware hex file you downloaded (make sure to unzip it)
  • Device: PIC24F
  • Model: 32KA301
  • Baud: 57600
  • Port: What ever serial port you plan to use based on the one you determined in Step 2.
  • Write flash: Checked
  • Flow control: None


Step 4 - Start up the Bluefly in bootloader mode

You will need to short programming pads #2 and #5 then power on the Bluefly module as described in the image above. You should just be able to use a paperclip bent appropriately.
  • For the Bluetooth version, press the power on button while the pads are shorted. As soon as the green led lights up solid you can remove the short. 
  • For the TTL_GPS you will need to power the module using something like a TTL to Serial adapter. Press power then when the green LED lights you can remove the short. 
  • For the USB version it will power on as soon as you attach it to the USB port of your PC, so make sure the pads are shorted when you attach it (you might need three hands).

If the green led lights up and stays lit you are in bootloader mode. You should not hear any of the normal beeps associated with startup.

After entering bootloader mode you have 60 seconds to complete the next step. If you do not program within 60 seconds the device will exit the bootloader mode.

Step 5 - Program the device

Press the Write button in the ds30loader application. The application should connect to the Bluefly and start programming. It takes about 20 seconds.

When programming is complete the Bluefly will start like normal with the new firmware. You can connect it to the BFV Desktop application to confirm the new version is uploaded.

Saturday, 29 November 2014

Kobo Glo Install

I finally got around to installing the BlueFlyVario_TTL_GPS_v10 in a Kobo Glo. Most of the install procedure is the same as the Kobo Mini using earlier versions of the Bluefly. Unfortunately, the Kobo Mini is becoming hard to find. I choose the Glo instead of the Touch as the bezel has more room for the Bluefly. Also, I think the battery is larger to power the LED backlight on the Glo; although we will not use that light for XCSoar

What you will need

Gather the following things:

  • A BlueFlyVario_TTL_GPS_v10 module. You will not need header or Dupont connector that comes with it; but you will need the small piece of neoprene, some wires and some heatshink if you do not have a case. 
  • A Kobo Glo.
  • A Bluefly Kobo Glo Simple Case, you can download this solid design from Thingverse. Find a friend with a 3d printer or order a copy from an online 3d printing service. I had to update the older Kobo Mini Simple Case as it did not fit well on the Kobo Glo. [The case is not really needed, it makes the install look nice. You can of course just use the heatshrink]
  • Some countersunk M3x6mm screws and hex nuts to attach the case to the Glo. 
  • A good soldering iron and some skill using it. 
  • A drill and the right size drill bits. 
Step 1 - Set up XCSoar on the Kobo

This procedure starts pretty much the same as Steps 1 to 3 in this earlier post. Get the Kobo, make sure it works as a standard eReader, then remove the back cover and back up the internal SD card. Note the back cover of the Glo just pops off (with some uncomfortable force), there are no screws. After the SD Card is backed up install XCSoar as described on the XCSoar download page. When XCSoar is working power off the Kobo. 

Note these funny things about the Glo:
  • The power button on the Glo is a bit weird when the back cover is removed. You might have to squeeze the PCB towards the power button to get it to work. 
  • When the Glo has been powered off, from either XCSoar or Nickel, you need to wait about 20 seconds until the power button will work again. 
  • Sometimes Glo freezes at the start-up screen. A short press on the reset button (the hole near the USB connector) will restart it back to the XCSoar menu. 
Step 2 - Solder the BlueFly module to the Kobo

Start by soldering the four wires to the front of the Bluefly module. The wires will wrap around the edge of the module and through a hole in the front of the bezel. There is much less room behind the bezel on the Glo compared to the Mini. Position the case and module and it should be reasonably easy to work out where to drill the holes for the wires. You might use a bit of double sided tape to hold it in position. 



Trim the wires then solder them to the Kobo. Make sure to connect the Bluefly-Tx to the Kobo-Rx and vice versa. 



Note that there are two other serial ports on the Glo which you might be tempted to use - don't. For some reason any data on these ports causes the Glo to freeze. 

In this install we are not going to use the VBACKUP for the GPS as it is tricky to pick up clean power without damaging the Glo. If you really want to connect it then spend some time Googling and find examples of soldering it to capacitor C12. 

Step 3 - Install the Simple Case

After drilling the holes make sure to put the neoprene over the pressure sensor. Secure the case to the bezel using M3 screws and nuts. 



You will need to trim some of the plastic fins from the back cover and around the nuts to make sure it all fits together. 



Step 4 - BlueFly Configuration

Follow Step 8 from here to configure the hardware settings. I think it is best to set the Bluefly to output mode 2 at five updates per second, then adjust the settings in XCSoar to use the LX driver. This minimizes the amount of data. 

Using it

Note that by default the Bluefly will only power on and off based on button presses. If you wanted the Bluefly to switch on and off as the Kobo is powered on and off then you can close the solder jumper on the Bluefly module. 








Wednesday, 26 November 2014

BlueFlyVario_Bluetooth_v10 released

Today I started shipping the first back orders for the BlueFlyVario_Bluetooth_v10. This comes just a week after releasing the BlueFlyVario_TTL_GPS_v10 and is the second in the lineup of version 10 models. I hope to release the USB model in a few weeks after I have caught up with all of the back orders of the TTL_GPS and Bluetooth models.

What is in the bag?

The image below shows an assembled device.
 


To get one of these you will need to do final assembly yourself or convince a fiend who is mildly handy. There is a little more assembly with the v10 than there was with the v9. I can't ship the battery connected because the button is likely to be bumped in the post, and a beeping package is not cool. This means you will need to put the heatshink on yourself. The components in the package are:
  • A BlueFlyVario_Bluetooth_v10 module. This has been bench tested.
  • A translucent blue acrylic prototype case based on a custom version of the DP5031. The acrylic is covered in brown paper.
  • A 600mAh battery with 1.25mm 2 pin molex connector. The battery has some double sided tape on one side.
  • Some clear PVC heatshrink cut to size with a small hole for the button.
  • A small piece of neoprene for putting over the pressure sensor (this is really important).


New Hardware Features
There are a few hardware changes from the version 9 model. Many of the features are similar to the TTL_GPS_v10. In summary:
  • The most significant change in this version is to replace the small micro switch with a tact button. The operation of it is the same as the TTL_GPS_v10.
  • To accommodate the button there is a 4.5mm hole drilled in one side of acrylic prototype case.
  • The circuitry for the soft power on and off is the same as the TTL_GPS_v10
  • The layout of most components has changed. Most significant change is to make the USB connector central.
  • The PCB is slightly thinner.



New Firmware Featuers

The firmware changes are the same as the TTL_GPS_v10. The same boot loader is used, but it needs to be accessed through the Bluetooth connection set up as a virtual serial port on a PC. I will post more about that when I have future firmware updates.

Assembly

Assembly is not hard. It should only take about 15 minutes. You will need a hairdryer or low heat gun (for the heatshink), a small screwdriver and pliers (for the prototype case), and some patience.

Step 1 - Unpack the components

Make sure the you have all of the parts listed above

Step 2 - Pre-test the module

Connect the battery to the module and press the button. The vario should come to life.
  • Lift the vario up and down (gently - the battery is only loosely connected) and you should hear lift beeps and the sink alarm.
  • A momentary press on the button will turn the audio off. Lifting up and down now should only light the green led.
  • Another momentary press will turn the audio back on.
  • A long (2-3s) press will shut the vario down.
  • Turn it back on again then pair it to your Android device (you might need pass code 1234 if you have an old device).
  • Open the BlueFlyVario app (or another app like XCSoar) and connect it to the paired BlueFlyVario.
  • If the device connects after a few seconds and data starts getting sent through then all is good.
Step 3 - Battery

Carefully remove the double sided tape from the battery with your fingernail. Make sure the connector wires are not twisted then place the battery on the bottom of the module so the end of the battery (away from the wires) is lined up as shown in the image below. The trick is to leave enough space at each end of the battery so the prototype case hex spacers do not interfere with the battery too much. It is ok for the top of the battery to be slightly over the molex connector.



Step 4 - Neoprene

The neoprene is really important. Without it, the pressure sensor is really susceptible to light. The neoprene allows more than enough air to get into the small holes in the top of the pressure sensor. Half of one side of the neoprene has double sided tape, remove that and stick it to the board, making sure to completely cover the pressure sensor (do not put the sticky tape on the pressure sensor, that would seal the holes). 



Step 5 - Heatshrink

The clear PVC heatshink is not super important. It's main purpose is to hole the Neoprene in place. It does provide some protection to the components, but you should still be careful. Electronics are fragile.
  • Make the battery cable neat.
  • Put the heatshink over the module with battery and neoprene. The small hole should be lined up with the button.
  • Use a hairdryer on high heat or a heat gun on very low heat to shrink the pvc. Start at the button end and work along one side, then flip it over and do the other side. The heatshink is not going to be really neat. If it is holding the neoprene in plact then it is good enough.
  • If you completely screw it up then cut it off and just use some tape wrapped around a few times, or ask me for some more heatshink.

Step 6 - Prototype case

This video from earlier models shows how to assemble the prototype case. If you could not be bothered watching the video use these steps:
  • Remove the brown paper from the acrylic case.
  • Assemble the first side by putting the 12mm M3 screws through the side of the case with the hole for the button, and secure them with the 5mm hex spacers.
  • Place the assembled first side on the component side of the case lining up the hole with the button. If it does not line up perfectly you might need to scrape the button hole a little bigger with a sharp knife. Make sure the button actuates cleanly.
  • Secure the first side with the 6mm hex spacers on the battery side of the PCB. You might need to push the heatshrink aside a little.
  • Secure the second side on top of the battery with the remaining screws.
Adjust the hardware settings following the instructions in the Hardware Settings Manual. Play with the range of apps available. Enjoy you vario. Contact me for help or for suggestions for improvement. 

Wednesday, 19 November 2014

BlueFlyVario_TTL_GPS_v10 released

I am pleased to release the first of the version 10 Bluefly's. Today I have begun shipping back orders for the BlueFlyVario_TTL_GPS_v10. The previous blog post indicated that these were on the way and described the other models under development.

The BlueFlyVario_TTL_GPS_v10 is primarily designed for integration onto the Kobo, although some people will use it with other e-Readers or just for experimenting. See this older blog post for a step by step guide which describes how to install it on the Kobo mini. The procedure is pretty much the same for this updated vario. The simple case described in this earlier post which you can 3d print will still fit, but you will need to drill a small hole for the new button. 

What is in the bag?

Everyone installs their vario in a slightly different way. In the little bag are the following components:
  • The main module. The PCB size is 50mm x 17 mm which is the same as the v9.
  • A small piece of neoprene. This is really important. It must be placed over the pressure sensor if the sensor is exposed to any light (even light through a translucent case). The neoprene allows the air pressure through, but stops the light. Light makes the pressure sensor go crazy.
  • Some clear PVC heat shrink cut to size. It is fine to install the module without a case if you use the heatshink.
    • Poke a small hole through one side of the heatshrink just big enough for the button.
    • Put the neoprene on the pressure sensor, and the heatshrink evenly over the module.
    • Use a heat gun, or a hairdryer on hot setting to carefully shrink the plastic around the module.
  • A 4x1P right angled header. Some people solder the wires directly to the module, others use the header so it is easy to remove for testing. If you use the header I suggest you trim the through-hole pins to the thickness of the PCB so they are flush with the bottom of the board.
  • A 4x1P DuPont connector with 20 cm wires. This will fit in the header, and the wires connect to the serial port of the Kobo. You should trim the wires to be as short as possible so you minimise stray voltages.


New Hardware Features
Since the BlueFlyVario_TTL_GPS_v9 there have been a few hardware changes. Refer to the circuit diagram and PCB layout below.
  • Button. This is the biggest change with the v10 BlueFly's. The button provides soft power on/off by controlling the shutdown pin of the TC1015 voltage regulator. When pressed the shutdown pin of the regulator is connected to the supply voltage via the diode, which turns on the regulator and powers the micro-controller. One of the first things the micro-controller does is keep the shutdown pin of the regulator turned on. The small diode in conjunction with the 10k pull down resistor then allows another pin on the micro-controller to sense button presses. The behaviour of the button is programmed like this:
    • When the module is off, a short press will provide soft power-on as described above. The module will do the start up beep thing.
    • When on, short presses will turn the audio on an off. A short beep provides confirmation.
    • When on, a long press (2 sec) will power the module off.
  • Solder Jumper. Some people will want the module to power on as soon as power is supplied to the module (that was the behaviour of the v9). By closing the solder jumper with a dab of solder the shutdown pin is permanently biased to the supply voltage. You can still use the short presses on the button to turn the audio on/off. A long press will turn the module off, then it restarts in six seconds.
  • Thinner PCB with gold contacts. I changed to a thinner 4-layer PCB to optimise component placement. ENIG contacts provide a cleaner finish.
  • Additional capacitance on power. I added an additional 1uF capacitor to the supply voltage line. This will reduce stray voltages in the supply if you have longer wires, which should improve GPS performance, but I still recommend trimming your wires as short as possible.
  • UART TLL resistors. The resistors in series with the Tx and Rx lines on prevent the module being powered on by stray voltage. I selected 2.2k based on trial and error. These values work with the Kobo and with FTDI based USB to serial converters.
  • Exposed U1 pins under the GPS. The second serial port on the microcontroller is connected directly to the PA6H GPS. If you are a super electronics hacker and want to update the firmware on the GPS then you can use this serial port for a temporary connection.
  • Exposed speaker pins. Some people want to wire in a different speaker. The pins in parallel to the speaker make this a little easier.



New Firmware Features

There have been a bunch of changes to the firmware to accommodate the new hardware and incorporate some new features. Some key changes:
  • The firmware now includes a modified version of the ds30loader bootloader. This will allow future firmware updates if you connect the module to a PC using a USB to TTL serial converter. The bootloader mode is entered by powering on the module with programming pads 2 and 5 shorted together. I will produce a more fulsome description of the firmware upgrade procedure in later posts.
  • There is now an auto power off feature. Essentially, if the module has not moved more than a certain number of meters vertically for a set duration then it will power down. The default settings are 2 m (20 dm) vertical movement in 10 minutes. You can adjust these settings like other hardware settings. I will update the hardware settings manual and BFV Desktop app at some stage.
Next Steps

I am working on release of the Bluetooth_v10 and the USB_v10 over the coming weeks, in conjunction with catching up on back orders and trying to keep on top of the rest of my life. Please be a little patient if you are waiting on a back order.

Saturday, 25 October 2014

Version 10 BlueFlys

In the next six weeks I expect to release the version 10 range of BlueFlyVarios. The range will consist of three models:
  • BlueFlyVario_Bluetooth_v10. This model represents the evolution of the original BlueFlyVario which started a few years ago. It is designed for Android users who want to use a vario app on their phone. However, it is also popular as a stand alone vario.  
  • BlueFlyVario_TTL_GPS_v10. Used with the Kobo (or other eReaders) running XCSoar. 
  • BlueFlyVario_USB_v10. A new model. Designed to provide a minimalist audio vario.
They all share a few new features; updated firmware, user update-able firmware, a new button design, and improved PCB quality. Some of the things you have come to expect from the BlueFly will just be the same: super sensitive vario, low cost, very hackable, great support, and open designs. See the table below for a detailed list of technical specifications.

Technical Specifications

Designation
BlueFlyVario_Bluetooth_v10
BlueFlyVario_TTL_GPS_v10
BlueFlyVario_USB_v10
Planned release
November 2014
(Replaces BlueFlyVario_Bluetooth_v9)
November 2014
(Replaces BlueFlyVario_TTL_GPS_v9)
December 2014
(New device)
What is it designed for?
Interfacing with Android free flight applications (BlueFlyVario app, XCSoar, other apps).
Using as a standalone audio vario when not connected via Bluetooth.
Interfacing with the Kobo running XCSoar (or other eReaders).
Using as a minimalist standalone audio vario.
Primary Data Interface
(UART 2)
RN42 Bluetooth module using the Serial Port Protocol. Simple interface to most devices supporting Bluetooth SPP (not iOS).
3.0V TTL interface via headers on the module.
On board FTDI FT230X USB-to-Serial converter. Appears as a serial port on PC. Can be interfaced to Android OTG devices.
Secondary Data Interface
(UART 1)
Exposed for hacking.
Onboard PA6H GPS. Data is multiplexed with pressure data.
Exposed for hacking.
Hardware Setting Procedure
BlueFlyVario Android App.

BFVDesktop application on PC’s with Bluetooth adapters.
Telnet into Kobo (when installed).

BFVDesktop application with a USB to Serial converter.
BFVDesktop application.
Case
Board and battery protected by heatshrink.

Acrylic prototype case included.

3D printable enclosed case design to be distributed.
Board protected by heatshrink.

3D printable enclosed case design to be distributed.
Board and battery protected by heatshrink.
Physical dimensions
With included acrylic prototype case. 53 x 34 x 18 mm --- 41 g
The module in heatshrink.
50 x 17 x 9 mm --- 10 g
The module with battery in heatshrink.
50 x 14 x 12 mm -- 12 g
Power Supply
Included 600mAh LiPo battery charged via micro USB adapter (no data connection).

Lasts more than 10 hours with bluetooth and audio running.
Powered from TTL header.
Included 200 to 300 mAh LiPo battery charged via USB.

Expected life greater than 10 hours.
Hardware Button
Long press for soft power on/off. Short press for audio on/off.
Firmware
Will be upgradeable via ds30loader.
Audio
Pleasant sounding 95dBA electromagnetic transducer.
Other audio outputs hacks possible using exposed headers.
Available Hardware Settings
Similar to BlueFlyVario version 9 devices, with some extra settings.
Pressure Sensor
MS5611 accurate to 10cm updated at 50Hz.

Pre-orders

A few months ago I planned these next versions to be ready based on the expected demand of the version 9 range. However, they once again proved to be more popular than planned and there are no more of the version 9 models available. I am waiting on a few parts to complete the first batch of the version 10 models. If you order the Bluetooth or TTL_GPS version 9 model in the next few weeks consider it a pre-order for the version 10.

Friday, 3 October 2014

BlueFlyVario_Bluetooth_v9 Released

I have been shipping the BlueFlyVario_Bluetooth_v9 for a while but did not get a chance to blog about it. This is only a minor update to Version 8. A summary of the important changes from earlier versions is listed below:

Hardware Changes
  • I have added a small battery connector (Molex 1.25 mm) instead of soldering the battery to the board. The wires now wrap around the edge of a board in a small milled slot. This makes assembly a bit quicker and will allow users to change batteries without soldering.
Firmware Changes
  • The firmware now has a minor and major version. The $VER* command now responds with '$BFV MAJOR MINOR*'. The firmware version is currently 9.4.
  • I have included a bootloader. It is a slightly modified version of the ds30loader. At some stage I will blog about how to use the bootloader to update the firmware from a pc.
The circuit diagram and PCB layout for this release are shown below:




The way ahead

I am planning the version 10 hardware lineup with three models based on the primary external interface. These will probably incorporate a button instead of a slide switch. They are some months away I think.:

  • A Bluetooth model with battery similar to this model - designed for integration with Android devices. 
  • A TTL with GPS modules - designed for integration with devices such as the Kobo. 
  • A new USB model with battery - designed for stand alone use. 

Friday, 5 September 2014

Magazine Reviews

A few reviews of the BlueFly varios have been published in the last few weeks. I can't publish the full reviews on the blog, you will have to subscribe to the magazines for that. I have been really impressed that the reviews are full of relevant facts and very positive.

The first review was by Sascha Burkhardt in the August 2014 edition of Thermik, a German language paragliding magazine. Google Translate allowed me to understand just enough of the German; like many Australians I barely speak English.


Next, just a few weeks later, came a review by Richard Sheppard in the digital edition 155 of Cross Country. I think the paper version will be out in the next few days. He reviewed both the bluetooth and ttl versions.

A few other reviewers also have plans to publish articles. All this press means I have been super busy answering questions and shipping varios. I started shipping version 9 of the Bluetooth model a few weeks ago, I should get a chance to blog about it in the next week...