Main Content

lSM6DSL IMU Sensor

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

  • library:
  • Simulink Support Package for Arduino Hardware / Sensors

  • block icon for LSM6DSL IMU Sensor

Description

ThelSM6DSL IMU Sensorblock measures linear acceleration and angular rate along the X, Y, and Z axis using the LSM6DSL Inertial Measurement Unit (IMU) sensor interfaced with the Arduino®hardware. This 6-Degree of Freedom (DoF) IMU sensor comprises of an accelerometer and gyroscope used to measure linear acceleration and angular rate, respectively. The block also measures the temperature from the embedded temperature sensor in LSM6DSL Sensor.

You can also use the composite filter option in the block for the accelerometer values, and use the high pass and low pass filter options for 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 an-by-3 vector, wherenis the value specified asSamples per frame. Each value represents the measurement of acceleration inm/s^2along the X, Y, and Z axes.

Dependencies

This output port appears only if you select theAcceleration (m/s2)parameter.

Data Types:double

The block outputs angular velocity as an-by-3 vector, wherenis the value specified asSamples per frame. Each value represents the measurement of angular velocity in radians per second (rad/s) along the X, Y, and Z axes.

Dependencies

This output port appears only if you select theAngular Velocity (rad/s)parameter.

Data Types:double

Temperature (in ℃) measured by LSM6DSL sensor connected to Arduino board.

Dependencies

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

Data Types:double

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

Dependencies

This output port appears only if you select theStatusparameter.

Data Types:int8

Timestamp (in seconds) at which data is read from the sensor, returned asn-by-3 matrix, wherenis the value specified asSamples per frame.

Dependencies

This output port appears only if you select theTimestampparameter.

Data Types:double

Parameters

expand all

Main

The slave addresses to communicate with the accelerometer and gyroscope peripherals on the LSM6DSL sensor are decided by the state of the SDO/SA0 pin on the hardware board. This table provides the slave addresses corresponding to the pin and their state.

Pin Name Pin State Slave Address
SDO/SA0 0 0x6A
1 0x6B

Select this parameter to setAccelerationas one of the output ports.

Select this parameter to setAngular Velocityas one of the output ports.

Select this parameter to setTemperatureas one of the output ports.

Select this parameter to setStatusas one of the output ports.

Select this parameter to setTimestampas one of the output ports.

Specify the number of samples that the block outputs.

The value that you specify here is also used to compute the output sample time:

Output sample time =Samples per frame*Sample time.

Specify how often this block reads the data from the LSM6DSL 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. The output sample time is the product ofSamples per frameandSample timethat you specify.

Advanced

Accelerometer

Select the full scale for measuring linear acceleration (the range of acceleration that the sensor needs to measure).

Select the output data rate at which accelerometer data is sampled, which also determines the bandwidth.

Select the required bandwidth of the low-pass digital filter.

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

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

Dependencies

This parameter appears only if you selectHigh pass filterin theSelect composite filterparameter.

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

Dependencies

This parameter appears only if you selectlow pass filterin theSelect composite filterparameter.

Gyroscope

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

Select the output data rate at which gyroscope data is sampled, which also determines the bandwidth.

Enable the high pass filter for reading gyroscope values.

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

Dependencies

This parameter appears only if you select theEnable high pass filterparameter.

Enable the low pass filter for reading gyroscope values.

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

Dependencies

This parameter appears only if you select theEnable low pass filterparameter.

Version History

Introduced in R2021a