Main Content

BNO055 IMU Sensor

Measure acceleration, angular rate, and magnetic field, and calculate fusion values such as Euler angles, quaternion, linear acceleration, and gravity vector along the axes of BNO055 sensor

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

Description

The BNO055 IMU Sensor block reads data from the BNO055 IMU sensor that is connected to the hardware. The block has two operation modes: Non-Fusion and Fusion.

The block outputs acceleration, angular rate, and strength of the magnetic field along the axes of the sensor in Non-Fusion and Fusion mode. In Fusion mode, the block also outputs the the orientation of the sensor as an Euler angle or quaternion, as well as the linear acceleration, gravity vectors, and calibration status of the sensor. The values emitted in the Non-Fusion mode are raw values, whereas the values emitted in the Fusion mode are calibrated values. The block outputs all the values except for quaternion and calibration status as a 3-by-1 array of double data type. The quaternion is a 4-by-1 array of double data type, and the calibration status is a 4-by-1 array of int8 data type.

This illustration shows the default orientation of the x-, y-, and z- axes of the BNO055 sensor.

If you simulate a model that contains the BNO055 IMU Sensor block without connecting the hardware, the block outputs zeros. For more information, see Block Produces Zeros or Does Nothing in Simulation.

Ports

Output

expand all

The Accel port outputs acceleration along the x, y, and z axes of the sensor as a 3-by-1 vector. In Fusion mode, the elements of the vector represent calibrated values, whereas in Non-Fusion mode, the elements represent raw values. The acceleration is measured in m/s2 and also includes acceleration due to gravity.

Dependencies

The Accel port is available only when you select the Acceleration (m/s^2) parameter.

Data Types: double

The Ang rate port outputs the angle of rotation per second along the x-, y-, and z- axes of the sensor as a 3-by-1 vector. In Fusion mode, the elements of the vector represent calibrated values, whereas in Non-Fusion mode, the elements represent raw values. The angular rate is measured in dps.

Dependencies

The Ang rate port is available only when you select the Angular rate (dps) parameter.

Data Types: double

The Mag field port outputs the strength of the magnetic field along the x-, y-, and z- axes of the sensor as a 3-by-1 vector. In Fusion mode, the elements of the vector represent calibrated values, whereas in Non-Fusion mode, the elements represent raw values. The magnetic strength is measured in μT.

Dependencies

The Mag field port is available only when you select the Magnetic field (μT) parameter.

Data Types: double

The Euler port outputs the orientation along the axes of the sensor as a 3-by-1 vector. The elements of the vector represent the orientation using three angular quantities – azimuth (rotation around z- axis), roll (rotation around y- axis), and pitch (rotation around x- axis) of the sensor.

Angular QuantityDescriptionRange in Degrees
AzimuthAngle between y- axis of the sensor and magnetic north[0, 360]
RollAngle between z- axis and x- axis of the sensor[−90, 90]
PitchAngle between z- axis and y- axis of the sensor[−180, 180]

Dependencies

The Euler port is available only when you set the Operation mode to Fusion and select the Euler angles (degrees) parameter.

Data Types: double

The Quat port outputs the orientation along the w-, x-, y-, and z- axes of the sensor as a 4-by-1 vector. The orientation is measured in quaternion.

Dependencies

The Quat port is available only when you set the Operation mode to Fusion and select the Quaternion (quaternion) parameter.

Data Types: double

The Lin accel port outputs linear acceleration along the x-, y-, and z- axes of the sensor as a 3-by-1 vector. The acceleration is measured in m/s2 and does not include acceleration due to gravity.

Dependencies

The Lin accel port is available only when you set the Operation mode to Fusion and select the Linear acceleration (m/s^2) parameter.

Data Types: double

The Gravity port outputs acceleration due to gravity along the x-, y-, and z- axes of the sensor as a 3-by-1 vector. The acceleration due to gravity is measured in m/s2.

Dependencies

The Gravity port is available only when you set the Operation mode to Fusion and select the Gravity vector (m/s^2) parameter.

Data Types: double

The Status port outputs the calibration status of the overall system and the sensors (gyroscope, accelerometer, and magnetometer) located inside the BNO055 sensor as a 4-by-1 vector.

This table shows what each element values in the vector indicate about the sensor calibration status.

ValueCalibration Status
0Uncalibrated
1 and 2Partially calibrated
3Fully calibrated

