Main Content

BMI160

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

Since R2022b

Add-On Required: This feature requires the MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms add-on.

  • NVIDIA BMI160 sensor block

Libraries:
NVIDIA Jetson and NVIDIA DRIVE / Sensors / IMU sensors

Description

The BMI160 block outputs the values of linear acceleration and angular rate along X, Y, and Z axes as measured by the BMI160 sensor connected to an NVIDIA® embedded board. The block also outputs the temperature as read by the BMI160 sensor. If you connect the BMM150 as a secondary sensor to BMI160, the BMI160 block also outputs magnetic field along X, Y, and Z axes as measured by the BMM150 sensor.

The block supports single tap, double tap, high-g detection, any-motion, slow-motion, flat detection, and data ready interrupts.

Interrupt source output is a 1-by-7 vector with elements corresponding to the source of single tap, double tap, high-g detection, any-motion, slow-motion, flat detection, and data ready interrupts respectively. 1 indicates that it is the source, 0 indicates that it is not a source, and -1 indicates that the interrupt is not active.

Tap source output is a 1-by-4 vector, with the first three elements indicating whether the single tap/double tap occurred in X, Y and Z axis, and the fourth element indicating whether it is on positive or negative direction of the axis. High-g source output is a 1-by-4 vector, with the first three elements indicating whether the high-g interrupt occurred in X,Y and Z axis and the fourth element indicating whether it is on positive or negative direction of the axis. Any-motion source output is a 1-by-4 vector which shows on which of the X,Y and Z axis did the any-motion interrupt occur and whether it is on positive or negative direction of the axis. First byte denotes whether the event occurred on X axis, second byte denotes whether the event occurred on Y axis, third byte denotes whether the event occurred on Z axis and fourth byte denotes the direction. For direction byte 0 denotes negative side and 1 denotes positive and for other bytes 1 denotes that axis is the source and 0 denotes that axis is not the source.

When interrupts are enabled use external interrupt block and develop respective function call subsystem.

Ports

Output

expand all

Linear acceleration (in m/s2) measured by BMI160 sensor connected to an NVIDIA embedded board, along the X, Y, and Z axes. The block specifies linear acceleration as a 1-by-3 vector.

Dependencies

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

Data Types: double

Angular rate (in rad/s) measured by BMI160 sensor connected to an NVIDIA embedded board, along the X, Y, and Z axes. The block outputs angular rate as a 1-by-3 vector.

Dependencies

This output port appears only if you select the Angular rate (rad/s) parameter.

Data Types: double

Magnetic field strength in micro Tesla (µT) measured by a BMM150 sensor connected to an NVIDIA embedded board, along the X, Y, and Z axes. The block outputs the magnetic field as a 1-by-3 vector.

Dependencies

This output port appears only if you select the Magnetic Field (µT) parameter.

Data Types: double

Temperature (in ℃) measured by BMI160 sensor connected to an NVIDIA embedded board.

Dependencies

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

Data Types: double

Status of acceleration measurement. 0 indicates that the data read is new and 1 indicates that the data read is not new.

Dependencies

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

Data Types: int8

Status of angular rate measurement. 0 indicates that the data read is new and 1 indicates that the data read is not new.

Dependencies

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

Data Types: int8

Status of magnetic field reading. 0 indicates that the data read is new and 1 indicates that the data read is not new.

Dependencies

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

Data Types: int8

Interrupt source is a 1-by-7 vector which represents single tap, double tap, high-g detection, any-motion, slow-motion, flat detection, and data ready interrupts.

Status of interrupt source. A 1 indicates that the interrupt is enabled and it is the source of the generated interrupt. A 0 indicates that the interrupt is enabled but it is not the source of the generated interrupt. A -1 indicates that the interrupt is not enabled.

Dependencies

This output port appears only if you select one of these parameters.

  • Single tap

  • Double tap

  • High g detection

  • Any motion

  • Flat detection

  • Data ready

Data Types: double

Tap event source is a 1-by-4 vector which represents Single tap or Double tap interrupt. The first three elements indicates if the interrupt occurred in X, Y, and Z axis, and the fourth element indicates if it is on positive or negative direction of the axis. For direction, byte 0 denotes negative side, 1 denotes positive side and for other bytes 1 denotes that axis is the source and 0 denotes that axis is not the source.

Dependencies

