mjs513
Senior Member+
Lately been trying to consolidate/organize my IMU efforts and decided to grab a couple of new sensors that are used on the Nano Sense V2, the BMI270/BMM150 specifically. For reference Sparkfun has a BMI270 sensor and Waveshare has a BMM150. However found that M5Stack has a single module with both sensors along with a BMP280 pressure sensor.
One of the things that the BMI270 is a aux bus that another i2c sensor can be attached to which how the M5Stack module is configured. The Sparkfun board does have this as an option but does not provide the interface software to accomplish this. While the M5Stack does. I did find a library that does this that I slightly modified for my use to add in a couple of extra config functions for the gyro, accel and magnetomer. This was originally developed by yahyatawil called BMI270_AUX_BMM150. My modifed version is at: https://github.com/mjs513/BMI270_AUX_BMM150/tree/add_functions with example on how to get the data from all three sensors. The three new functions added were:
along with the ability now to specify the what you want for the constructor and wire port you want to use.
Running this on a T4 with Madgwick's new fusion algorithm was interesting to get working properly. Key to using it is that the update rate has to be based on the gyro update rate only!!!! Good thing to keep in mind when using it. The fusion algorithm along with the Teensy example can be found at: https://github.com/mjs513/Fusion/tree/Fusion+Teensy-Examples
I posted a quick video of it in action using x-imu3 Gui.
Sensor calibration was done using a custom 6 point calibration and MotionCal for the Magnetometer. More in the next post
One of the things that the BMI270 is a aux bus that another i2c sensor can be attached to which how the M5Stack module is configured. The Sparkfun board does have this as an option but does not provide the interface software to accomplish this. While the M5Stack does. I did find a library that does this that I slightly modified for my use to add in a couple of extra config functions for the gyro, accel and magnetomer. This was originally developed by yahyatawil called BMI270_AUX_BMM150. My modifed version is at: https://github.com/mjs513/BMI270_AUX_BMM150/tree/add_functions with example on how to get the data from all three sensors. The three new functions added were:
Code:
void setAcellConfig(uint8_t odr, uint8_t range, uint8_t band_width);
void setGyroConfig(uint8_t odr, uint8_t range, uint8_t band_width);
void setMagConfig(uint8_t pwrmode, uint8_t preset);
along with the ability now to specify the what you want for the constructor and wire port you want to use.
Running this on a T4 with Madgwick's new fusion algorithm was interesting to get working properly. Key to using it is that the update rate has to be based on the gyro update rate only!!!! Good thing to keep in mind when using it. The fusion algorithm along with the Teensy example can be found at: https://github.com/mjs513/Fusion/tree/Fusion+Teensy-Examples
I posted a quick video of it in action using x-imu3 Gui.
Sensor calibration was done using a custom 6 point calibration and MotionCal for the Magnetometer. More in the next post