10DOF AHRS

Introduction

BNO055 is a new sensor IC for implementing an intelligent 9-axis Absolute Orientation Sensor. It is a system in package, integrating a triaxial 14-bit accelerometer, a triaxial 16-bit gyroscope, a triaxial geomagnetic sensor and a 32-bit microcontroller. At just 5.2 x 3.8 x 1.1 mm³, it is significantly smaller than comparable discrete or system-on-board solutions and also is the sensor-hub product of the smallest size that supports Windows 8.1 at present. BNO055 is able to provide not only single data of the three kinds of sensors(accelerometer/gyroscope/geomagnetic), but also fused data, such as quaternions, Euler angles or vectors. Besides, the built-in MCU frees the users from the complexities of algorithm processing, which provides application support in many aspects for smart phone, wearable device and so on.

BMP280 is an absolute barometric pressure sensor especially designed for mobile applications, which can realize the measurement of barometric pressure and temperature(the data can be converted into altitude through the specific formula ). The sensor module is housed in an extremely compact package. It is based on Bosch’s proven Piezo resistive pressure sensor technology featuring high accuracy and linearity as well as long term stability and high EMC robustness. Numerous device operation options offer highest flexibility to optimize the device regarding power consumption, resolution and filter performance.

Now, DFRobot is launching Gravity:BNO055 BMP280 intelligent 10DOF AHRS. This sensor module integrates BNO055 and BMP280 on one board to combine the two sensor into a 10DOF sensor module. The standard Gravity-I2C interface eases the integration process for customers, freeing them from the complexities of multivendor solutions so they can spend more time on product innovation, including novel applications such as wearable hardware. It is also the perfect choice for augmented reality, more immersive gaming, personal health and fitness, indoor navigation and any other application requiring context awareness.

Features

Specification

Pinout and Dimension Diagram

SEN0253 Dimension Diagram

Serial Number Name Functionality
1 /VCC Positive Pole
2 -/GND Negative Pole
3 C I2C-SCL
4 D I2C-SDA
5 NBOOT Boot Mode
6 RST Reset Pin
7 INT Interrupt Output Pin
8 I2C_ADDR BNO055 I2C address Selection
9 PS2 Protocol Selection Pin 2
10 PS1 Protocol Selection Pin 1
11 BL_IND Bootstrap Instructions
PS1 PS2 Functionalit
0 0 Standard/Fast 12C Interface
0 1 HID OVER I2C
1 0 UART Interface
1 1 Reserved

Note: the I2C address of BNO055 is set to 0×28 by default. The I2C address of BMP280 is 0×76; the I2C_ADDR of BNO055 can be set as 0x28/0x29. PS1 and PS2 are set to 0 and 0 by default.

API Function

/*!
 * @The functionality of the function:initialize the SEN0253 device
 *
 * @return value:bool type
 *   true: initializing the device fails
 *   false:initializing the device succeeds
 */
bool init();

/*!
 * @The functionality of the function:set the mode of BNO055 device
 *
 * @Parameter:  powerMode: set the power mode
 *               dataMode: set the data transmission rate
 */
void setMode(eBNO055PowerModes_t powerMode, eBNO055DataRateMode_t dataRate);

/*!
* @The functionality of the function: read the value of Euler angle and store it into the struct of BNO055EulerData.
 */
void readEuler(void);

/*!
 * @The functionality of the function: read the value of angular velocity and store it into the struct of BNO055GyrDate. 
*/
void readAngularVelocity(void);

/*!
 * @The functionality of the function: read the value of linear acceleration and store it into the struct of BNO055LinAccData.
 */
void readLinAcc(void);

/*!
 * @The functionality of the function:read the value of quaternion and store it into the struct of BNO055QuaData.
 */
void readQua(void);

/*!
 * @The functionality of the function: use the final values of quaternion and linear
acceleration to calculate the final position and store the position information into the struct of BNO055AbsLinAccData.
 */
void calcAbsLinAcc(void);

Tutorial

10 DOF integrates BNO055 and BMP280. The I2C address of BNO055 (0×28) and BMP280 (0×76) can be visited through I2C interface, which makes it available to obtain the related position data and environment information.

Preparation

Hardware

Software

Connection Diagram

SEN0253 V1.0 Connection Diagram

Sample Code

The function of the program: read the pitch angle, roll angle and yaw angle of BNO055 sensor via I2C interface, and print out the data through the serial port. Using this demo with a small visual software Euler angle visual tool.exe we specifically designed, you can directly observe the attitude variation of 10DOF. As shown below.

