Main Content

LSM6DSO IMU Sensor

Measure linear acceleration, angular rate, and temperature from LSM6DSO sensor

Since R2025a

Add-On Required: This feature requires the Embedded Coder Support Package for STMicroelectronics STM32 Processors add-on.

  • block icon for LSM6DSO IMU Sensor

Libraries:
Embedded Coder Support Package for STMicroelectronics STM32 Processors / Sensors / IMU Sensors

Description

The LSM6DSO IMU Sensor block measures linear acceleration and angular rate along the X-, Y-, and Z- axis using the LSM6DSO inertial measurement unit (IMU) sensor interfaced with an STM32 processor. This six degree of freedom (DoF) and IMU sensor comprises of an accelerometer and gyroscope that you can use to measure linear acceleration and angular rate, respectively. The block also measures the temperature from the embedded temperature sensor in the LSM6DSO ssensor.

You can also use the composite filter option in the block for the accelerometer values, and use the highpass and lowpass filter options for the gyroscope values.

Ports

Output

expand all

You can select the active sensor(s) to measure angular velocity, acceleration, temperature, or a combination of these measurements.

The block outputs acceleration as a n-by-3 vector, where n is the value for samples per frame. Each value represents the measurement of acceleration in m/s^2 along the X-, Y-, and Z- axes.

Dependencies

To enable this port, select the Acceleration (m/s2) parameter.

Data Types: double

The block outputs angular velocity as a n-by-3 vector, where n is the value for samples per frame. Each value represents the measurement of angular velocity in radians per second (rad/s) along the X-, Y-, and Z- axes.

Dependencies

To enable this port, select the Angular Velocity (rad/s) parameter.

Data Types: double

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

Dependencies

To enable this port, select the Temperature (℃) parameter.

Data Types: double

Status of acceleration, angular velocity, and temperature measurements, returned as a 1-by-3 vector.

  • 0 - Data read is new

  • 1 - Data read is not new

  • -1 - Corresponding output is not selected

Dependencies

To enable this port, select the Status parameter.

Data Types: int8

Parameters

expand all

Main

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

The peripheral addresses to communicate with the accelerometer and gyroscope peripherals on the LSM6DSO sensor are decided by the state of the SDO/SA0 pin on the STM32 processor. This table provides the peripheral addresses corresponding to the pin and its state.

Pin NamePin StatePeripheral Address
SDO/SA000x6A
10x6B

Select this parameter to enable Acceleration output port.

Select this parameter to enable Angular Velocity output port.

Select this parameter to enable Temperature output port.

Select this parameter to enable Status output port.

Specify how often the block reads data from the LSM6DSO sensor. When you set this parameter to -1, Simulink determines the best sample time for the block based on the block's context within the model. The output sample time is the product of Sample time that you specify.

Advanced

Accelerometer

Select the range for measuring linear acceleration.

Select the rate at which the sensor samples and outputs accelerometer data. This rate also determines the bandwidth of the sensor.

Select the type of composite filter to use in the filtering chain for reading accelerometer values.

Select the bandwidth of the highpass filter in the composite filter used in the filtering chain.

Dependencies

To enable this parameter, select High pass filter in the Select composite filter parameter.

Select the required bandwidth of the lowpass filter in the composite filter used in the filtering chain.

Dependencies

To enable this parameter, select Low pass filter in the Select composite filter parameter.

Gyroscope

Select the range for measuring angular velocity (the range of angular velocity that the sensor needs to measure).

Select the rate at which the sensor samples and outputs gyroscope data. This rate also determines the bandwidth of the sensor.

Enable the highpass filter for reading gyroscope values.

Select the required bandwidth of the highpass filter for reading gyroscope values.

Dependencies

To enable this parameter, select the Enable high pass filter parameter.

Enable the lowpass filter for reading gyroscope values.

Select the required bandwidth mode of the low pass filter for reading gyroscope values.

For Gyroscope ODR > 1666 Hz, only these values are applicable for Low pass filter bandwidth mode: 0, 1, 2, 3.

Dependencies

To enable this parameter, select the Enable low pass filter parameter.

Extended Capabilities

expand all

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

Version History

Introduced in R2025a