IMP34DT05

namespace IMP34DT05

STMicroelectronics IMP34DT05 sensor.

The STMicroelectronics IMP34DT05 is a MEMS audio sensor omnidirectional digital microphone for industrial applications.

For technical documents and a complete description of the sensor features please refer to the official documentation at: https://www.st.com/en/mems-and-sensors/imp34dt05.html

To create a STMicroelectronics IMP34DT05 sensor use the HUX_DECLARE_SENSOR construct:

HUX_DECLARE_SENSOR(sensor_name, hux::sensors::STMicroelectronics::IMP34DT05);

Simulation data

To define simulation data for a STMicroelectronics IMP34DT05 sensor use the HUX_DECLARE_SIMULATION_DATA construct, making sure that the simulation data match the following data type:

typedef hux::tuple<std::vector<float>, std::vector<float>, std::vector<hux::uint64_t>> hux::sensors::STMicroelectronics::IMP34DT05::simulation_data_t

The type of data required for simulation purposes.

A hux::tuple of std::vector of the following types:

  • float: Mean of the sound signal normalized in the range [-1.0, +1.0]

  • float: Variance of the sound signal normalized in the range [-1.0, +1.0]

  • hux::uint64_t: Unix timestamp in milliseconds of the data generated by the sensor

This example shows how to load simulation data for a STMicroelectronics IMP34DT05 sensor from a CSV file whose columns are separated by semicolon (“;”):

HUX_DECLARE_SIMULATION_DATA(sim_data,
    hux::simulation::load_csv<float, float, hux::uint64_t>("dataset.csv", ";"))
);

HUX_DECLARE_SENSOR(sensor_name, hux::sensors::STMicroelectronics::IMP34DT05, sim_data);

Sources

The STMicroelectronics IMP34DT05 sensor offers the following sources:

inline constexpr const auto get_mean()

Mean of the sound signal normalized in the range [-1.0, +1.0].

Returns

The mean of the sound signal over the last time window

inline constexpr const auto get_variance()

Variance of the sound signal normalized in the range [-1.0, +1.0].

Returns

The variance of the sound signal over the last time window

inline constexpr const auto get_timestamp()

Unix timestamp in milliseconds of the data generated by the sensor.

Returns

The Unix timestamp in milliseconds of the data generated by the sensor

Configurations

Initial configuration

To define an initial configuration for a STMicroelectronics IMP34DT05 sensor use the HUX_DECLARE_SENSOR_CONFIGURATION construct:

HUX_DECLARE_SENSOR_CONFIGURATION(conf_name, hux::sensors::STMicroelectronics::IMP34DT05,
    .PARAM_1 = VALUE_1,
    .PARAM_2 = VALUE_2,
    ...
);

HUX_DECLARE_SENSOR(sensor_name, hux::sensors::STMicroelectronics::IMP34DT05, {}, conf_name);

where PARAM_1, PARAM_2, … can be any of the following:

float odr = 1.f

Output data rate (supported values from 1 to 1000)

Note

If a parameter is not specified within the sensor configuration its default value is used.

Dynamic configuration

The Huxon language provides the capability to reconfigure sensor parameters dynamically while the application is running. This allow to change the behavior of a sensor in response to specific events.

To dynamically reconfigure a STMicroelectronics IMP34DT05 sensor, it is necessary to create a configurator through the HUX_SENSOR_CONFIGURATOR_BUILDER and register it to the sensor using HUX_REGISTER_SENSOR_CONFIGURATOR:

HUX_DECLARE_SENSOR(sensor_name, hux::sensors::STMicroelectronics::IMP34DT05);

...

auto configurator = HUX_SENSOR_CONFIGURATOR_BUILDER(hux::sensors::STMicroelectronics::IMP34DT05)
    .add_PARAM1_cfg_chan(param1_channel)
    .add_PARAM2_cfg_chan(param2_channel)
    ...
    .finalize();

HUX_REGISTER_SENSOR_CONFIGURATOR(sensor_name, configurator);

where param1_channel, param2_channel, … are channels that generate configuration values, while the configurator builder methods: add_PARAM1_cfg_chan, add_PARAM2_cfg_chan, … bind such channels to the parameters they will configure. The configurator builder methods can be any of the following:

template<hux::channels::IsChannelOf<float> channel_t>
inline constexpr const auto add_ODR_cfg_chan(channel_t channel) const

Configures a channel for the ODR (Output Data Rate) parameter.

Template Parameters

channel_t – The type of input channel supplying the configuration values for the parameter

Parameters

channel – The input channel supplying the configuration values for the parameter

Returns

The updated builder instance (for further method invocation chaining)