Cant make 6 DOF gyro chip work right?

This is the kind of tiny board I have. It says MPU 92/65 on the board, and the description says its SPI/IIC MPU-9250 9-Axis Attitude +Gyro+Accelerator+Magnetometer Module A2TM

Ok so how to make it run? I found its at 0x68. I followed the youtube video at How to use MPU-9250 Gyroscope, Accelerometer, Magnetometer for Arduino - YouTube

if I run ANY MPU-9250 example program it reports NO MPU found.

Ran close to 20 different examples now, or more, only 1 sort of worked, /* BurstRead_demo.ino
/*
*

  • Copyright (c) 2019 Seeed Technology Co., Ltd.
  • Website : www.seeed.cc
  • Create Time: February 2019
  • Change Log :
#include <Seeed_ADIS16470.h>
#include <Wire.h>

#ifdef ARDUINO_SAMD_VARIANT_COMPLIANCE
    #define SERIAL SerialUSB
#else
    #define SERIAL Serial
#endif

uint8_t burstdata[21];
uint16_t *wordData;
// Accelerometer
float AXS, AYS, AZS = 0;

// Gyro
float GXS, GYS, GZS = 0;

// Temperature
float TEMPS = 0;

// Call ADIS16470 Class
ADIS16470 IMU(10);

void scaleData() {
    GXS = IMU.gyroScale(*(wordData + 1)); //Scale X Gyro
    GYS = IMU.gyroScale(*(wordData + 2)); //Scale Y Gyro
    GZS = IMU.gyroScale(*(wordData + 3)); //Scale Z Gyro
//    AXS = IMU.accelScale(*(wordData + 4)); //Scale X Accel
//    AYS = IMU.accelScale(*(wordData + 5)); //Scale Y Accel
//    AZS = IMU.accelScale(*(wordData + 6)); //Scale Z Accel
//    TEMPS = IMU.tempScale(*(wordData + 7)); //Scale Temp Sensor
}

void setup() {
    Wire.begin();        // join i2c bus (address optional for master)
    SERIAL.begin(9600);  // start serial for output
}

void loop() 
{
    Wire.requestFrom(0x68, 21);    // request 10 bytes + Version from slave device 0x36
    int i=0;
    while (Wire.available()) { // slave may send less than requested
      uint8_t c = Wire.read(); // receive a byte as character
      burstdata[i] = c;
      i++;
      //SERIAL.print(c,HEX);
      //SERIAL.print("  ");
    }
    i = 0;

    wordData = IMU.wordData(burstdata);
    scaleData();

    //print the array of burstread and checksum
    /*
      int s = 0;
      uint32_t burstChecksum = 0;
      for(int i = 0; i < 21; i++)
      {
          if(i < 18)
          {
              s += burstdata[i];
          }
          else
          {
              burstChecksum = s;
          }

          SERIAL.print(burstdata[i], HEX);
          SERIAL.print("  ");
          if(i%5 == 0)SERIAL.println();
      }
      SERIAL.print("checksum: ");
      SERIAL.println(burstChecksum, HEX);
    */
   
   // SERIAL.print("Version:v");
   // SERIAL.println(burstdata[20]);
    // Print scaled gyro data
    SERIAL.print("XGYRO(degrees/sec): ");
    SERIAL.println(GXS);
    SERIAL.print("YGYRO(degrees/sec): ");
    SERIAL.println(GYS);
    SERIAL.print("ZGYRO(degrees/sec): ");
    SERIAL.println(GZS);

//    // Print scaled accel data
//    SERIAL.print("XACCL(g's): ");
//    SERIAL.println(AXS);
//    SERIAL.print("YACCL(g's): ");
//    SERIAL.println(AYS);
//    SERIAL.print("ZACCL(g's): ");
//    SERIAL.println(AZS);
//    SERIAL.println(" ");
//
//    // Print Status Registers
//    SERIAL.print("DIAG_STAT: ");
//    SERIAL.println((*(wordData + 0)));
//    SERIAL.print("TIME_STMP: ");
//    SERIAL.println((*(wordData + 8)));
//    SERIAL.print("CHECKSUM: ");
//    SERIAL.println((*(wordData + 9)));

    SERIAL.println();
    SERIAL.println();
     delay(1000);
}

And this runs and will post a bunch of numbers, then all 0's then touch the board and it posts a bunch of other numbers? oh working? no. let the board sit and it does this, zero's then random numbers, then zeros.

I just had this board in a kit and wanted to try out I2C things, not terribly important, just that it seems like after 2 full days of trying it would work

WIRING:
VCC = 5v
GND = GND
SDA = SDA
SCL = SCL (the 2 pins near the reset button on UNO R3 board)
all others open.

This will reliably detect I2C at 0x68 as the youtube video says, some programs confirm this, but wondering what is the correct library or example to use with this? thanks

Keep in mind that anything you buy that cheaply from from China is very likely to use reject, recycled or counterfeit chips. If you look closely at the image posted on the eBay page, notice that the chip markings have been erased. Also, the MPU-9250 has long been discontinued and there are much better parts available.

Even if it is genuine, with that 3.3V sensor you need either logic level shifters on SDA and SCL, when used with a 5V Arduino, or use a 3.3V Arduino and connect them directly. Avoid the many tutorials that suggest to connect SDA and SCL directly to a 5V Arduino, because they are wrong.

