Skip to the content.

Environmental module

The Environmental module collects sensor data from the onboard BME680 environmental sensor on the Thingy:91 X. The module provides temperature, pressure, and humidity readings to other modules through the zbus messaging system. The module initializes the sensor hardware and responds to sampling requests from the main application module.

To initiate a sensor reading, the main module sends an ENVIRONMENTAL_SENSOR_SAMPLE_REQUEST message to the environmental module. The environmental module then reads the sensor data and sends an ENVIRONMENTAL_SENSOR_SAMPLE_RESPONSE message with the collected data asynchronously.

Messages

The Environmental module communicates via the zbus channel ENVIRONMENTAL_CHAN, using message types defined in environmental.h.

Input Messages

Output Messages

The message structure used by the environmental module is defined in environmental.h:

struct environmental_msg {
    enum environmental_msg_type type;
    double temperature;
    double pressure;
    double humidity;
};

Configurations

The Environmental module can be configured using the following Kconfig options:

For more details on Kconfig options, see the Kconfig.environmental file in the module’s directory.

State diagram

The environmental module implements a very simple state machine with only one state:

stateDiagram-v2
    [*] --> STATE_RUNNING