Unlocking the GY-91 (MPU-9250 + BMP-280)

The GY-91 is a 9-axis inertial measurement unit (IMU) composed of a 3-axis gyroscope, 3-axis Accelerometer and 3-axis Magnetometer-which are contained in the MPU-9250 (there is also a temperature sensor by the way-but usually it's not used). On top of the MPU-9250 chip, the GY-91 incorporates a BMP-280 barometer (which also has a temperature sensor!). Though all these functionalities are great (and the chip itself is relatively inexpensive), it has minimal documentation (though you can take a look at MPU-9250 and BMP-280 datasheets individually), with next to no supported code/examples. So after a bit of tinkering with Ardublock (I'm a visual coder by the way) I masked the chip as a MPU-6050-but this limited my access to just the gyro and accelerometer. Then, I decided to solve this problem once and for all in the following code, which can read all axes of the GY-91 chip and put the values in a serial monitor. The base code can then be used for more useful projects (too bad I don't know C++) This is it:

 @file read9axis.ino
 @brief This is an Example for the FaBo 9Axis I2C Brick.


   Released under APACHE LICENSE, VERSION 2.0


 @author FaBo<info@fabo.io>

#include <Wire.h>
#include <FaBo9Axis_MPU9250.h>
#include <Wire.h>
#include "i2c.h"
#include "i2c_BMP280.h"

BMP280 bmp280;
FaBo9Axis fabo_9axis;

void setup() {

    Serial.print("Probe BMP280: ");
    if (bmp280.initialize()) Serial.println("Sensor found");
        Serial.println("Sensor missing");
        while (1) {}

    // onetime-measure:
  Serial.println("configuring device.");

  if (fabo_9axis.begin()) {
    Serial.println("configured FaBo 9Axis I2C Brick");
  } else {
    Serial.println("device error");

void loop() {
  float ax,ay,az;
  float gx,gy,gz;
  float mx,my,mz;
  float temp;


  float temperature;

  float pascal;

  static float meters, metersold;
  metersold = (meters);

  Serial.print("AccX: ");
  Serial.print(" AccY: ");
  Serial.print(" AccZ: ");

  Serial.print("GyX: ");
  Serial.print(" GyY: ");
  Serial.print(" GyZ: ");

  Serial.print("MagX: ");
  Serial.print(" MagY: ");
  Serial.print(" MagZ: ");

  Serial.print("Temp: ");

  Serial.print(" HeightPT1: ");
  Serial.print(" m; Height: ");
  Serial.print(" Pressure: ");
  Serial.print(" Pa; T: ");
  Serial.println(" C");


I know almost in C++ (but I'll be learning MicroPython soon ;)), so for those of you who master it (which should be like 99.9999% of you), feel free to edit, develop and improve this code. :slight_smile: By the way, don't forget to download all the associated MPU-9250 (FaBo 202 9-axis library) and BMP-280 (I2C-Sensor-Lib iLib) libraries in you Arduino Editor. Also, I used an Arduino Uno board for this project (Pinout: VIN --> 5v, GND --> GND, SCL --> SCL/A5, SDA --> SDA/A4), so I don't GUARANTEE that this will work on other boards (but hopefully it does)...

Duplicate post deleted.

Great post, thumbs up. Thank you

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.