{"id":20731475,"url":"https://github.com/davidliyutong/esp32_bno08x_driver","last_synced_at":"2025-04-23T22:05:24.546Z","repository":{"id":250843058,"uuid":"828847301","full_name":"davidliyutong/esp32_bno08x_driver","owner":"davidliyutong","description":"C idf-driver for BNO08X IMUs","archived":false,"fork":false,"pushed_at":"2024-07-30T08:53:53.000Z","size":145,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-07-30T11:46:12.439Z","etag":null,"topics":["bno080","bno085","bno08x","esp-idf","esp32"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidliyutong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-15T08:46:37.000Z","updated_at":"2024-07-30T11:46:16.094Z","dependencies_parsed_at":"2024-07-30T11:46:15.458Z","dependency_job_id":"c41254ad-f53a-4658-a7ba-a5600c0eb50e","html_url":"https://github.com/davidliyutong/esp32_bno08x_driver","commit_stats":null,"previous_names":["davidliyutong/esp32_bno08x_driver"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidliyutong%2Fesp32_bno08x_driver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidliyutong%2Fesp32_bno08x_driver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidliyutong%2Fesp32_bno08x_driver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidliyutong%2Fesp32_bno08x_driver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidliyutong","download_url":"https://codeload.github.com/davidliyutong/esp32_bno08x_driver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225000683,"owners_count":17405074,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bno080","bno085","bno08x","esp-idf","esp32"],"created_at":"2024-11-17T05:14:58.392Z","updated_at":"2024-11-17T05:14:58.478Z","avatar_url":"https://github.com/davidliyutong.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ESP-IDF C BNO08x IMU Driver\n\nThis project is inspired by [myles-parfeniuk/esp32_BNO08x](https://github.com/myles-parfeniuk/esp32_BNO08x), a C++ BNO08x driver.\n\n\n# Examples\n\nReading data via polling with `BNO08x_data_available()`:\n```cpp\n#include \u003cstdio.h\u003e\n#include \"bno08x_driver.h\"\n\nvoid app_main(void)\n{\n    BNO08x imu;                               // imu object handle\n    BNO08x_config_t cfg = DEFAULT_IMU_CONFIG; // default IMU config modifiable via idf.py menuconfig esp32_BNO08x\n\n    // initialize SPI peripheral and gpio\n    BNO08x_init(\u0026imu, \u0026cfg);\n    // initialize BNO08x\n    BNO08x_initialize(\u0026imu);\n\n    // enable reports for any data we want to receive\n    BNO08x_enable_game_rotation_vector(\u0026imu, 100000UL); // 100,000us == 100ms report interval\n    BNO08x_enable_gyro(\u0026imu, 150000UL);                 // 150,000us == 150ms report interval\n\n    while (1)\n    {\n        //blocks until a valid packet is received or HOST_INT_TIMEOUT_MS occurs\n        if (BNO08x_data_available(\u0026imu))\n        {\n            float x, y, z = 0;\n\n            // angular velocity (Rad/s)\n            x = BNO08x_get_gyro_calibrated_velocity_X(\u0026imu);\n            y = BNO08x_get_gyro_calibrated_velocity_Y(\u0026imu);\n            z = BNO08x_get_gyro_calibrated_velocity_Z(\u0026imu);\n            ESP_LOGW(\"IMU_cb\", \"Angular Velocity: x: %.3f y: %.3f z: %.3f\", x, y, z);\n\n            // absolute heading (degrees)\n            x = BNO08x_get_roll_deg(\u0026imu);\n            y = BNO08x_get_pitch_deg(\u0026imu);\n            z = BNO08x_get_yaw_deg(\u0026imu);\n            ESP_LOGI(\"IMU_cb\", \"Euler Angle: x (roll): %.3f y (pitch): %.3f z (yaw): %.3f\", x, y, z);\n        }\n    }\n}\n\n```\n\nReading data with an automatically invoked callback using `BNO08x_register_cb()`:\n```cpp\n#include \u003cstdio.h\u003e\n#include \"bno08x_driver.h\"\n\n//imu data callback function, invoked whenever new data is arrived\nvoid imu_data_cb(void *arg);\n\nvoid app_main(void)\n{\n    BNO08x imu;                               // imu object handle\n    BNO08x_config_t cfg = DEFAULT_IMU_CONFIG; // default IMU config modifiable via idf.py menuconfig esp32_BNO08x\n\n    // initialize SPI peripheral and gpio\n    BNO08x_init(\u0026imu, \u0026cfg);\n    // initialize BNO08x\n    BNO08x_initialize(\u0026imu);\n\n    // register a callback to be executed when new data is available\n    BNO08x_register_cb(\u0026imu, imu_data_cb);\n\n    // enable reports for any data we want to receive\n    BNO08x_enable_game_rotation_vector(\u0026imu, 100000UL); // 100,000us == 100ms report interval\n    BNO08x_enable_gyro(\u0026imu, 150000UL);                 // 150,000us == 150ms report interval\n\n    while (1)\n    {\n        // delay here is irrelevant, we just don't want cpu watchdog to trip\n        vTaskDelay(10000 / portTICK_PERIOD_MS);\n    }\n}\n\nvoid imu_data_cb(void *arg)\n{\n    BNO08x *imu = (BNO08x *)arg; //void pointer should always be casted to BNO08x struct pointer\n    float x, y, z = 0;\n\n    //angular velocity (Rad/s)\n    x = BNO08x_get_gyro_calibrated_velocity_X(imu);\n    y = BNO08x_get_gyro_calibrated_velocity_Y(imu);\n    z = BNO08x_get_gyro_calibrated_velocity_Z(imu);\n    ESP_LOGW(\"IMU_cb\", \"Angular Velocity: x: %.3f y: %.3f z: %.3f\", x, y, z);\n\n    //absolute heading (degrees)\n    x = BNO08x_get_roll_deg(imu);\n    y = BNO08x_get_pitch_deg(imu);\n    z = BNO08x_get_yaw_deg(imu);\n    ESP_LOGI(\"IMU_cb\", \"Euler Angle: x (roll): %.3f y (pitch): %.3f z (yaw): %.3f\", x, y, z);\n}\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidliyutong%2Fesp32_bno08x_driver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidliyutong%2Fesp32_bno08x_driver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidliyutong%2Fesp32_bno08x_driver/lists"}