Hi, I cannot get readings from the MPU 9250 and 6050 boards. I have I2C wired correctly as the I2C scanner can find the MPU 9250 and the 6050 when I connect them. (Note that I'm only using 1 board at a time. So Im either using the MPU9250 or the MPU6050, not both at the same time). I have the board powered with 3.3V with the SDA and SCL pins connected to ESP32 D21 and D22 pins. Im using the ESP32 as my microcontroller.
I've tried using the libraries "Bolder Flight Systems MPU9250" by Brian Taylor and the "MPU9250" By Hideakitai for the MPU9250 board. And for the MPU6050 I've tried "Adafruit MPU6050" and "MPU6050" by Electronic Cats.
The example code from the "MPU9250" library called "Simple_With_Calibration" says in the serial monitor "MPU connection failed. Please check your connection with connection_check example".
When using the "Connection_Check" example code it shows this in the serial monitor
Searching for i2c devices...
Found 1 I2C devices
I2C addresses are: 0x68
I2C address 0x68 is not MPU series
WHO_AM_I is 75
Please use correct device
AK8963 (Magnetometer) was not found
The board I have connected is an MPU9250 so I don't know why it says it's not an MPU series board.
The MPU6050 libraries just read 0,0,0 for both the accelerometer and gyro. And the example code from the "Bolder Flight Systems MPU9250" Library called "I2C" gives me a compilation error.
In file included from C:\Users\inahs\AppData\Local\Temp.arduinoIDE-unsaved2023417-19860-1715ngi.pnlq\i2c\i2c.ino:26:0:
C:\Users\inahs\Documents\Arduino\libraries\Bolder_Flight_Systems_MPU9250\src/mpu9250.h:36:10: fatal error: cstddef: No such file or directory #include
^~~~~~~~~
compilation terminated.
exit status 1
Compilation error: exit status 1
I have tried to do this with both an Arduino UNO and an ESP32 with both the MPU9250 and the MPU6050. I've also tried this with another MPU6050 and the results are the same every time. If anyone has any ideas I would greatly appreciate it.
Just saying for the Arduino UNO I wired SDA and SCL pins to A4 and A5 and again, the MPU boards were able to show up in an I2C scanner.
I tried the MPU6050 with the Adafruit_MPU6050>basic_readings and I got this.
Adafruit MPU6050 test!
MPU6050 Found!
Accelerometer range set to: +-8G
Gyro range set to: +- 500 deg/s
Filter bandwidth set to: 21 Hz
Acceleration X: 0.00, Y: 0.00, Z: 0.00 m/s^2
Rotation X: 0.00, Y: 0.00, Z: 0.00 rad/s
Temperature: 36.53 degC
So it connects but still no readings (I let it run for a little bit and it still gave zeros).
I tried the MPU9250 using the MPU9250_asukiaaa library you gave me using the save GetData example code and I got this.
sensorId: 117
accelX: 0.02
accelY: -0.14
accelZ: 1.21
accelSqrt: 1.22
gyroX: 6.84
gyroY: -4.58
gyroZ: -0.73
cannot read mag so call begin again
Cannot read mag values 2
at 21469ms
sensorId: 117
accelX: 0.01
accelY: -0.14
accelZ: 1.21
accelSqrt: 1.22
gyroX: 6.59
gyroY: -4.39
gyroZ: -0.67
cannot read mag so call begin again
Cannot read mag values 2
From what it looks like it seems that the readings I'm getting are accurate though I need to translate the gyro from rad/s to degrees.
Can I know what board you have selected in the board manager for the ESP32?
Also is there a way to calibrate the gyro using the MPU9250_asukiaaa library since that seems to be the only library that has worked for me so far?
Sorry for the very late reply but the "MPU9250_asukiaaa" library worked for me. I don't know why but that's the only library that worked for me. Either way, it works now, Thanks!