A partially calibrated sensor with a calibration status of 2 provides more accurate readings than the sensor with a calibration status of 1. To fully calibrate any of these sensors, see Calibrate Gyroscope, Calibrate Accelerometer, and Calibrate Magnetometer.

Note

If the Status port outputs an array with all the elements having a value of -1, ensure that the sensor is properly connected to the hardware and the value of the I2C address parameter is correct.

Dependencies

The Status port is available only when you set the Operation mode to Fusion.

Data Types: int8

Parameters

expand all

Select the I2C address of the sensor from which the block read values.

  • Fusion — When you set Operation mode to Fusion, the sensor operates in 9 degrees of freedom (NDOF) mode. The block outputs calibrated values from the sensor.

    This table lists the block output, measurement unit, dimension, and the axes of the sensor along which each of these outputs are measured.

    OutputUnitDimensionAxes
    AccelerationMeter per second squared (m/s2)3-by-1x, y, and z
    Angular rateMeter per second squared (m/s2)3-by-1x, y, and z
    Magnetic fieldmicrotesla (μT)3-by-1x, y, and z
    Euler anglesdegrees per second (dps)3-by-1x, y, and z
    QuaternionsQuaternion units4-by-1w, x, y, and z
    Linear accelerationMeter per second squared (m/s2)3-by-1x, y, and z
    Gravity vectorMeter per second squared (m/s2)3-by-1x, y, and z

    Note

    In Fusion mode, an internal fusion algorithm configures the range and bandwidth of the sensor with some values. These values cannot be modified.

  • Non-Fusion — When you set Operation mode to Non-Fusion, the sensor operates in Accelerometer Magnetometer Gyroscope (AMG) mode. The block outputs raw values from the sensor.

    This table lists the block output, measurement unit, dimension, and the axes of the sensor along which each of these outputs are measured in Non-Fusion mode.

    OutputUnitDimensionAxes
    AccelerationMeter per second squared (m/s2)3-by-1x, y, and z
    Angular rateMeter per second squared (m/s2)3-by-1x, y, and z
    Magnetic fieldmicrotesla (μT)3-by-1x, y, and z

Specify how often the block read values from the sensor, in seconds. When you specify this parameter as -1, Simulink® determines the best sample time for the block based on the block context within the model.

Select Outputs

When you select the Acceleration (m/s^2) parameter, the Accel port becomes available. For more information on the Accel port, see Accel.

When you select the Angular rate (dps) parameter, the Ang rate port becomes available. For more information on the Ang rate port, see Ang rate.

When you select the Magnetic field (μT) parameter, the Mag field port becomes available. For more information on the Mag field port, see Mag field.

Data Types: double

When you select the Euler angles (degrees) parameter, the Euler port becomes available. For more information on the Euler port, see Euler.

Dependencies

The Euler angles (degrees) parameter is available only when you set the Operation mode to Fusion.

When you select the Quaternion (quaternion) parameter, the Quat port becomes available. For more information on the Quat port, see Quat.

Dependencies

The Quaternion (quaternion) parameter is available only when you set the Operation mode to Fusion

Data Types: double

When you select the Linear acceleration (m/s^2) parameter, the Lin accel port becomes available. For more information on the Lin accel port, see Lin accel.

Dependencies

The Linear acceleration (m/s^2) parameter is available only when you set the Operation mode to Fusion.

When you select the Gravity vector (m/s^2) parameter, the Gravity port becomes available. For more information on the Gravity port, see Gravity.

Dependencies

The Gravity vector (m/s^2) parameter is available only when you set the Operation mode to Fusion.

Advanced Sensor Settings

Specify the deviation in the acceleration that the accelerometer can measure. The smaller the accelerometer range is, the more sensitive the readings from the accelerometer are. A small range provides more detailed data, resulting in a more precise reading from the accelerometer.

Dependencies

The Accelerometer range parameter is available only when you set the Operation mode to Non-Fusion.

Specify the frequency at which the accelerometer measures acceleration.

Dependencies

The Accelerometer bandwidth parameter is available only when you set the Operation mode to Non-Fusion.

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

Dependencies

The Gyroscope range parameter is available only when you set the Operation mode to Non-Fusion.

Specify the frequency at which the gyroscope measures angular velocity.

Dependencies

The Gyroscope bandwidth parameter is available only when you set the Operation mode to Non-Fusion.

Specify the range of the magnetic field that the magnetometer can read.

Dependencies

The Magnetometer output data range parameter is available only when you set the Operation mode to Fusion

Data Types: double

More About

expand all

Introduced in R2018b