GithubHelp home page GithubHelp logo

d-mironov / bosch-bno055-stm32 Goto Github PK

View Code? Open in Web Editor NEW
15.0 1.0 2.0 10.4 MB

Library for the Bosch BNO055 Sensor based on and used with the STM32-HAL.

License: MIT License

C 100.00%
bosch stm32 accelerometer bno055 bno055-library c embedded embedded-c embedded-systems gyroscope

bosch-bno055-stm32's Introduction

Library for Bosch BNO055 IMU Sensor Unit written in and for the STM32 HAL.

Installation

Just throw the bno055.c, bno055.h and bno_config.h into your project, and you are good to go.
Or you can use the examples Project, which you can just compile with make.
If you copy over the project, make sure to also copy the library files and change the mail.c and Makefile. ^^

Usage

You first need to initialize the I2C yourself and enable the clock.
There is also an examples folder where you can find the I2C init code and all the other necessary stuff to understand how to use this libary.

Simple Init and Gyroscope and Accelerometer Read:

// `bno` is a global variable
bno = (bno055_t){
    .i2c = &hi2c1, .addr = BNO_ADDR, .mode = BNO_MODE_IMU,
};

// Initialize the sensor
bno055_init(&bno);

bno055_vec3_t gyroscope;
bno055_vec3_t accelerometer;

while (true) {
    // Read Gyroscope data on all axis
    bno055_gyro(&bno, &gyroscope);
    // OR
    bno.gyro(&bno, &gyroscope);

    // Read Accelerometer data on all axis
    bno055_acc(&bno, &accelerometer);
    // OR
    bno.acc(&bno, &accelerometer);
}

You can also read every axis separately. For any sensor.

f32 gyro_x, gyro_y, gyro_z;
while (true) {
    bno055_gyro_x(&bno, &gyro_x);
    bno055_gyro_y(&bno, &gyro_y);
    bno055_gyro_z(&bno, &gyro_z);
}

You can also set the units for each sensor:

// Temperature sensor in °C, Gyroscope in Deg/s, Accelerometer in m/s^2, Euler in Deg
bno055_set_unit(&bno, BNO_TEMP_UNIT_C, BNO_GYR_UNIT_DPS,
                      BNO_ACC_UNITSEL_M_S2, BNO_EUL_UNIT_DEG);

You can read the Quaternion and Euler data:

bno055_euler_t euler;
bno055_euler(&bno, &euler);
// OR
bno.euler(&bno, &euler);
printf("%2.2f | %2.2f | %2.2f\n", euler.yaw, euler.pitch, euler.roll);

bno055_vec4_t qua;
bno055_quaternion(&bno, &qua);
// OR
bno.quaternion(&bno, &qua);
printf("%2.2f | %2.2f | %2.2f | %2.2f\n", qua.w, qua.x, qua.y, qua.z);

They can also be read separately.

For all the other features, take a look at the Wiki Page of this repository.

Planned features

  • Axis remap
  • Interrupt based approach
  • DMA based approach
  • Low memory footprint config
  • Self-test
  • Calibration

All of the planned features listed here will be implemented once I have the time to do so. For now just stay tuned.

Disclaimer

This is not really production ready since it is not stress-tested and there is no interrupt- or DMA-based read/write cycle implemented. More of this will come in the future.

Contact

Discord: moonxraccoon#4788 E-Mail: [email protected]

bosch-bno055-stm32's People

Contributors

d-mironov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

ly-gif

bosch-bno055-stm32's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.