Hello everyone please I chose to work with an MPU6050 gyroscope and the measurements are not displayed, I did the examples on arduino ide to test the functionality of mpu 6050 with ESP 32 ms in the monitor series I found as results
Nb: *I chose to work with an mpu6050.h library.
*I connected SdA of mpu6050 with D21 of ESP32 and SCL with D22.
I have deleted your other cross-post @mohamed3271.
Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.
Repeated cross-posting can result in a suspension from the forum.
In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.
Thanks in advance for your cooperation.
which library? Connections look OK
I used
// Basic demo for accelerometer readings from Adafruit MPU6050
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
Adafruit_MPU6050 mpu;
void setup(void) {
Serial.begin(115200);
while (!Serial)
delay(10); // will pause Zero, Leonardo, etc until serial console opens
Serial.println("Adafruit MPU6050 test!");
Wire.begin();
// Try to initialize!
if (!mpu.begin(0x68)) {
Serial.println("Failed to find MPU6050 chip");
while (1) {
delay(10);
}
}
Serial.println("MPU6050 Found!");
mpu.setAccelerometerRange(MPU6050_RANGE_8_G);
Serial.print("Accelerometer range set to: ");
switch (mpu.getAccelerometerRange()) {
case MPU6050_RANGE_2_G:
Serial.println("+-2G");
break;
case MPU6050_RANGE_4_G:
Serial.println("+-4G");
break;
case MPU6050_RANGE_8_G:
Serial.println("+-8G");
break;
case MPU6050_RANGE_16_G:
Serial.println("+-16G");
break;
}
mpu.setGyroRange(MPU6050_RANGE_500_DEG);
Serial.print("Gyro range set to: ");
switch (mpu.getGyroRange()) {
case MPU6050_RANGE_250_DEG:
Serial.println("+- 250 deg/s");
break;
case MPU6050_RANGE_500_DEG:
Serial.println("+- 500 deg/s");
break;
case MPU6050_RANGE_1000_DEG:
Serial.println("+- 1000 deg/s");
break;
case MPU6050_RANGE_2000_DEG:
Serial.println("+- 2000 deg/s");
break;
}
mpu.setFilterBandwidth(MPU6050_BAND_21_HZ);
Serial.print("Filter bandwidth set to: ");
switch (mpu.getFilterBandwidth()) {
case MPU6050_BAND_260_HZ:
Serial.println("260 Hz");
break;
case MPU6050_BAND_184_HZ:
Serial.println("184 Hz");
break;
case MPU6050_BAND_94_HZ:
Serial.println("94 Hz");
break;
case MPU6050_BAND_44_HZ:
Serial.println("44 Hz");
break;
case MPU6050_BAND_21_HZ:
Serial.println("21 Hz");
break;
case MPU6050_BAND_10_HZ:
Serial.println("10 Hz");
break;
case MPU6050_BAND_5_HZ:
Serial.println("5 Hz");
break;
}
Serial.println("");
delay(100);
}
void loop() {
/* Get new sensor events with the readings */
sensors_event_t a, g, temp;
mpu.getEvent(&a, &g, &temp);
/* Print out the values */
Serial.print("Acceleration X: ");
Serial.print(a.acceleration.x);
Serial.print(", Y: ");
Serial.print(a.acceleration.y);
Serial.print(", Z: ");
Serial.print(a.acceleration.z);
Serial.println(" m/s^2");
Serial.print("Rotation X: ");
Serial.print(g.gyro.x);
Serial.print(", Y: ");
Serial.print(g.gyro.y);
Serial.print(", Z: ");
Serial.print(g.gyro.z);
Serial.println(" rad/s");
Serial.print("Temperature: ");
Serial.print(temp.temperature);
Serial.println(" degC");
Serial.println("");
delay(5000);
}
serial monitor displays
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.04, Y: 0.39, Z: 8.35 m/s^2
Rotation X: 0.15, Y: 0.03, Z: 0.00 rad/s
Temperature: 22.04 degC
Acceleration X: 0.42, Y: 2.15, Z: 7.68 m/s^2
Rotation X: 0.07, Y: -0.65, Z: -0.07 rad/s
Temperature: 22.16 degC
Acceleration X: -3.13, Y: 4.82, Z: 5.66 m/s^2
Rotation X: -0.51, Y: -0.52, Z: -0.24 rad/s
Temperature: 22.23 degC
Acceleration X: 0.91, Y: -0.04, Z: 9.27 m/s^2
Rotation X: 1.01, Y: 0.07, Z: 0.09 rad/s
Temperature: 22.27 degC
Acceleration X: 0.01, Y: -0.51, Z: 8.30 m/s^2
Rotation X: 0.15, Y: 0.03, Z: 0.01 rad/s
Temperature: 22.31 degC
Acceleration X: 0.03, Y: -0.51, Z: 8.31 m/s^2
Rotation X: 0.15, Y: 0.03, Z: 0.01 rad/s
Temperature: 22.35 degC
Acceleration X: 0.02, Y: -0.51, Z: 8.30 m/s^2
Rotation X: 0.15, Y: 0.03, Z: 0.00 rad/s
Temperature: 22.37 degC
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.