LSM6DSO IMU Sensor
Measure linear acceleration, angular rate, and temperature from LSM6DSO sensor
Since R2025a
Libraries:
STM32 Microcontroller Blockset /
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 sensor.
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.
Examples
Get Started with STMicroelectronics STM32 Processor Based Boards
Run a Simulink model on STM32 processor.
Ports
Output
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 new1- Data read is not new-1- Corresponding output is not selected
Dependencies
To enable this port, select the Status parameter.
Data Types: int8
Parameters
Main
Specify the I2C module on the STM32 Processor to communicate with sensor peripherals.
Programmatic Use
Block Parameter:
I2CModule |
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 Name | Pin State | Peripheral Address |
|---|---|---|
| SDO/SA0 | 0 | 0x6A |
| 1 | 0x6B |
Programmatic Use
Block Parameter:
I2CAddress |
Select this parameter to enable Acceleration output port.
Programmatic Use
Block Parameter:
IsActiveAcceleration |
Select this parameter to enable Angular Velocity output port.
Programmatic Use
Block Parameter:
IsActiveAngularRate |
Select this parameter to enable Temperature output port.
Programmatic Use
Block Parameter:
IsActiveTemperature |
Select this parameter to enable Status output port.
Programmatic Use
Block Parameter:
IsActiveStatus |
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.
Programmatic Use
Block Parameter:
SampleTime |
Advanced
Accelerometer
Select the range for measuring linear acceleration.
Programmatic Use
Block Parameter:
AccelerometerRange |
Select the rate at which the sensor samples and outputs accelerometer data. This rate also determines the bandwidth of the sensor.
Programmatic Use
Block Parameter:
GyroscopeODR |
Select the type of composite filter to use in the filtering chain for reading accelerometer values.
Programmatic Use
Block Parameter:
AccelSelectCompositeFilter |
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.
Programmatic Use
Block Parameter:
GyroHPFBW |
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.
Programmatic Use
Block Parameter:
AccelLPF2BW |
Gyroscope
Select the range for measuring angular velocity (the range of angular velocity that the sensor needs to measure).
Programmatic Use
Block Parameter:
AccelerometerRange |
Select the rate at which the sensor samples and outputs gyroscope data. This rate also determines the bandwidth of the sensor.
Programmatic Use
Block Parameter:
GyroscopeODR |
Enable the highpass filter for reading gyroscope values.
Programmatic Use
Block Parameter:
EnableGyroHPF |
Select the required bandwidth of the highpass filter for reading gyroscope values.
Dependencies
To enable this parameter, select the Enable high pass filter parameter.
Programmatic Use
Block Parameter:
GyroHPFBW |
Enable the lowpass filter for reading gyroscope values.
Programmatic Use
Block Parameter:
EnableGyroLPF |
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.
Programmatic Use
Block Parameter:
GyroLPFBMode |
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2025a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
