esp32_BNO08x 1.00
C++ BNO08x IMU driver component for esp-idf.
Loading...
Searching...
No Matches
README

Table of Contents.

image

  1. About
  2. Getting Started
  3. Example
  4. Documentation
  5. Acknowledgements
  6. License
  7. Contact

About

esp32_BNO08x is a C++ component written for esp-idf version 5.1 to serve as a driver for the BNO085 or BNO080 IMU.
This library is heavy influenced by the SparkFun BNO080 Arduino Library, it is more or less a port. It supports access to all the same data that the BNO08x provides.
Currently, only SPI is supported, there is no plans to support I2C (esp32 has I2C driver silicone bug, leading to unpredictable behavior).
I may implement UART at some point in the future.

Getting Started

(back to top)

Wiring

The default wiring is depicted below, it can be changed at driver initialization (see example section). image

(back to top)

Adding to Project

  1. Create a "components" directory in the root workspace directory of your esp-idf project if it does not exist already.

    In workspace directory:

    mkdir components
  2. Cd into the components directory and clone the esp32_BNO08x repo.

    cd components
    git clone https://github.com/myles-parfeniuk/esp32_BNO08x.git

    (back to top)

Example

#include <stdio.h>
#include "BNO08x.hpp"
extern "C" void app_main(void)
{
BNO08x imu; //create IMU object with default wiring scheme
/*
//if a custom wiring scheme is desired:
//create config struct
bno08x_config_t imu_config;
imu_config.io_mos = GPIO_NUM_X;
imu_config.io_miso = GPIO_NUM_X;
//etc...
BNO08x imu(imu_config);
*/
imu.initialize(); //initialize IMU
//enable gyro & game rotation vector
imu.enable_gyro(150);
while(1)
{
//print absolute heading in degrees and angular velocity in Rad/s
if(imu.data_available())
{
ESP_LOGW("Main", "Velocity: x: %.3f y: %.3f z: %.3f", imu.get_gyro_calibrated_velocity_X(), imu.get_gyro_calibrated_velocity_Y(), imu.get_gyro_calibrated_velocity_Z());
ESP_LOGI("Main", "Euler Angle: pitch: %.3f roll: %.3f yaw: %.3f", imu.get_pitch_deg(), imu.get_roll_deg(), imu.get_yaw_deg());
}
}
}
Definition BNO08x.hpp:74
float get_gyro_calibrated_velocity_Z()
Get calibrated gyro z axis angular velocity measurement.
Definition BNO08x.cpp:1862
bool data_available()
Checks if BNO08x has asserted interrupt and sent data.
Definition BNO08x.cpp:725
void enable_game_rotation_vector(uint16_t time_between_reports)
Sends command to enable game rotation vector reports (See Ref. Manual 6.5.19)
Definition BNO08x.cpp:996
float get_roll_deg()
Get the reported rotation about x axis.
Definition BNO08x.cpp:1500
void enable_gyro(uint16_t time_between_reports)
Sends command to enable gyro reports (See Ref. Manual 6.5.13)
Definition BNO08x.cpp:1100
float get_gyro_calibrated_velocity_X()
Get calibrated gyro x axis angular velocity measurement.
Definition BNO08x.cpp:1842
float get_gyro_calibrated_velocity_Y()
Get calibrated gyro y axis angular velocity measurement.
Definition BNO08x.cpp:1852
bool initialize()
Initializes BNO08x sensor.
Definition BNO08x.cpp:114
float get_pitch_deg()
Get the reported rotation about y axis.
Definition BNO08x.cpp:1510
float get_yaw_deg()
Get the reported rotation about z axis.
Definition BNO08x.cpp:1520

(back to top)

Documentation

API documentation generated with doxygen can be found in the documentation directory of the master branch.

(back to top)

Acknowledgements

Special thanks to the original creators of the sparkfun BNO080 library. Developing this without a reference would have been much more time consuming.
https://github.com/sparkfun/SparkFun_BNO080_Arduino_Library

Special thanks to Anton Babiy, aka hwBirdy007 for helping with debugging SPI.
https://github.com/hwBirdy007

(back to top)

License

Distributed under the MIT License. See LICENSE.md for more information.

(back to top)

Contact

Myles Parfeniuk - myles.nosp@m..par.nosp@m.fenyu.nosp@m.k@gm.nosp@m.ail.c.nosp@m.om

Project Link: https://github.com/myles-parfeniuk/esp32_BNO08x.git

(back to top)