Paparazzi UAS  v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
airspeed_ms45xx_i2c module

MS45XX differential pressure/airspeed sensor.

Airspeed sensor module using the MS45xxDO digital pressure sensor via I2C. Needs one of the differential versions with 14bit pressure and 11bit temperature.

Example for airframe file

Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!

1 <module name="airspeed_ms45xx_i2c">
2  <define name="MS45XX_I2C_DEV" value="i2cX" />
3  <define name="MS45XX_I2C_ADDR" value="0x50" />
4  <define name="MS45XX_PRESSURE_RANGE" value="1|2|5|15|30|50|100|150" />
5  <define name="MS45XX_OUTPUT_TYPE" value="0|1" />
6  <define name="MS45XX_SYNC_SEND" value="TRUE|FALSE" />
7  <define name="MS45XX_PRESSURE_SCALE" value="1.05" />
8  <define name="MS45XX_PRESSURE_OFFSET" value="8618.4" />
9  <define name="MS45XX_AIRSPEED_SCALE" value="1.6327" />
10  <define name="MS45XX_LOWPASS_TAU" value="0.15" />
11  <define name="USE_AIRSPEED_MS45XX" value="TRUE|FALSE" />
12 </module>

Module configuration options

Define Options

  • name: MS45XX_I2C_DEV value: i2cX
    Description: set i2c peripheral (default: i2c2)
  • name: MS45XX_I2C_ADDR value: 0x50
    Description: i2c slave address (default: 0x50)
  • name: MS45XX_PRESSURE_RANGE value: 1|2|5|15|30|50|100|150
    Description: pressure range in psi (default: 1)
  • name: MS45XX_OUTPUT_TYPE value: 0|1
    Description: set to 0 for output type A, to 1 for output type B (default: type A)
  • name: MS45XX_SYNC_SEND value: TRUE|FALSE
    Description: flag to enable sending every new measurement via telemetry (default:FALSE)
  • name: MS45XX_PRESSURE_SCALE value: 1.05
    Description: pressure scaling factor to convert raw output to Pa (default: set according to pressure range and output type according to datasheet)
  • name: MS45XX_PRESSURE_OFFSET value: 8618.4
    Description: pressure offset in Pa (default: set according to pressure range and output type according to datasheet)
  • name: MS45XX_AIRSPEED_SCALE value: 1.6327
    Description: quadratic scale factor to convert differential pressure to airspeed
  • name: MS45XX_LOWPASS_TAU value: 0.15
    Description: Time constant for second order Butterworth low pass filter
  • name: USE_AIRSPEED_MS45XX value: TRUE|FALSE
    Description: set airspeed in state interface

Module functions

Init Functions

These initialization functions are called once on startup.

Event Functions

These event functions are called in each cycle of the module event loop.

Periodic Functions

These functions are called periodically at the specified frequency from the module periodic loop.

  • ms45xx_i2c_periodic()
    • Frequency in Hz: 100.
    • Autorun: LOCK
      Periodic function automatically starts after init and can't be stopped.

Files

Header Files

The following headers are automatically included in modules.h

Source Files

Raw airspeed_ms45xx_i2c.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="airspeed_ms45xx_i2c" dir="sensors">
<doc>
<description>
MS45XX differential pressure/airspeed sensor.
Airspeed sensor module using the MS45xxDO digital pressure sensor via I2C.
Needs one of the differential versions with 14bit pressure and 11bit temperature.
</description>
<define name="MS45XX_I2C_DEV" value="i2cX" description="set i2c peripheral (default: i2c2)"/>
<define name="MS45XX_I2C_ADDR" value="0x50" description="i2c slave address (default: 0x50)"/>
<define name="MS45XX_PRESSURE_RANGE" value="1|2|5|15|30|50|100|150" description="pressure range in psi (default: 1)"/>
<define name="MS45XX_OUTPUT_TYPE" value="0|1" description="set to 0 for output type A, to 1 for output type B (default: type A)"/>
<define name="MS45XX_SYNC_SEND" value="TRUE|FALSE" description="flag to enable sending every new measurement via telemetry (default:FALSE)"/>
<define name="MS45XX_PRESSURE_SCALE" value="1.05" description="pressure scaling factor to convert raw output to Pa (default: set according to pressure range and output type according to datasheet)"/>
<define name="MS45XX_PRESSURE_OFFSET" value="8618.4" description="pressure offset in Pa (default: set according to pressure range and output type according to datasheet)"/>
<define name="MS45XX_AIRSPEED_SCALE" value="1.6327" description="quadratic scale factor to convert differential pressure to airspeed"/>
<define name="MS45XX_LOWPASS_TAU" value="0.15" description="Time constant for second order Butterworth low pass filter"/>
<define name="USE_AIRSPEED_MS45XX" value="TRUE|FALSE" description="set airspeed in state interface"/>
</doc>
<settings>
<dl_settings>
<dl_settings NAME="MS45XX">
<dl_setting min="0" max="1" step="1" values="FALSE|TRUE" var="ms45xx.sync_send" type="bool" shortname="sync_send" module="modules/sensors/airspeed_ms45xx_i2c" param="MS45XX_SYNC_SEND" persistent="true"/>
<dl_setting min="0.9" max="1.2" step="0.01" var="ms45xx.pressure_scale" type="float" shortname="PressScale" module="modules/sensors/airspeed_ms45xx_i2c" param="MS45XX_PRESSURE_SCALE" persistent="true"/>
<dl_setting min="8300.0" max="8900.0" step="0.1" var="ms45xx.pressure_offset" type="float" shortname="PressOffset" module="modules/sensors/airspeed_ms45xx_i2c" param="MS45XX_PRESSURE_OFFSET" persistent="true"/>
<dl_setting min="1.0" max="2.0" step="0.01" var="ms45xx.airspeed_scale" type="float" shortname="AirScale" module="modules/sensors/airspeed_ms45xx_i2c" param="MS45XX_AIRSPEED_SCALE" persistent="true"/>
</dl_settings>
</dl_settings>
</settings>
<header>
<file name="airspeed_ms45xx_i2c.h"/>
</header>
<init fun="ms45xx_i2c_init()"/>
<periodic fun="ms45xx_i2c_periodic()" freq="100."/>
<event fun="ms45xx_i2c_event()"/>
<makefile target="ap">
<file name="airspeed_ms45xx_i2c.c"/>
</makefile>
</module>