Main Content

HTS221 Humidity Sensor

Measure relative humidity and temperature from HTS221 sensor

Since R2025a

  • block icon for HTS221 Humidity Sensor

Libraries:
STM32 Microcontroller Blockset / (Legacy) STM32 MBED Based Boards / MBED Based Sensors
STM32 Microcontroller Blockset / (Legacy) STM32 MBED Based Boards / STM32L475VG-Discovery (B-L475E-IOT01A)
STM32 Microcontroller Blockset / Sensors / Environmental Sensors
Simulink Support Package for Arduino Hardware / Sensors

Description

The HTS221 Humidity Sensor block measures relative humidity and ambient temperature using the HTS221 humidity sensor interfaced with the STM32 Processors. This sensor comprises of a sensing element to measure the relative humidity and temperature.

You can also select an output data rate for the measured values in the block.

Ports

Output

expand all

The block outputs the relative humidity in percentage (%).

Dependencies

This output port appears only if you select the Humidity (%) parameter.

Data Types: double

Temperature (in ℃) measured by HTS221 sensor connected to STM32 Processors.

Dependencies

This output port appears only if you select the Temperature (℃) parameter.

Data Types: double

Status of pressure and temperature measurements, specified as a 1-by-2 vector. 0 indicates that the data read is new, 1 indicates that the data read is not new, and -1 indicates that the corresponding output is not selected.

Dependencies

This output port appears only if you select the Status parameter.

Data Types: int8

Parameters

expand all

Specify the I2C module on the STM32 Processors to communicate with sensor peripherals.

Programmatic Use

Block Parameter: I2CModule

The peripheral address for the HTS221 sensor to communicate with the STM32 Processors.

Programmatic Use

Block Parameter: I2CAddress

Select this parameter to set Humidity as one of the output ports.

Programmatic Use

Block Parameter: IsActiveHumidity

Select this parameter to set Temperature as one of the output ports.

Programmatic Use

Block Parameter: IsActiveTemperature

Select this parameter to set Status as one of the output ports.

Programmatic Use

Block Parameter: IsStatus

Select the output data rate at which humidity data is sampled.

Programmatic Use

Block Parameter: OutputDataRate

Specify how often this block reads the data from the HTS221 sensor. When you set this parameter to -1, Simulink determines the best sample time for the block based on the block context within the model.

Programmatic Use

Block Parameter: SampleTime

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2025a