This output port appears only if you select the Interrupt source parameter.

Data Types: int8

High g event source is a 1-by-4 vector which represents High g interrupt. The first three elements indicates if the interrupt occurred in X, Y, and Z axis, and the fourth element indicates if it is on positive or negative direction of the axis. For direction, byte 0 denotes negative side, 1 denotes positive side and for other bytes 1 denotes that axis is the source and 0 denotes that axis is not the source.

Dependencies

This output port appears only if you select the Interrupt source parameter.

Data Types: int8

Any motion event Source is a 1-by-4 vector which represents any-motion interrupt. The first three elements indicates if the interrupt occurred in X, Y, and Z axis, and the fourth element indicates if it is on positive or negative direction of the axis. For direction, byte 0 denotes negative side, 1 denotes positive side and for other bytes 1 denotes that axis is the source and 0 denotes that axis is not the source.

Dependencies

This output port appears only if you select the Interrupt source parameter.

Data Types: int8

Parameters

expand all

The I2C module to be used for communication to the BMI160 sensor. The number of I2C modules supported varies across different NVIDIA embedded boards.

Programmatic Use

Block Parameter: I2CModule
Type: character vector
Values: ''|positive integer
Default: ''

The I2C address used by BMI160 sensor communicating with the NVIDIA embedded board. The default parameter value (0x68) corresponds to the I2C address used by the BOOSTXL-SENSORS BoosterPack™ Plug-in Module.

Programmatic Use

Block Parameter: I2CAddress
Type: character vector
Values: '0x68'|'0x69'
Default: '0x68'

The I2C address used by BMM150 sensor connected as a secondary sensor to BMI160 sensor.

Programmatic Use

Block Parameter: MagentometerI2CAddress
Type: character vector
Values: '0x10'|'0x11'|'0x12'|'0x13'
Default: '0x10'
Select outputs

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

Programmatic Use

Block Parameter: isActiveAccel
Type: character vector
Values: 'on' | 'off'
Default: 'on'

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

Programmatic Use

Block Parameter: isActiveGyro
Type: character vector
Values: 'on' | 'off'
Default: 'on'

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

Programmatic Use

Block Parameter: isActiveMag
Type: character vector
Values: 'on' | 'off'
Default: 'on'

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

Programmatic Use

Block Parameter: isActiveTemperature
Type: character vector
Values: 'on' | 'off'
Default: 'off'

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

Programmatic Use

Block Parameter: isAccelStatus
Type: character vector
Values: 'on' | 'off'
Default: 'off'

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

Programmatic Use

Block Parameter: isGyroStatus
Type: character vector
Values: 'on' | 'off'
Default: 'off'

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

Programmatic Use

Block Parameter: isMagStatus
Type: character vector
Values: 'on' | 'off'
Default: 'off'

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

Dependencies

This parameter appears only if you select one of these Generate interrupts on parameters.

  • Single tap

  • Double tap

  • High g detection

  • Any motion

  • Flat detection

  • Data ready

Programmatic Use

Block Parameter: isIntSource
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Select this parameter to set Tap event source as one of the output ports.

Dependencies

This parameter appears only if you select the Single tap or Double tap parameter from Generate interrupts on and Interrupt source parameter from Select outputs.

Programmatic Use

Block Parameter: isTapEventSource
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Select this parameter to set High g event source as one of the output ports.

Dependencies

This parameter appears only if you select the High g detection parameter from Generate interrupts on and Interrupt source parameter from Select outputs.

Programmatic Use

Block Parameter: isHighGEventSource
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Select this parameter to set Any motion event source as one of the output ports.

Dependencies

This parameter appears only if you select the Any motion parameter from Generate interrupts on and Interrupt source parameter from Select outputs.

Programmatic Use

Block Parameter: isAnyMotionGEventSource
Type: character vector
Values: 'on' | 'off'
Default: 'off'
Accelerometer Settings

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

Programmatic Use

Block Parameter: AccelerationRange
Type: character vector
Values: '±2g'|'±4g'|'±8g'|'±16g'
Default: '±2g'

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

Programmatic Use

Block Parameter: AccelerometerODR
Type: character vector
Values: '12.5 Hz'|'25 Hz'|'50 Hz'|'100 Hz'|'200 Hz'|'400 Hz'|'800 Hz'|'1600 Hz'
Default: '12.5 Hz'

