Main Content

LSM303C IMU Sensor

Measure linear acceleration, magnetic field strength, and temperature from LSM303C sensor

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

  • block icon for LSM303 IMU sensor

Description

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

Ports

Output

expand all

Linear acceleration (in m/s2) measured by LSM303C sensor connected to Arduino board, along the x-, y- and z- axes, specified as a row vector [x,y,z].

Dependencies

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

Data Types: double

Magnetic field strength (in µT) measured by LSM303C sensor connected to Arduino board, along the x-, y- and z- axes, specified as a row vector [x,y,z].

Dependencies

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

Data Types: double

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

Dependencies

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

Data Types: double

Status of acceleration value along the three axes, specified as a row vector in the order [z,y,x], to indicate 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 Acceleration Status parameter.

Data Types: Boolean

Status of magnetic field value along the three axes, specified as a row vector in the order [z,y,x], to indicate 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 Magnetic Field Status parameter.

Data Types: double

Parameters

expand all

Main Tab

Select this parameter to set Acceleration 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 Acceleration Status as one of the output ports.

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

Specify how often this block reads the data from the LSM303 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.

Advanced Tab

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 output data rate at which magnetometer data is sampled.

Introduced in R2021a