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.
Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!
These initialization functions are called once on startup.
These event functions are called in each cycle of the module event loop.
These functions are called periodically at the specified frequency from the module periodic loop.
<!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"/>
<define name="USE_$(MS_HUMIDITY_PWM_INPUT)" value="PWM_PULSE_TYPE_ACTIVE_LOW" cond="ifdef MS_HUMIDITY_PWM_INPUT"/>
</makefile>
</module>