Select this option to enable the low-pass filter for the acceleration values read from BMI160 sensor.

Programmatic Use

Block Parameter: isEnableAccelLowPassFilter
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Select the filter mode for low pass filter for accelerometer values. The 3dB Cutoff frequency of the accelerometer depends on the value of this parameter and the ODR that you selected using the Accelerometer output data rate parameter.

Dependencies

This parameter appears only if you select Enable low pass filter from Accelerometer settings.

Programmatic Use

Block Parameter: AccelerometerFilterMode
Type: character vector
Values: 'Normal'|'OSR2'|'OSR4'
Default: 'Normal'
Gyroscope settings

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

Programmatic Use

Block Parameter: GyroscopeRange
Type: character vector
Values: '125 dps'|'250 dps'|'500 dps'|'1000 dps'|'2000 dps'
Default: '125 dps'

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

Programmatic Use

Block Parameter: GyroscopeODR
Type: character vector
Values: '25 Hz'|'50 Hz'|'100 Hz'|'200 Hz'|'400 Hz'|'800 Hz'|'1600 Hz'|'3200 Hz'
Default: '25 Hz'

Select this option to enable the low-pass filter for the angular rate values read from BMI160 sensor.

Programmatic Use

Block Parameter: isEnableGyroLowPassFilter
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Select the filter mode for low pass filter for gyroscope values. The 3dB Cutoff frequency of the gyroscope depends on the value of this parameter and the ODR that you selected using the Gyroscope output data rate parameter.

Dependencies

This parameter appears only if you select Enable low pass filter from Gyroscope settings.

Programmatic Use

Block Parameter: GyroscopeFilterMode
Type: character vector
Values: 'Normal'|'OSR2'|'OSR4'
Default: 'Normal'
Magnetometer settings

Select the output data rate at which magnetometer data is sampled.

Programmatic Use

Block Parameter: MagnetometerODR
Type: character vector
Values: '0.78125 Hz'|'1.5625 Hz'|'3.125 Hz'|'6.25 Hz'|'12.5 Hz'|'25 Hz'|'50 Hz'|'100 Hz'|'200 Hz'|'400 Hz'|'800 Hz'
Default: '25 Hz'

Note

Selecting one of these parameters (Single tap, Double tap, High g detection, Any motion, Slow motion, Flat detection, Data ready) overrides the availability of other status values at the output. The selection of parameters for other status outputs (Acceleration status, Angular rate status, and Magnetic field status) is disabled.

Generate interrupts on

If this option is selected, an interrupt is generated on pin INT1 or INT2 of the sensor when single tap is triggered and following conditions are valid.

  • The tap occurs during the Shock Time threshold.

  • A tap does not occur during the Quiet Time threshold.

Programmatic Use

Block Parameter: isSingleTap
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Select the quiet time threshold for generating single tap or double tap interrupt. The tap must not occur during the specified quiet time threshold for generating single tap or double tap interrupt.

Dependencies

This parameter appears only if you select the Single tap parameter or Double tap parameter.

Programmatic Use

Block Parameter: SingleTapQuietTimeThreshold
Type: character vector
Values: '20 ms' | '30 ms'
Default: '30 ms'

Select the shock time threshold for single tap or double tap interrupt. The tap must occur during the specified shock time threshold for generating single tap or double tap interrupt.

Dependencies

This parameter appears only if you select Single tap parameter or Double tap parameter.

Programmatic Use

Block Parameter: SingleTapShockTimeThreshold
Type: character vector
Values: '50 ms' | '75 ms'
Default: '50 ms'

Specify the amplitude threshold value within the range identified in the table for detecting a single tap or double tap. When the value crosses the specified amplitude threshold value, a tap occurs. Amplitude threshold has minimum and maximum range which depends on the accelerometer range.

Accelerometer RangeAmplitude Threshold MinimumAmplitude Threshold Maximum
'±2g'0.03125g1.96875g
'±4g'0.0625g3.9375g
'±8g'0.125g7.875g
'±16g'0.25g15.75g

Dependencies

This parameter appears only if you select the Single tap parameter or Double tap parameter.

Programmatic Use

Block Parameter: SingleTapAmplitudeThreshold2G|SingleTapAmplitudeThreshold4G|SingleTapAmplitudeThreshold8G|SingleTapAmplitudeThreshold16G
Type: character vector
Values: '0.1' | valid positive scalar
Default: '0.1'

