Main Content

ICM20948 IMU Sensor

Measure linear acceleration, angular velocity, magnetic field, and temperature from ICM20948 IMU sensor

Since R2022a

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

  • block icon for ICM20948 IMU sensor

Libraries:
Simulink Support Package for Arduino Hardware / Sensors

Description

The ICM20948 IMU Sensor block outputs the values of linear acceleration, angular velocity, and magnetic field strength along x-, y- and z- axes as measured by the ICM20948 IMU sensor connected to Arduino board. The block also outputs the temperature as read by the ICM20948 IMU sensor.

Examples

Ports

Output

expand all

The Acceleration port outputs acceleration in m/s2 along the x-, y-, and z- axes of the sensor as a n-by-3 vector, where n is the value specified as Samples per frame.

Dependencies

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

Data Types: single (default) | double

The Angular Rate port outputs angular velocity in radians per second (rad/s) along the x-, y-, and z- axes of the sensor as a n-by-3 vector, where n is the value specified as Samples per frame.

Dependencies

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

Data Types: single (default) | double

The Magnetic Field port outputs Magnetic field strength in µT along the x-, y-, and z- axes of the sensor as a n-by-3 vector, where n is the value specified as Samples per frame.

Dependencies

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

Data Types: single (default) | double

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

Dependencies

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

Data Types: single | double

Status of acceleration value, angular rate, magnetometer measurement, and temperature along the three axes, specified as a [1X2] vector of uint8 values. First element represents status of acceleration, angular rate, and temperature measurements and second element represents status of magnetometer measurements. Status indicates if the data read is the new value or not. 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 Status parameter.

Note

Status parameter will not be available if you select Generate data ready interrupt parameter.

Data Types: uint8

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.

The data type of Timestamp output depends on the value that you selected for the Output data type parameter.

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 I2C address of the ICM20948 IMU sensor from which the block reads the values. The ICM20948 sensor can have two I2C addresses depending on the logic level on pin AD0 of the sensor.

Pin NamePin StateI2C Address
AD0Low0x68
High0x69

If this option is selected, an interrupt is generated on pin INT1 of the sensor when data is ready. Using this option, you can trigger other subsystems to perform any action. For more information, see Estimate Orientation Using AHRS Filter and IMU Data in Simulink

Select the logic level for INT1 pin as Active high or Active low.

Dependencies

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

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 Temperature as one of the output ports.

Select this parameter to set Status as one of the output ports. This parameter will not be available if Generate data ready interrupt parameter is selected.

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

Specify the datatype for acceleration, angular rate, magnetic field, and temperature outputs.

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 ICM20948 IMU 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 of Samples per frame and Sample time that you specify.

Accelerometer Settings

Select the range of acceleration that the accelerometer can measure.

Enter the output data rate between 0.3 Hz to 1125 Hz, at which accelerometer data is sampled.

Accelerometer data output rate in Hz is determined by the following calculation.

1125/(1+ACCEL_SMPLRT_DIV)Hz, where ACCEL_SMPLRT_DIV is 0,1,2,...4095.

Depending on the output data rate specified on the block mask, ACCEL_SMPLRT_DIV will be set on the sensor.

Specify the 3 dB bandwidth of accelerometer low pass filter.

Gyroscope Settings

Specify the maximum angular velocity that the gyroscope can measure per second.

Enter the output data rate between 4.4 Hz to 1125 Hz, at which gyroscope data is sampled.

Gyroscope data output rate in Hz is determined by the following calculation.

1125/(1+GYRO_SMPLRT_DIV)Hz, where GYRO_SMPLRT_DIV is 0,1,2,...255.

Depending on the output data rate specified on the block mask, GYRO_SMPLRT_DIV will be set on the sensor.

Specify the 3 dB bandwidth of gyroscope low pass filter.

Magnetometer Settings

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

Temperature sensor Settings

Specify the noise bandwidth (NBW) of temperature low pass filter in Hz.

Version History

Introduced in R2022a