Thursday, 2 November 2017

Airspeed Sensor Updates

Almost two years ago I blogged about an airspeed sensor shield for the BlueFly. This blog post is about a new approach to integrating an airspeed sensor with the BlueFly. It is still far from perfect, and still requires experimentation, but is a bit more accessible for those who want to tinker.

The Sensor

Instead of producing a dedicated sensor I am relying on the widely available MS4525DO based sensor which is used by the R/C community. This uses the same differential pressure sensor as the dedicated airspeed sensor I used to produce for the BlueFly. However, because of the volume of manufacturing they can be produced at a cheaper price. Search ebay, aliexpress, banggood, hobbyking, or your favorite supplier of electronics from China for 'px4 airspeed'. You should get many results. Make sure to select one of the sensors based on the digital MS4525DO (white) instead of the older analog sensor (black). You can read more about this sensor on the pixhawk website


The Enclosure

A 3d printable enclosure is designed to hold the sensor and BlueFlyVario_Bluetooth_USB_v12 (or the USB only version). It is far from a perfect design, but even on a rough 3D printer (like mine) is useful enough. You can grab the design from thingverse. Note that the lid and main part of the case are designed to be glued or held together with tape. Below is a photo of the BlueFly with airspeed sensor installed in the 3D printed case. 


Firmware Update

Before going on please update your firmware to the BlueFlyVario_12.M16 version. The firmware changes include:
  • Fixed a bug with MS5611 temperature sensor output (that is only relevant for tinkering)
  • Changed outputMode 6 (BFV Extended Sentence) to include the MS4525DO sensor temperature. The sentence is now in the following format: $BFX,pressure(Pa),vario(cm/s), MS5611temp(deg C in 2 decimal places), battery(%),pitotDiffPressure(pa), volts(V), pitotTemp(deg C in 1 decimal place)*checksum\r\n 
  • Ensured that if you send the command $BUP 1* that it always triggers an differential pressure sensor calibration sequence (which takes about 10 seconds). 
Assembly

The first step is working out what to connect to what. The sensor is connected to the I2C port of the BlueFly. You will need to ensure:
  • BlueFly-Gnd is connected to PX4Airspeed-Gnd
  • BlueFly-SDA is connected to PX4Airspeed-SDA
  • BlueFly-SCL is connected to PX4Airspeed-SCL
  • BlueFly-V+ is connected to PX4Airspeed-+5V. Note that the the BlueFly actually only provides 3.3V, but my experiments suggest that there is no degradation in performance of the MS4525DO sensor at this voltage. 


After soldering, the connections are shown below. You will need to cut and solder the wires to the length required for your enclosure. 


The image below shows the connected sensor and pitot tube mounted in the 3d printed enclosure. Note:
  • The BlueFly mainboard mounts in a similar way as in the standard sky blue case. 
  • The upper nozzle on the differential pressure sensor connects to the pitot part of the pitot tube, the lower nozzle on the static port. 
  • You should use a few dabs of hot melt glue to keep the pitot tube and px4 airpeed sensor firmly in place. 

Configuration

At the time of writing this blog post the only app which I am aware can read the indicated airspeed is xcsoar, and only when using the BlueFly in outputMode=2 (LX mode) and xcsoar configured to use the LXNAV driver. Key points:
  • You first configure the BlueFly to outputMode=2 and usePitot = true using the BFVDesktop app or by using direct serial commands. See the hardware settings manual for information about how to adjust the settings.
  • In xcsoar, set the driver to LXNAV and connect to the appropriate port (Bluetooth or over IP as appropriate for your model of BlueFly). 
  • In xcsoar, you should now see the Airspeed IAS info box provide the indicated airspeed reading. Note that this is different from the true airspeed. At low speeds (less than about 10km/hr) it will jump around quite a bit. At our paragliding and hanggliding airspeeds it should be accurate to about 1km/hr or less. 
  • Note that you can send the command $BUP 1* (this is the same as usePitot=true) to trigger a zero calibration of the differential airspeed sensor. A zero calibration will always be triggered on startup, and should be re-triggered only when the actual airspeed of the pitot is zero. 
If you really want to tinker and develop a custom app which uses the full features of the airpeed sensor then you will probably want to read the sentence from outputMode=6 ($BFX,pressure(Pa),vario(cm/s), MS5611temp(deg C in 2 decimal places), battery(%),pitotDiffPressure(pa), volts(V), pitotTemp(deg C in 1 decimal place)*checksum\r\n ) This provides the MS5611 pressure and temp, and the MS4525DO pitot differential pressure and temp. With some smart coding you should be able to calculate the true airspeed, and even develop a total energy calculation.

On the hardware side, you might want to add a push button for zero calibration. The firmware polls RB10. An internal pull up keeps it high, but if you use a push button to ground then zero calibration will be triggered. 


Todo

As always, there is more to do; manual updates, testing, more software, better physical layout for mounting in a paraglider or hangglider, etc.