Main Content

LSM9DS1 IMU Sensor

Measure linear acceleration, angular rate, and magnetic field along X, Y, and Z axis

Since R2020b

Add-On Required: This feature requires the Simulink Support Package for Arduino Hardware add-on.

  • block icon for LSM9DS1 IMU Sensor

Libraries:
Simulink Support Package for Arduino Hardware / Sensors

Description

The LSM9DS1 IMU Sensor block measures linear acceleration, angular rate, and magnetic field along the X, Y, and Z axis using the LSM9DS1 Inertial Measurement Unit (IMU) sensor interfaced with the Arduino® hardware. This 9-Degree of Freedom (DoF) IMU sensor comprises of an accelerometer, gyroscope, and magnetometer used to measure linear acceleration, angular rate, and magnetic field, respectively.

Note

If you are using Arduino Nano 33 BLE Sense hardware, which always includes an embedded sensor, reading data from a breakout board containing LSM9DS1 sensor is not supported.

Ports

Output

expand all

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

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

Dependencies

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

Data Types: double

The block outputs velocity as a n-by-3 vector, where n is the value specified as Samples per frame. Each value represents the measurement of angular velocity in degrees per second (dps) along the X, Y, and Z axes.

Dependencies

This output port appears only if you select the Angular rate parameter.

Data Types: double

The block outputs magnetic field as a n-by-3 vector, where n is the value specified as Samples per frame. Each value represents the measurement of magnetic field in micro Tesla (µT) along the X, Y, and Z axes.

Dependencies

This output port appears only if you select the Magnetic field parameter.

Data Types: double

Timestamp (in seconds) at which data is read from the sensor, returned as n-by-1 matrix, where n is the value specified as Samples per frame.

Dependencies

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

Data Types: double

Parameters

expand all

Specify the I2C module on the Arduino hardware to communicate with sensor peripherals. For more information on the Arduino pin mapping and modules that hardware boards support, see Pin Mapping for Arduino Timer Independent Blocks.

The peripheral addresses to communicate with the accelerometer, gyroscope, and magnetometer peripherals on the LSM9DS1 sensor are decided by the state of the SDA_M and SDA_AG pins on the hardware board. This table provides the peripheral addresses corresponding to the pins and their state.

Pin NamePin StatePeripheral Address
SDA_M (Magnetometer)00x1C
10x1E
SDA_AG (Accelerometer and Gyroscope)00x6A
10x6B

Data Types: uint8

Select sensor outputs

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

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

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

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

Advanced sensor settings (optional)

Select the rate at which you want the accelerometer to measure the acceleration.

Select the required sensitivity for measurement of acceleration. This parameter specifies the upper and lower limits of what the sensor can measure. In general, for all sensors, you get a more precise measurement with a low full-scale range.

Set the bandwidth for the low-pass filter associated with the measurement of acceleration.

Refer to the LSM9DS1 Sensor data sheet for further information.

Select the rate at which you want the gyroscope to measure the angular velocity.

Select the required sensitivity for measurement of angular velocity. This parameter specifies the upper and lower limits of what the sensor can measure. In general, for all the sensors, you get a more precise measurement from a sensor with a low full-scale range.

Select the desired bandwidth mode to set the cutoff frequency for the low-pass filter associated with the gyroscope. Refer to this table for information regarding the cutoff frequencies.

Output Data Rate (ODR) and Bandwidth Configuration Setting After Low-Pass Filter 2 (LPF2)

Bandwidth ModeODR (Hz)Cutoff (Hz)
014.9NA
114.9NA
214.9NA
314.9NA
059.516
159.516
259.516
359.516
011914
111931
211931
311931
023814
123829
223863
323878
047621
147628
247657
3476100
095233
195240
295258
3952100

Select this option to enable the high-pass filter for the gyroscope.

Select the high-pass filter mode to set the desired cutoff frequencies for the high-pass filter. Refer to this table given to select the desired cutoff frequency.

Gyroscope High Pass Filter Cutoff Frequency Configuration (Hz)

HPF ModeODR=14.9 HzODR=59.5 HzODR=119 HzODR=238 HzODR=476 HzODR=952 Hz
0148153057
10.52481530
20.2124815
30.10.51248
40.050.20.5124
50.020.10.20.512
60.010.050.10.20.51
70.0050.020.050.10.20.5
80.0020.010.020.0050.10.2
90.0010.0050.010.0020.0050.1

Refer to the LSM9DS1 Sensor data sheet for further information.

Select the required rate at which you want the Magnetometer to measure the magnetic field.

Select the required sensitivity for measurement of magnetic field. This parameter specifies the upper and lower limits of what the sensor can measure. In general, for all the sensors, you get a more precise measurement with a low full-scale range.

Select this parameter to set Timestamp as 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 * Sample time.

Enter the time interval in seconds at which the block reads values from the active sensors. The output sample time is the product of Samples per frame and Sample time that you specify.

Version History

Introduced in R2020b

See Also

External Websites