Select the pin on which the single tap interrupt, which can be used by the NVIDIA board, gets generated on the sensor.

Dependencies

This parameter appears only if you select the Single tap parameter.

Programmatic Use

Block Parameter: InterruptPinSingleTap
Type: character vector
Values: 'INT1' | 'INT2'
Default: 'INT1'

If this option is selected, an interrupt is generated on pin INT1 or INT2 of the sensor when double tap is triggered and following conditions are valid.

  • The first tap occurs during the Shock Time threshold.

  • A tap does not occur during the Quiet Time threshold.

  • The second tap occurs during the Duration Time threshold.

Programmatic Use

Block Parameter: isDoubleTap
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Select the duration time threshold for double tap interrupt. The second tap must occur during the specified duration time threshold for generating double tap interrupt.

Dependencies

This parameter appears only if you select Double tap parameter.

Programmatic Use

Block Parameter: DoubleTapDurationTimeThreshold
Type: character vector
Values: '50 ms' | '100 ms'| '150 ms'| '200 ms'| '250 ms'| '375 ms'| '500 ms'| '700 ms'
Default: '50 ms'

Select the pin on which the double tap interrupt, which can be used by the NVIDIA board, gets generated on the sensor.

Dependencies

This parameter appears only if you select the Double tap parameter.

Programmatic Use

Block Parameter: InterruptPinDoubleTap
Type: character vector
Values: 'INT1' | 'INT2'
Default: 'INT1'

If this option is selected, an interrupt is generated on pin INT1 or INT2 of the sensor when high g interrupt is detected.

Programmatic Use

Block Parameter: isHighGDetection
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Specify the time threshold value ranging from 2.5 ms to 640 ms for high g interrupt. The high g detection must occur during the specified time threshold for generating high g interrupt.

Dependencies

This parameter appears only if you select High g detection parameter.

Programmatic Use

Block Parameter: HighGTimeThreshold
Type: character vector
Values: '2.5' to '640'
Default: '2.5'

Specify the amplitude threshold value within the range identified in the table for detecting a high g interrupt. When the value crosses the specified amplitude threshold value, high g interrupt is detected. Amplitude threshold has minimum and maximum range which depends on the accelerometer range.

Accelerometer RangeAmplitude Threshold MinimumAmplitude Threshold Maximum
'±2g'0.00391g1.99546g
'±4g'0.00781g3.99346g
'±8g'0.01563g7.98438g
'±16g'0.03125g15.96875g

Dependencies

This parameter appears only if you select the High g detection parameter.

Programmatic Use

Block Parameter: HighGAmplitudeThreshold2G|HighGAmplitudeThreshold4G|HighGAmplitudeThreshold8G|HighGAmplitudeThreshold16G
Type: character vector
Values: '0.1' | valid positive scalar
Default: '0.1'

Select the pin on which the high g interrupt, which can be used by the NVIDIA board, gets generated on the sensor.

Dependencies

This parameter appears only if you select the High g detection parameter.

Programmatic Use

Block Parameter: InterruptPinHighG
Type: character vector
Values: 'INT1' | 'INT2'
Default: 'INT1'

If this option is selected, an interrupt is generated on pin INT1 or INT2 of the sensor when any-motion interrupt is detected.

Programmatic Use

Block Parameter: isAnyMotion
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Select the time threshold value for any-motion interrupt. The any-motion detection must occur during the specified time threshold.

Dependencies

This parameter appears only if you select Any motion parameter.

Programmatic Use

Block Parameter: AnyMotionTimeThreshold
Type: character vector
Values: '1' | '2'| '3'| '4'
Default: '1'

Specify the amplitude threshold value within the range identified in the table for detecting any-motion interrupt. When the value crosses the specified amplitude threshold value, any-motion interrupt is detected. Amplitude threshold has minimum and maximum range which depends on the accelerometer range.

Accelerometer RangeAmplitude Threshold MinimumAmplitude Threshold Maximum
'±2g'0.0195g0.999g
'±4g'0.00391g1.99546g
'±8g'0.00781g3.99346g
'±16g'0.01563g7.98438g

Dependencies

This parameter appears only if you select Any motion parameter.

Programmatic Use