/*
 * file EulerAngleDemo.ino
 *
 * @ https://github.com/DFRobot/DFRobot_BNO055
 *
 * connect BNO055 I2C interface with your board (please reference board compatibility)
 *
 * This example can be used to display the gesture on dof10.exe
 *
 * Copyright   [DFRobot](http://www.dfrobot.com), 2016
 * Copyright   GNU Lesser General Public License
 *
 * version  V0.1
 * date  2018-1-8
 */

#include "DFRobot_BNO055.h"

DFRobot_BNO055 mpu;
void setup() 
{
   Serial.begin(115200);
   while (!mpu.init())
   {
     Serial.println("ERROR! Unable to initialize the chip!");
     delay(50);
   }
//   mpu.setMode(mpu.eNORMAL_POWER_MODE, mpu.eFASTEST_MODE);
   delay(100);
   Serial.println("Read euler angles...");
}

void loop() 
{
  mpu.readEuler();  /* read euler angle */
  /* In order to match the API of the upper computer, X ----> pitch  */
  Serial.print("pitch:"); 
  Serial.print(mpu.EulerAngles.y, 3); 
  Serial.print(" "); 
  /* In order to match the API of the upper computer, Y ----> roll  */
  Serial.print("roll:"); 
  Serial.print(mpu.EulerAngles.z, 3); 
  Serial.print(" ");
  /* In order to match the API of the upper computer, Z ----> yaw  */
  Serial.print("yaw:"); 
  Serial.print(mpu.EulerAngles.x, 3); 
  Serial.println(" ");

  delay(80);
}

If we compare 10DOF to an airplane whose nose points at due east, the positive direction of X axis will be the direction of the nose, the positive direction of Y axis will be the direction of the left wing, which is due north. Z axis is perpendicular to the plane XOY that formed by X and Y axes. When the 10 DOF’s direction of X, Y, and Z totally coincides with the above-mentioned direction, the values of the pitch, roll and yaw angle are 0°. Here we define: pitch is the angle between the nose and XOY when the airplane noses up or down along the Y axis, and nose up is positive while nose down is negative; roll is the angle between the body and XOY when the airplane rolls along the X axis; yaw is the angle between the nose and XOZ when the airplane moves along the Z axis.

warning_yellow.png Please note that you need to close the serial port occupied by the printer when using the test software to observe the sensor’s movement posture.

Sample Code

The function of the program: get the acceleration data of the sensor’s movement on X, Z and Y, and print it out through the serial port.

/*
 * file AccelerationDemo.ino
 *
 * @ https://github.com/DFRobot/DFRobot_BNO055
 *
 * connect BNO055 I2C interface with your board (please reference board compatibility)
 *
 * Gets the current acceleration of the sensor and prints it out through the serial port.
 *
 * Copyright   [DFRobot](http://www.dfrobot.com), 2016
 * Copyright   GNU Lesser General Public License
 *
 * version  V0.1
 * date  2018-1-8
 */

#include <Wire.h> 
#include "DFRobot_BNO055.h"

DFRobot_BNO055 mpu;

void setup() 
{
   Serial.begin(115200);
   while (!mpu.init())
   {
     Serial.println("ERROR! Unable to initialize the chip!");
     delay(50);
   }
//   mpu.setMode(mpu.eNORMAL_POWER_MODE, mpu.eFASTEST_MODE);
   delay(100);
   Serial.println("Read acceleration...");
}

void loop() 
{
  mpu.readAcc();   /* read acceleration */
  Serial.print("X: "); 
  Serial.print(mpu.AccData.x,3); 
  Serial.print(" m/s^2  ");
  Serial.print("Y: "); 
  Serial.print(mpu.AccData.y,3); 
  Serial.print(" m/s^2  ");
  Serial.print("Z: "); 
  Serial.print(mpu.AccData.z,3); 
  Serial.println(" m/s^2  ");
  delay(200);
}

Sample Code

The function of the program: get the linear acceleration of the sensor’s movement on X, Z and Y( exclude the value generated under the influence of gravity acceleration), and print it out through the serial port. The values of X, Y and Z respectively represents the changes of velocity of 10 DOF on X, Y and Z. It can be described as m/s^2. “ ” and “-” shows the increase and decrease of the velocity respectively. When the sensor keeps still, the values of X, Y, and Z approximate to 0g. Nothing in the world can keep absolutely still, so the acceleration of the sensor oscillates around 0.

