Main Content

LPS22HB Pressure Sensor

Measure barometric air pressure and temperature from LPS22HB sensor

Since R2025a

  • block icon for LPS22HB Pressure 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 LPS22HB Pressure Sensor block measures barometric air pressure using the LPS22HB pressure sensor interfaced with the STM32 Processor. This sensor comprises of a sensing element to measure the absolute pressure. The block also measures the temperature from the embedded temperature sensor in LPS22HB Sensor.

You can also select an output data rate in the block, and use the low pass filter option for filtering the measured pressure values.

Ports

Output

expand all

The block outputs the barometric air pressure in Pascals (Pa).

Dependencies

This output port appears only if you select the Pressure (Pa) parameter.

Data Types: double

Temperature (in ℃) measured by LPS22HB sensor connected to STM32 processor.

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 board. The I2C bus frequency, serial clock (SCL) pin and serial data (SDA) pin are taken according to the corresponding I2C module entry in the configuration parameters.

Programmatic Use

Block Parameter: I2CModule

The peripheral addresses to communicate with the LPS22HB sensor are decided by the state of the SA0 pin on the hardware board. This table provides the peripheral addresses corresponding to the pin and their state.

Pin NamePin StatePeripheral Address
SA000x5C
10x5D

Programmatic Use

Block Parameter: I2CAddress

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

Programmatic Use

Block Parameter: IsActivePressure

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 pressure data is sampled, which also determines the bandwidth.

Programmatic Use

Block Parameter: OutputDataRate

Enable the low pass filter for reading pressure values.

Programmatic Use

Block Parameter: IsEnableLowPassFilter

Select the required bandwidth of the low pass filter.

Dependencies

This parameter appears only if you select the Enable low pass filter parameter.

Programmatic Use

Block Parameter: BandWidth

Specify how often this block reads the data from the LPS22HB 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