Block Parameter: AnyMotionAmplitudeThreshold2G|AnyMotionAmplitudeThreshold4G|AnyMotionAmplitudeThreshold8G|AnyMotionAmplitudeThreshold16G
Type: character vector
Values: '0.1' | valid positive scalar
Default: '0.1'

Select the pin on which the any-motion interrupt, which can be used by the NVIDIA board, gets generated on the sensor.

Dependencies

This parameter appears only if you select the Any motion parameter.

Programmatic Use

Block Parameter: InterruptPinAnyMotion
Type: character vector
Values: 'INT1' | 'INT2'
Default: 'INT1'

If this option is selected, an interrupt is generated on pin INT1 or INT2 of the sensor when slow motion interrupt is detected.

Programmatic Use

Block Parameter: isSlowMotion
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Select the time threshold value for slow motion interrupt. The slow motion detection must occur during the specified time threshold.

Dependencies

This parameter appears only if you select Slow motion parameter.

Programmatic Use

Block Parameter: SlowMotionTimeThreshold
Type: character vector
Values: '1' | '2'| '3'| '4'
Default: '1'

Specify the amplitude threshold value within the range identified in the table for detecting slow motion interrupt. When the value crosses the specified amplitude threshold value, slow motion interrupt is detected.

Accelerometer RangeAmplitude Threshold MinimumAmplitude Threshold Maximum
'±2g'0.0195g0.999g
'±4g'0.00391g1.99546g
'±8g'0.00781g3.99346g
'±16g'0.01563g7.98438g

Dependencies

This parameter appears only if you select Slow motion parameter.

Programmatic Use

Block Parameter: SlowMotionAmplitudeThreshold2G|SlowMotionAmplitudeThreshold4G|SlowMotionAmplitudeThreshold8G|SlowMotionAmplitudeThreshold16G
Type: character vector
Values: '0.1' | valid positive scalar
Default: '0.1'

Select the pin on which the slow motion interrupt, which can be used by the NVIDIA board, gets generated on the sensor.

Dependencies

This parameter appears only if you select the Slow motion parameter.

Programmatic Use

Block Parameter: InterruptPinSlowMotion
Type: character vector
Values: 'INT1' | 'INT2'
Default: 'INT1'

If this option is selected, an interrupt is generated on pin INT1 or INT2 of the sensor when flat detection interrupt is detected.

Programmatic Use

Block Parameter: isFlatDetection
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Specify the amplitude threshold value ranging from 0.7° - 44.8° for detecting flat detection interrupt. When the value crosses the specified amplitude threshold value, flat detection interrupt is detected.

Dependencies

This parameter appears only if you select Flat detection parameter.

Programmatic Use

Block Parameter: FlatThetaThreshold
Type: character vector
Values: '0.7' to '44.8'
Default: '5'

Select the time threshold value for flat detection interrupt. The flat detection interrupt must occur during the specified time threshold.

Dependencies

This parameter appears only if you select Flat detection parameter.

Programmatic Use

Block Parameter: FlatTimeThreshold
Type: character vector
Values: '0' | '640'| '1280'| '2560'
Default: '640'

Select the pin on which the flat detection interrupt, which can be used by the NVIDIA board, gets generated on the sensor.

Dependencies

This parameter appears only if you select the Flat detection parameter.

Programmatic Use

Block Parameter: InterruptPinFlat
Type: character vector
Values: 'INT1' | 'INT2'
Default: 'INT1'

If this option is selected, an interrupt is generated on pin INT1 or INT2 of the sensor when data is ready, allowing you to trigger other subsystems to perform an action.

Programmatic Use

Block Parameter: isDataReady
Type: character vector
Values: 'on' | 'off'
Default: 'off'

Select the pin on which the data ready interrupt, which can be used by the NVIDIA board, gets generated on the sensor.

Dependencies

This parameter appears only if you select the Enable data ready interrupt parameter.

Programmatic Use

Block Parameter: InterruptPinDataReady
Type: character vector
Values: 'INT1' | 'INT2'
Default: 'INT1'

Specify the output data type for the values read from BMI160 sensor. The default data type for NVIDIA board is single. Use this parameter to change the values to double, if required.

Programmatic Use

Block Parameter: DataType
Type: character vector
Values: 'single' | 'double'
Default: 'single'

Specify how often this block reads the data from the BMI160 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
Type: character vector
Values: scalar | vector
Default: '0.1'

Version History

Introduced in R2022b