{"id":15816665,"url":"https://github.com/aler9/sensor-imu","last_synced_at":"2025-10-15T00:39:29.254Z","repository":{"id":45738381,"uuid":"209304279","full_name":"aler9/sensor-imu","owner":"aler9","description":"C library to interact with various IMUs (MPU6000, MPU6050, MPU6500, ICM20600, ICM20601, ICM2062)","archived":false,"fork":false,"pushed_at":"2025-03-12T10:51:25.000Z","size":45,"stargazers_count":26,"open_issues_count":0,"forks_count":10,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-10T08:39:59.738Z","etag":null,"topics":["icm20600","icm20601","icm20602","imu","mpu6000","mpu6050","mpu6500","raspberry-pi"],"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/aler9.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,"zenodo":null},"funding":{"custom":["https://www.buymeacoffee.com/aler9"]}},"created_at":"2019-09-18T12:35:09.000Z","updated_at":"2025-03-16T13:44:41.000Z","dependencies_parsed_at":"2025-06-10T08:43:39.417Z","dependency_job_id":null,"html_url":"https://github.com/aler9/sensor-imu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aler9/sensor-imu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aler9%2Fsensor-imu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aler9%2Fsensor-imu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aler9%2Fsensor-imu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aler9%2Fsensor-imu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aler9","download_url":"https://codeload.github.com/aler9/sensor-imu/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aler9%2Fsensor-imu/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268157573,"owners_count":24204756,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["icm20600","icm20601","icm20602","imu","mpu6000","mpu6050","mpu6500","raspberry-pi"],"created_at":"2024-10-05T05:06:39.796Z","updated_at":"2025-10-15T00:39:24.207Z","avatar_url":"https://github.com/aler9.png","language":"C","funding_links":["https://www.buymeacoffee.com/aler9"],"categories":[],"sub_categories":[],"readme":"\n# sensor-imu\n\n[![Lint](https://github.com/aler9/sensor-imu/actions/workflows/lint.yml/badge.svg)](https://github.com/aler9/sensor-imu/actions/workflows/lint.yml)\n[![Test](https://github.com/aler9/sensor-imu/actions/workflows/test.yml/badge.svg)](https://github.com/aler9/sensor-imu/actions/workflows/test.yml)\n\nC library to interact with various IMUs (MPU6000, MPU6050, MPU6500, ICM20600, ICM20601, ICM2062). It was written for the **[raspberry-imu-viewer](https://github.com/aler9/raspberry-imu-viewer)** project, an orientation viewer in 3D for the Raspberry Pi, where you can also find a working example on how to use this library.\n\nFeatures:\n* works with Raspberry Pi / Linux and probably with almost every single-board computer equipped with I2C\n* IMU model and address are autodetected during initialization\n* sampling rate can reach 1khz (when I2C speed is 400khz)\n* orientation estimation algorithms are available in folder `/orientation`\n\n## Installation\n\n1. On the Raspberry Pi, enable I2C and set speed to 400khz: edit `/boot/config.txt` and add:\n\n   ```\n   dtparam=i2c_arm=on\n   dtparam=i2c_arm_baudrate=400000\n   ```\n\n   then edit `/etc/modules` and add\n\n   ```\n   i2c-dev\n   ```\n\n   then reboot the system.\n\n\n2. Install the dependencies:\n\n   ```\n   sudo apt install -y git make gcc libc6-dev libi2c-dev\n   ```\n\n3. Clone this repository:\n\n   ```\n   git clone https://github.com/aler9/sensor-imu\n   ```\n\n4. Create a sample source file named `main.c`:\n\n   ```c\n   #include \u003cstdio.h\u003e\n   #include \u003cstdlib.h\u003e\n\n   #include \"sensor-imu/imu.h\"\n\n   int main() {\n       imut *imu;\n       error *err = imu_init(\u0026imu, \"/dev/i2c-1\", IMU_ACC_RANGE_2G, IMU_GYRO_RANGE_250DPS);\n       if(err != NULL) {\n           printf(\"ERR: %s\\n\", err);\n           return -1;\n       }\n\n       imu_output io;\n       err = imu_read(imu, \u0026io);\n       if(err != NULL) {\n           printf(\"ERR: %s\\n\", err);\n           return -1;\n       }\n\n       printf(\"gyro x,y,z: %f, %f, %f\\n\", io.gyro.x, io.gyro.y, io.gyro.z);\n       printf(\"acc x,y,z: %f, %f, %f\\n\", io.acc.x, io.acc.y, io.acc.z);\n       return 0;\n   }\n   ```\n\n5. Build:\n\n   ```\n   gcc -o main sensor-imu/*.c main.c\n   ```\n\n6. Launch:\n\n   ```\n   ./main\n   ```\n\n## API Documentation\n\n```error *imu_init(imut **pobj, const char *path, imu_acc_range acc_range, imu_gyro_range gyro_range)```\n\nCreates an IMU reader. Arguments a pointer to an empty `imut*` object, the path to the I2C device, the accelerometer range and the gyroscope range. It returns `NULL` in case of success, otherwise returns an error.\n\n```void imu_destroy(imut *obj)```\n\nDestroys an IMU reader.\n\n```error *imu_read(imut *obj, imu_output *out)```\n\nPerforms a measurement. Returns an `imu_output` that contains the measurements.\n\nAccelerometer measurements are expressed in [g], while gyroscope measurements are expressed in [deg/s]\n\n## Links\n\n* [raspberry-imu-viewer](https://github.com/aler9/raspberry-imu-viewer)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faler9%2Fsensor-imu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faler9%2Fsensor-imu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faler9%2Fsensor-imu/lists"}