/*
 * file LinearAccelerationDemo.ino
 *
 * @ https://github.com/DFRobot/DFRobot_BNO055
 *
 * connect BNO055 I2C interface with your board (please reference board compatibility)
 *
 * Gets the current linear acceleration of the sensor and prints it out through the serial port.
 *
 * Copyright   [DFRobot](http://www.dfrobot.com), 2016
 * Copyright   GNU Lesser General Public License
 *
 * version  V0.1
 * date  2018-1-8
 */

#include <Wire.h> 
#include "DFRobot_BNO055.h"

DFRobot_BNO055 mpu;

void setup() 
{
   Serial.begin(115200);
   while (!mpu.init())
   {
     Serial.println("ERROR! Unable to initialize the chip!");
     delay(50);
   }
//   mpu.setMode(mpu.eNORMAL_POWER_MODE, mpu.eFASTEST_MODE);
   delay(100);
   Serial.println("Read linear acceleration...");
}

void loop() 
{
  mpu.readLinAcc();   /* read linear acceleration */
  Serial.print("X: "); 
  Serial.print(mpu.LinAccData.x,3); 
  Serial.print(" m/s^2  ");
  Serial.print("Y: "); 
  Serial.print(mpu.LinAccData.y,3); 
  Serial.print(" m/s^2  ");
  Serial.print("Z: "); 
  Serial.print(mpu.LinAccData.z,3); 
  Serial.println(" m/s^2  ");
  delay(200);
}

Sample Code

The function of the program: get the angular velocity of the sensor's movement round X, Y and Z, and print it out through the serial port. X, Y and Z respectively represent the angle that the sensor rotates round the X, Y and Z in unit time. It can be described as dps. " " and "-" respectively shows the sensor's forward-rotating and reverse around the axis.

/*
 * file EulerAngleDemo.ino
 *
 * @ https://github.com/DFRobot/DFRobot_BNO055
 *
 * connect BNO055 I2C interface with your board (please reference board compatibility)
 *
 * Gets the Angular Velocity of the current sensor and prints it out through the serial port.
 *
 * Copyright   [DFRobot](http://www.dfrobot.com), 2016
 * Copyright   GNU Lesser General Public License
 *
 * version  V0.1
 * date  2018-1-8
 */

#include <Wire.h> 
#include "DFRobot_BNO055.h"

DFRobot_BNO055 mpu;
void setup() 
{
   Serial.begin(115200);
   while (!mpu.init())
   {
     Serial.println("ERROR! Unable to initialize the chip!");
     delay(50);
   }
//   mpu.setMode(mpu.eNORMAL_POWER_MODE, mpu.eFASTEST_MODE);
   delay(100);
   Serial.println("Read Angular Velocity...");
}

void loop() 
{
  mpu.readAngularVelocity();  /* read Angular Velocity */

  Serial.print("X: "); 
  Serial.print(mpu.GyrData.x, 3); 
  Serial.print(" dps  "); 

  Serial.print("Y: "); 
  Serial.print(mpu.GyrData.y, 3); 
  Serial.print(" dps ");

  Serial.print("Z: "); 
  Serial.print(mpu.GyrData.z, 3); 
  Serial.println(" dps ");

  delay(200);
}

Sample Code

The function of the program: read the values of the temperature, barometric pressure and altitude 10 DOF module collected, and print it out over the serial port. Their measurement units are ℃, pa and m. The altitude is calculated from the temperature and pressure BMP280 detected, which may lead to a certain amount of error. The indoor temperature of that day is 26.33℃, and the pressure is 952hpa. The altitude range of the region is 511.3~647.4m.

#include <DFRobot_BMP280.h>

DFRobot_BMP280 bmp;

void setup() {
  Serial.begin(115200);
  while (!bmp.begin()) {  
    Serial.println(F("Error initializing BMP280!"));
    delay(1000);
  }
}

void loop() {
  Serial.print("Temperature:");
  Serial.println(bmp.readTemperatureValue());
  Serial.print("Pressure:");
  Serial.println(bmp.readPressureValue());
  Serial.print("Altitude:");
  Serial.println(bmp.readAltitudeValue());
  /* use a sampling time of at least 38ms */
  delay(50);
}

Print over serial port: temperature, pressure and altitude

More Documents

Schematic Diagram

BNO055 Datasheet

BMP280 Datasheet

DFshopping_car1.png Get Gravity: BNO055 BMP280 intelligent 10 DOF AHRS from DFRobot Store or DFRobot Distributor.