Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
meteo_stick module

Meteo sensor board from Enac (absolute and differential pressure, temperature, humidity) aka Meteo Stick.

Raw meteo data:

  • Pressure (absolute and differential) in ADC (ADS1220)
  • Temperature in ADC (ADS1220)
  • Humidity in ticks (period of the input signal)

Calibration data are stored in an EEPROM. When a sensor is calibrated with several reference temperature, a linear interpolation is used.

When using SEND_MS flag, scaled pressure, temperature and humidity data are sent over telemetry with the PAYLOAD_FLOAT message (array of float).

When using LOG_MS flag, raw and calibrated pressure, temperature and humidity data are stored with raw gps data (position, speed, time, status). Field names and units are in the first line of the log file.

Example for airframe file

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

<module name="meteo_stick">
b'<configure name="MS_SPI_DEV" value="SPIX" />\n '
b'<configure name="MS_PRESSURE_SLAVE_IDX" value="X" />\n '
b'<configure name="MS_DIFF_PRESSURE_SLAVE_IDX" value="X" />\n '
b'<configure name="MS_TEMPERATURE_SLAVE_IDX" value="X" />\n '
b'<configure name="MS_HUMIDITY_PWM_INPUT" value="PWM_INPUTX" />\n '
b'<configure name="MS_EEPROM_SLAVE_IDX" value="X" />\n '
</module>

Module configuration options

Configure Options

  • name: MS_SPI_DEV value: SPIX
    Description: Select SPI for external ADC
  • name: MS_PRESSURE_SLAVE_IDX value: X
    Description: Index of the SPI slave for absolute pressure
  • name: MS_DIFF_PRESSURE_SLAVE_IDX value: X
    Description: Index of the SPI slave for differential pressure
  • name: MS_TEMPERATURE_SLAVE_IDX value: X
    Description: Index of the SPI slave for temperature
  • name: MS_HUMIDITY_PWM_INPUT value: PWM_INPUTX
    Description: Select PWM input channel for humidity sensor
  • name: MS_EEPROM_SLAVE_IDX value: X
    Description: Index of the SPI slave for calibration EEPROM

