Skip to content

braincore/mpu9250-dmp-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MPU-9250 Library for Rust Latest Version Documentation

A library for the MPU-9250 9-axis IMU. Only supports the i2c interface (no SPI). Includes a minimal interface to the onboard Digital Motion Processor.

Features

  • Adjustable full scale range (2G..16G) and low-pass-filter bandwidth.
  • Adjustable sample rate.
  • Adjustable fifo population rate.
  • Setup of DMP interrupt and fifo.
  • Quaternion output from the DMP.

Note: Heading Estimation

Because the quaternions are computed from a 6-axis measurement (accelerometer and gyroscope, no magnetometer), it suffers from significant yaw drift. If you require accurate heading, it's best to ignore the quaternion output and instead use a separate 9-axis filter such as Madgwick.

Note: Crate Quality

This crate was built to do performance testing on the MPU-9250 after which usage of this crate was halted. The code isn't under active development and hasn't been cleaned up. Because there are few examples of using the DMP out there I thought it would still be valuable to share this with others.

Usage

See examples/scan.rs and examples/scan_dmp.rs. Use -h to see parameters for i2c, sample rate, and interrupt pin.

Testing

By default, uses i2c bus=1 and addr=0x68, and expects a WHOAMI register value of 0x71. To override, use these environment variables:

MPU9250_I2C_BUS=1 MPU9250_I2C_ADDR=104 MPU9250_WHOAMI=115 cargo test

Resources

Todo

There are no plans to do these.

  • Expose temperature readings in Mpu9250Sample.
  • DMP configurations such as orientation and tap detection.