Device Driver for Sensirion SHT30/SHT31/SHT35 Humidity and Temperature Sensors. More...
Device Driver for Sensirion SHT30/SHT31/SHT35 Humidity and Temperature Sensors.
The driver is for the usage with RIOT-OS. It supports the Sensirion SHT30, SHT31, and SHT35 digital temperature and humidity sensors.
SHT3x are a digital temperature and humidity sensors that use an I2C interface with up to 1 MHz communication speed. They can operate with three levels of repeatability (sht3x_repeat_t)
and in two different modes (sht3x_mode_t)
In periodic mode, the SHT3x sensors support an Alert Mode, which allows to define temperature and humidity limits and indicate an alert by a dedicated ALERT pin or a status flag if any of the limits is reached reached.
Once a SHT3x sensor is initialized using the sht3x_init function, it can be used for measurements.
In single shot mode, a measurement command triggers the acquisition of exactly one data pair. Each data pair consists of temperature and humidity as 16-bit decimal values.
Due to the measurement duration of up to 16 ms, the measurement process is separated into steps to avoid blocking of the system during measurements:
For convenience the high level function sht3x_read comprises all three steps above in only one function to perform a measurement.
The advantage of this mode is that the sensor can switch between successive measurements into the sleep mode, which is more energy-efficient. This is particularly useful when the measurement rate is less than 1 measurement per second.
In this mode, one issued measurement command yields a stream of data pairs. Each data pair consists again of temperature and humidity as 16-bit decimal values. As soon as the measurement command has been sent to the sensor, it automatically performs measurements periodically at a rate of 0.5, 1, 2, 4 or 10 measurements per second (mps). The data pairs can be fetched with the same rate or a lower rate.
As in single shot mode, the measurement process is separated into the following steps:
While periodic measurement is started (step 1) already in the sht3x_init function, the application has to call the sht3x_read function on a regular base to fetch the results from last periodic measurement. Possible periodic measurement modes are defined by sht3x_mode_t.
Once new measurement results are available, the sht3x_read function
These measured data are:
For either the
hum parameter also
NULL can be passed, if only one value is of interest.
All driver functions return 0 on success or one of a negative error code defined by sht3x_error_codes.
The SHT3x sensor supports three levels of repeatability (low, medium and high). The stated repeatability is 3 times the standard deviation of multiple consecutive measurements at the stated repeatability and at constant ambient conditions. It is a measure for the noise on the physical sensor output. Different measurement modes allow for high/medium/low repeatability. Datasheet SHT3x-DIS
The repeatability settings influences the measurement duration as well as the power consumption of the sensor. The measurement takes typically 2.5 ms with low repeatability, 4.5 ms with medium repeatability and 12.5 ms with high repeatability. That is, the measurement produces a noticeable delay in execution.
|Reapeatability||T typ.||RH typ.||Maximum Measurement Duration|
While the sensor measures at the lowest repeatability, the average current consumption is 800 μA. That is, the higher the repeatability level, the longer the measurement takes and the higher the power consumption. The sensor consumes only 0.2 μA in standby mode.
Possible repeatabilities are defined by sht3x_repeat_t.
The structure of a configuration is defined in sht3x_params_t and consists of the following parameters:
The sht3x_init function has to be called for each SHT3x sensor to initialize the sensor and to check its availability as well as its error state.
In this example the configuration for two devices is defined.
Once the sensor devices are initialized and configured, the sht3x_read function can be used to read measurement results from the sensor.
|Device Driver for Sensirion SHT30/SHT31/SHT35 Humidity and Temperature Sensors. |
|Default configuration for Sensirion SHT30/SHT31/SHT35 devices. |