Airframe file section

  • section name: METEO_STICK
    • name LOG_MS value: TRUE|FALSE
      Description: Log data on SD card (ascii format, raw PTU data + GPS data)
    • name LOG_MS_FLIGHTRECORDER value: TRUE|FALSE
      Description: Log data on SD card (METEO_STICK message in binary format)
    • name MS_LOG_FILE value: flightrecorder_sdlog
      Description: Log for binary format (only available with LOG_MS_FLIGHTRECORDER to TRUE)
    • name SEND_MS_SYNC value: TRUE|FALSE
      Description: Send data over telemetry sync to reading (METEO_STICK message, scaled PTU data)
    • name USE_MS_EEPROM value: TRUE|FALSE
      Description: Enable/disable usage of calibration data from EEPROM (default TRUE, set to FALSE if MS_EEPROM_SLAVE_IDX is not configured
    • name MS_PRESSURE_OFFSET value: 0.
      Description: Offset of the absolute pressure sensor (only used if EEPROM is not used)
    • name MS_PRESSURE_SCALE value: 1.
      Description: Scale factor of the absolute pressure sensor (only used if EEPROM is not used)
    • name MS_TEMPERATURE_OFFSET value: 0.
      Description: Offset of the temperature sensor (only used if EEPROM is not used)
    • name MS_TEMPERATURE_SCALE value: 1.
      Description: Scale factor of the temperature sensor (only used if EEPROM is not used)
    • name MS_HUMIDITY_OFFSET value: 0.
      Description: Offset of the humidity sensor (only used if EEPROM is not used)
    • name MS_HUMIDITY_SCALE value: 1.
      Description: Scale factor of the pressure sensor (only used if EEPROM is not used)
    • name MS_DIFF_PRESSURE_OFFSET value: 0.
      Description: Offset of the differential pressure sensor (only used if EEPROM is not used)
    • name MS_DIFF_PRESSURE_SCALE value: 1.
      Description: Scale factor of the differential pressure sensor (only used if EEPROM is not used)

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.

  • meteo_stick_periodic()
    • Frequency in Hz: 10
    • Autorun: TRUE
      Periodic function automatically starts after init.
  • meteo_stick_report()
    • Frequency in Hz: 1
    • Autorun: TRUE
      Periodic function automatically starts after init.

Files

Header Files

The following headers are automatically included in modules.h

Source Files

Raw meteo_stick.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="meteo_stick" dir="meteo">
<doc>
<description>
Meteo sensor board from Enac (absolute and differential pressure, temperature, humidity) aka Meteo Stick.
Raw meteo data:
- Pressure (absolute and differential) in ADC (ADS1220)
- Temperature in ADC (ADS1220)
- Humidity in ticks (period of the input signal)
Calibration data are stored in an EEPROM. When a sensor is calibrated with several reference temperature, a linear interpolation is used.
When using SEND_MS flag, scaled pressure, temperature and humidity data are sent over telemetry with the PAYLOAD_FLOAT message (array of float).
When using LOG_MS flag, raw and calibrated pressure, temperature and humidity data are stored with raw gps data (position, speed, time, status).
Field names and units are in the first line of the log file.
</description>
<configure name="MS_SPI_DEV" value="SPIX" description="Select SPI for external ADC"/>
<configure name="MS_PRESSURE_SLAVE_IDX" value="X" description="Index of the SPI slave for absolute pressure"/>
<configure name="MS_DIFF_PRESSURE_SLAVE_IDX" value="X" description="Index of the SPI slave for differential pressure"/>
<configure name="MS_TEMPERATURE_SLAVE_IDX" value="X" description="Index of the SPI slave for temperature"/>
<configure name="MS_HUMIDITY_PWM_INPUT" value="PWM_INPUTX" description="Select PWM input channel for humidity sensor"/>
<configure name="MS_EEPROM_SLAVE_IDX" value="X" description="Index of the SPI slave for calibration EEPROM"/>
<section name="METEO_STICK">
<define name="LOG_MS" value="TRUE|FALSE" description="Log data on SD card (ascii format, raw PTU data + GPS data)"/>
<define name="LOG_MS_FLIGHTRECORDER" value="TRUE|FALSE" description="Log data on SD card (METEO_STICK message in binary format)"/>
<define name="MS_LOG_FILE" value="flightrecorder_sdlog" description="Log for binary format (only available with LOG_MS_FLIGHTRECORDER to TRUE)"/>
<define name="SEND_MS_SYNC" value="TRUE|FALSE" description="Send data over telemetry sync to reading (METEO_STICK message, scaled PTU data)"/>
<define name="USE_MS_EEPROM" value="TRUE|FALSE" description="Enable/disable usage of calibration data from EEPROM (default TRUE, set to FALSE if MS_EEPROM_SLAVE_IDX is not configured"/>
<define name="MS_PRESSURE_OFFSET" value="0." description="Offset of the absolute pressure sensor (only used if EEPROM is not used)"/>
<define name="MS_PRESSURE_SCALE" value="1." description="Scale factor of the absolute pressure sensor (only used if EEPROM is not used)"/>
<define name="MS_TEMPERATURE_OFFSET" value="0." description="Offset of the temperature sensor (only used if EEPROM is not used)"/>
<define name="MS_TEMPERATURE_SCALE" value="1." description="Scale factor of the temperature sensor (only used if EEPROM is not used)"/>
<define name="MS_HUMIDITY_OFFSET" value="0." description="Offset of the humidity sensor (only used if EEPROM is not used)"/>
<define name="MS_HUMIDITY_SCALE" value="1." description="Scale factor of the pressure sensor (only used if EEPROM is not used)"/>
<define name="MS_DIFF_PRESSURE_OFFSET" value="0." description="Offset of the differential pressure sensor (only used if EEPROM is not used)"/>
<define name="MS_DIFF_PRESSURE_SCALE" value="1." description="Scale factor of the differential pressure sensor (only used if EEPROM is not used)"/>
</section>
</doc>
<settings>
<dl_settings>
<dl_settings NAME="MS">
<dl_setting MAX="1" MIN="0" STEP="1" VAR="meteo_stick.reset_dp_offset" shortname="Reset offset" module="modules/meteo/meteo_stick" values="NONE|RESET"/>
</dl_settings>
</dl_settings>
</settings>
<dep>
<depends>pwm_meas</depends>
</dep>
<header>
<file name="meteo_stick.h"/>
</header>
<init fun="meteo_stick_init()"/>
<periodic fun="meteo_stick_periodic()" freq="10" autorun="TRUE"/>
<periodic fun="meteo_stick_report()" freq="1" autorun="TRUE"/>
<event fun="meteo_stick_event()"/>
<makefile target="ap">
<configure name="MS_SPI_DEV" case="upper|lower"/>
<file name="meteo_stick.c"/>
<file name="meteo_stick_calib.c"/>
<file name="ads1220.c" dir="peripherals"/>
<file name="eeprom25AA256.c" dir="peripherals"/>
<define name="USE_$(MS_SPI_DEV_UPPER)"/>
<define name="MS_PRESSURE_SLAVE_IDX" value="$(MS_PRESSURE_SLAVE_IDX)" cond="ifdef MS_PRESSURE_SLAVE_IDX"/>
<define name="MS_DIFF_PRESSURE_SLAVE_IDX" value="$(MS_DIFF_PRESSURE_SLAVE_IDX)" cond="ifdef MS_DIFF_PRESSURE_SLAVE_IDX"/>
<define name="MS_TEMPERATURE_SLAVE_IDX" value="$(MS_TEMPERATURE_SLAVE_IDX)" cond="ifdef MS_TEMPERATURE_SLAVE_IDX"/>
<define name="MS_EEPROM_SLAVE_IDX" value="$(MS_EEPROM_SLAVE_IDX)" cond="ifdef MS_EEPROM_SLAVE_IDX"/>
<define name="USE_SPI_SLAVE$(MS_PRESSURE_SLAVE_IDX)" cond="ifdef MS_PRESSURE_SLAVE_IDX"/>
<define name="USE_SPI_SLAVE$(MS_DIFF_PRESSURE_SLAVE_IDX)" cond="ifdef MS_DIFF_PRESSURE_SLAVE_IDX"/>
<define name="USE_SPI_SLAVE$(MS_TEMPERATURE_SLAVE_IDX)" cond="ifdef MS_TEMPERATURE_SLAVE_IDX"/>
<define name="USE_SPI_SLAVE$(MS_EEPROM_SLAVE_IDX)" cond="ifdef MS_EEPROM_SLAVE_IDX"/>
<define name="MS_SPI_DEV" value="$(MS_SPI_DEV_LOWER)"/>
<define name="MS_HUMIDITY_PWM_INPUT" value="$(MS_HUMIDITY_PWM_INPUT)" cond="ifdef MS_HUMIDITY_PWM_INPUT"/>
<define name="$(MS_HUMIDITY_PWM_INPUT)_TICKS_PER_USEC" value="42" cond="ifdef MS_HUMIDITY_PWM_INPUT"/> <!-- set timer clock to 42 MHz -->
<define name="USE_$(MS_HUMIDITY_PWM_INPUT)" value="PWM_PULSE_TYPE_ACTIVE_LOW" cond="ifdef MS_HUMIDITY_PWM_INPUT"/>
</makefile>
</module>