bno055
Add-On Required: This feature requires the MATLAB Support Package for Arduino Hardware add-on.
Description
The bno055
object reads acceleration, angular velocity, magnetic field,
and orientation in the specified mode of the BNO055 inertial measurement unit (IMU) sensor
connected to the Arduino® hardware. The BNO055 is a 9 degree of freedom (DOF) inertial measurement unit
(IMU) used to read acceleration, angular velocity, and magnetic field in all three
dimensions.
The bno0055
object represents a connection to the device on the
Arduino hardware I2C bus. Attach an BNO055 sensor to the I2C pins on the Arduino
hardware. You can read the data from your sensor in MATLAB® using the object functions.
Before you use the bno055
object, create an arduino
object with the I2C library. For more information, see Connect to Arduino Hardware.
Creation
Description
creates
a BNO055 sensor object with default property values. The object represents the connection
to the sensor on the Arduino hardware, imu
= bno055(a
)a
.
creates a BNO055 sensor object with properties using one or more
imu
= bno055(a
,Name,Value
)Name,Value
pair arguments.
Input Arguments
Properties
Usage
Create Connection to BNO055 in NDOF Mode
Create an arduino
object and include the I2C library.
a = arduino('COM4', 'Uno', 'Libraries', 'I2C');
Create the sensor object.
imu = bno055(a,'OperatingMode','ndof')
imu = bno055 with properties: OperatingMode: "ndof" I2CAddress: 40 ("0x28") Bus: 0 SCLPin: "A5" SDAPin: "A4" SampleRate: 100 (Samples/s) SamplesPerRead: 10 ReadMode: 'latest' SamplesRead: 0 SamplesAvailable: 0 Show all properties, functions
Create the sensor object with additional properties specified as name-value pairs.
clear imu; imu = bno055(a,'OperatingMode','ndof','SamplesPerRead',5,'ReadMode','oldest')
imu = bno055 with properties: OperatingMode: "ndof" I2CAddress: 40 ("0x28") Bus: 0 SCLPin: "A5" SDAPin: "A4" SampleRate: 100 (Samples/s) SamplesPerRead: 5 ReadMode: "oldest" SamplesRead: 0 SamplesAvailable: 0 Show all properties, functions
Create Connection to BNO055 in AMG Mode
Create an arduino
object and include the I2C library.
a = arduino('COM4', 'Uno', 'Libraries', 'I2C');
Create a sensor object.
imu = bno055(a,'OperatingMode','amg')
imu = bno055 with properties: OperatingMode: "amg" I2CAddress: 40 ("0x28") Bus: 0 SCLPin: "A5" SDAPin: "A4" SampleRate: 100 (Samples/s) SamplesPerRead: 10 ReadMode: 'latest' SamplesRead: 0 SamplesAvailable: 0 Show all properties, functions
Create the sensor object with additional properties specified as name-value pairs.
clear imu; imu = bno055(a,'OperatingMode','amg','SampleRate',50,'SamplesPerRead',5,'ReadMode','oldest')
imu = bno055 with properties: OperatingMode: "amg" I2CAddress: 40 ("0x28") Bus: 0 SCLPin: "A5" SDAPin: "A4" SampleRate: 50 (Samples/s) SamplesPerRead: 5 ReadMode: "oldest" SamplesRead: 0 SamplesAvailable: 0 Show all properties, functions
Object Functions
Use these functions to read the sensor data:
info | Read output data rate and bandwidth setting of BNO055 sensor |
read | Read acceleration, angular velocity, magnetic field, time, and overrun data from BNO055 sensor |
readAcceleration | Read one sample of acceleration from BNO055 sensor |
readAngularVelocity | Read one sample of angular velocity from BNO055 sensor |
readCalibrationStatus | Read calibration status of BNO055 sensor |
readMagneticField | Read one sample of magnetic field strength from BNO055 sensor |
readOrientation | Read orientation data from BNO055 sensor |
release | Release the BNO055 object |
flush | Flush the host buffer for BNO055 sensor |
More About
Version History
Introduced in R2020a