Remarks

BNO055
Status
Source code GitHub
NuGet package

BNO055 is a 9-axis absolute orientation sensor. The three sensors (accelerometer, gyroscope and magnetometer) are measured with a 32-bit cortex M0 microcontroller. The BNO055 is controlled via I2C.

Purchasing

Code Example

public class MeadowApp : App<F7Micro, MeadowApp>
{
    Bno055 sensor;

    public MeadowApp()
    {
        InitHardware();

        while (true)
        {
            sensor.Read();

            Console.WriteLine($"{sensor.Temperature}");

            Thread.Sleep(1000);
        }
    }

    public void InitHardware()
    {
        sensor = new Bno055(Device.CreateI2cBus(), 0x28);

        sensor.DisplayRegisters();
        sensor.PowerMode = Bno055.PowerModes.Normal;
        sensor.OperatingMode = Bno055.OperatingModes.ConfigurationMode;
        sensor.OperatingMode = Bno055.OperatingModes.InertialMeasurementUnit;
        sensor.DisplayRegisters();
    }
}

Sample projects available on GitHub

Wiring Example

The following diagram shows the BNO055 configured for bas

Characteristic Locus
Inheritance System.Object > Bno055
Inherited Members System.Object.ToString() System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.ReferenceEquals(System.Object, System.Object) System.Object.GetHashCode() System.Object.GetType() System.Object.MemberwiseClone()
Namespace Meadow.Foundation.Sensors.Motion
Assembly Bno055.dll

Syntax

public class Bno055

Constructors

Bno055(II2cBus, Byte)

Create a new BNO055 object using the default parameters for the component.

Declaration
public Bno055(II2cBus i2cBus, byte address = 40)

Parameters

Type Name Description
II2cBus i2cBus

I2C bus (default = 400 KHz).

System.Byte address

Address of the BNO055 (default = 0x28).

Properties

AccelerometerReading

Get the accelerometer readings from the last call to Read().

Declaration
public Vector AccelerometerReading { get; }

Property Value

Type Description
Vector

EulerOrientation

Orientation in Euler angles.

Declaration
public EulerAngles EulerOrientation { get; }

Property Value

Type Description
EulerAngles

GravityVector

Retrieve the gravity vector (fusion mode only).

Declaration
public Vector GravityVector { get; }

Property Value

Type Description
Vector

GyroscopeReading

Get the gyroscope readings.

Declaration
public Vector GyroscopeReading { get; }

Property Value

Type Description
Vector

IsAccelerometerCalibrated

Get the accelerometer calibration status.

Declaration
public bool IsAccelerometerCalibrated { get; }

Property Value

Type Description
System.Boolean

IsFullyCalibrated

Is the system fully calibrated?

Declaration
public bool IsFullyCalibrated { get; }

Property Value

Type Description
System.Boolean

Remarks

The sensor is fully calibrated if the system, accelerometer, gyroscope and megnetometer are all calibrated.

IsGyroscopeCalibrated

Get the gyroscope calibration status.

Declaration
public bool IsGyroscopeCalibrated { get; }

Property Value

Type Description
System.Boolean

IsInFusionMode

Check if sensor is currently working in Fusion mode.

Declaration
public bool IsInFusionMode { get; }

Property Value

Type Description
System.Boolean

IsMagnetometerCalibrated

Get the magnetometer status.

Declaration
public bool IsMagnetometerCalibrated { get; }

Property Value

Type Description
System.Boolean

IsSystemCalibrated

Get the system calibration status.

Declaration
public bool IsSystemCalibrated { get; }

Property Value

Type Description
System.Boolean

LinearAcceleration

Retrieve the linear acceleration vector (fusion mode only).

Declaration
public Vector LinearAcceleration { get; }

Property Value

Type Description
Vector

MagnetometerReading

Get the magnetometer readings.

Declaration
public Vector MagnetometerReading { get; }

Property Value

Type Description
Vector

OperatingMode

Get / set the current operating mode for the sensor.

Declaration
public byte OperatingMode { get; set; }

Property Value

Type Description
System.Byte

Remarks

Mode change takes 7-19 ms.

PowerMode

Get or set the power mode for the sensor.

Declaration
public byte PowerMode { get; set; }

Property Value

Type Description
System.Byte

QuaternionOrientation

Get the Quaterion orientation.

Declaration
public Quaternion QuaternionOrientation { get; }

Property Value

Type Description
Quaternion

Temperature

Get the temperature from the currently selected sensor.

Declaration
public int Temperature { get; }

Property Value

Type Description
System.Int32

TemperatureSource

Select the source of the Temperatute property.

Declaration
public Bno055.Sensor TemperatureSource { get; set; }

Property Value

Type Description
Bno055.Sensor

Methods

DisplayRegisters()

Read all of the registers and display their values on the Debug output.

Declaration
public void DisplayRegisters()

Read()

Force the sensor to make a reading and update the relevant properties.

Declaration
public void Read()

Remarks

This method reads ony the sensor motion / orientation registers. When accessing the data from a register it is necessary to subtract the accress of the start of the sensor registers from the register required in order to get the correct offset into the _sensorReadings array.