Once the logic level problem is solved, you can test the accelerometer using this simple tilt program, which works on either the MPU-6050 or the MPU-9250.

// minimal MPU-6050 tilt and roll (sjr). Works with MPU-9250 too.
// works perfectly with GY-521, pitch and roll signs agree with arrows on sensor module 7/2019
//
// Tested with 3.3V eBay Pro Mini with no external pullups on I2C bus (worked with internal pullups)
// Add 4.7K pullup resistors to 3.3V if required. A4 = SDA, A5 = SCL

#include<Wire.h>
const int MPU_addr1 = 0x68;
float xa, ya, za, roll, pitch;

void setup() {

  Wire.begin();                                      //begin the wire communication
  Wire.beginTransmission(MPU_addr1);                 //begin, send the slave adress (in this case 68)
  Wire.write(0x6B);                                  //make the reset (place a 0 into the 6B register)
  Wire.write(0);
  Wire.endTransmission(true);                        //end the transmission
  Serial.begin(9600);
}

void loop() {

  Wire.beginTransmission(MPU_addr1);
  Wire.write(0x3B);  //send starting register address, accelerometer high byte
  Wire.endTransmission(false); //restart for read
  Wire.requestFrom(MPU_addr1, 6); //get six bytes accelerometer data
  int t = Wire.read();
  xa = (t << 8) | Wire.read();
  t = Wire.read();
  ya = (t << 8) | Wire.read();
  t = Wire.read();
  za = (t << 8) | Wire.read();
// formula from https://wiki.dfrobot.com/How_to_Use_a_Three-Axis_Accelerometer_for_Tilt_Sensing
  roll = atan2(ya , za) * 180.0 / PI;
  pitch = atan2(-xa , sqrt(ya * ya + za * za)) * 180.0 / PI; //account for roll already applied

  Serial.print("roll = ");
  Serial.print(roll,1);
  Serial.print(", pitch = ");
  Serial.println(pitch,1);
  delay(400);
}
[color=#222222][/color]
// minimal MPU-6050 tilt and roll (sjr). Works with MPU-9250 too.[color=#222222][/color]
// works perfectly with GY-521, pitch and roll signs agree with arrows on sensor module 7/2019[color=#222222][/color]
//[color=#222222][/color]
// Tested with 3.3V eBay Pro Mini with no external pullups on I2C bus (worked with internal pullups)[color=#222222][/color]
// Add 4.7K pullup resistors to 3.3V if required. A4 = SDA, A5 = SCL[color=#222222][/color]
[color=#222222][/color]
#include<Wire.h>[color=#222222][/color]
const int MPU_addr1 = 0x68;[color=#222222][/color]
float xa, ya, za, roll, pitch;[color=#222222][/color]
[color=#222222][/color]
void setup() {[color=#222222][/color]
[color=#222222][/color]
  Wire.begin();                                      //begin the wire communication[color=#222222][/color]
  Wire.beginTransmission(MPU_addr1);                 //begin, send the slave adress (in this case 68)[color=#222222][/color]
  Wire.write(0x6B);                                  //make the reset (place a 0 into the 6B register)[color=#222222][/color]
  Wire.write(0);[color=#222222][/color]
  Wire.endTransmission(true);                        //end the transmission[color=#222222][/color]
  Serial.begin(9600);[color=#222222][/color]
}[color=#222222][/color]
[color=#222222][/color]
void loop() {[color=#222222][/color]
[color=#222222][/color]
  Wire.beginTransmission(MPU_addr1);[color=#222222][/color]
  Wire.write(0x3B);  //send starting register address, accelerometer high byte[color=#222222][/color]
  Wire.endTransmission(false); //restart for read[color=#222222][/color]
  Wire.requestFrom(MPU_addr1, 6); //get six bytes accelerometer data[color=#222222][/color]
  int t = Wire.read();[color=#222222][/color]
  xa = (t << 8) | Wire.read();[color=#222222][/color]
  t = Wire.read();[color=#222222][/color]
  ya = (t << 8) | Wire.read();[color=#222222][/color]
  t = Wire.read();[color=#222222][/color]
  za = (t << 8) | Wire.read();[color=#222222][/color]
// formula from https://wiki.dfrobot.com/How_to_Use_a_Three-Axis_Accelerometer_for_Tilt_Sensing[color=#222222][/color]
  roll = atan2(ya , za) * 180.0 / PI;[color=#222222][/color]
  pitch = atan2(-xa , sqrt(ya * ya + za * za)) * 180.0 / PI; //account for roll already applied[color=#222222][/color]
[color=#222222][/color]
  Serial.print("roll = ");[color=#222222][/color]
  Serial.print(roll,1);[color=#222222][/color]
  Serial.print(", pitch = ");[color=#222222][/color]
  Serial.println(pitch,1);[color=#222222][/color]
  delay(400);[color=#222222][/color]
}[color=#222222][/color]
[color=#222222][/color]
[color=#222222][/color]

This code worked perfectly, thank you!

It's likely counterfeit. Get one from a reputable supplier and lose the uncertainty - you risk
wasting many hours on a fruitless task otherwise.

yes so true! Its from a kit from 2016. it was shocking to see these devices sell for under $2 ?

assuredly hobby grade that may or may not work. Better to buy the real thing because the time wasted in making them work makes the total cost increase, if its for a project, right?

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