MPU6050(GY-521) showing xyz 000

hey there i m preety newbie in adriuno world

so

i'm measuring al xyz axis just to play with it and check their reading

lets sart from here

i copied codes for MPU6050 in example i tried mpu6050_raw

Now connections

MPU Adriuno

vcc - vcc 5v

gnd - gnd

SCL - A5 ( vcc - 10ko



hm - SCL/A5)

pull up resistor as gpt guided me

SDA - A4 ( vcc - 10kohm - SDA/A4)

OutPut is

11:59:50.212 -> a/g: 0 0 0 0 0 0
11:59:50.246 -> a/g: 0 0 0 0 0 0
11:59:50.246 -> a/g: 0 0 0 0 0 0
11:59:50.246 -> a/g: 0 0 0 0 0 0
11:59:50.246 -> a/g: 0 0 0 0 0 0
11:59:50.246 -> a/g: 0 0 0 0 0 0
11:59:50.246 -> a/g: 0 0 0 0 0 0
11:59:50.246 -> a/g: 0 0 0 0 0 0
11:59:50.280 -> a/g: 0 0 0 0 0 0
11:59:50.246 -> a/g: 0 0 0 0 0 0
11:59:50.246 -> a/g: 0 0 0 0 0 0
11:59:50.246 -> a/g: 0 0 0 0 0 0
11:59:50.246 -> a/g: 0 0 0 0 0 0
11:59:50.246 -> a/g: 0 0 0 0 0 0
11:59:50.246 -> a/g: 0 0 0 0 0 0
11:59:50.246 -> a/g: 0 0 0 0 0 0
11:59:50.280 -> a/g: 0 0 0 0 0 0

any suggestions are appreciated:)

MPU6050_raw.ino

// I2C device class (I2Cdev) demonstration Arduino sketch for MPU6050 class
// 10/7/2011 by Jeff Rowberg <jeff@rowberg.net>
// Updates should (hopefully) always be available at https://github.com/jrowberg/i2cdevlib
//
// Changelog:
//      2013-05-08 - added multiple output formats
//                 - added seamless Fastwire support
//      2011-10-07 - initial release

/* ============================================
I2Cdev device library code is placed under the MIT license
Copyright (c) 2011 Jeff Rowberg

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
===============================================
*/

// I2Cdev and MPU6050 must be installed as libraries, or else the .cpp/.h files
// for both classes must be in the include path of your project
#include "I2Cdev.h"
#include "MPU6050.h"

// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
// is used in I2Cdev.h
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
    #include "Wire.h"
#endif

// class default I2C address is 0x68
// specific I2C addresses may be passed as a parameter here
// AD0 low = 0x68 (default for InvenSense evaluation board)
// AD0 high = 0x69
MPU6050 accelgyro;
//MPU6050 accelgyro(0x69); // <-- use for AD0 high

int16_t ax, ay, az;
int16_t gx, gy, gz;



// uncomment "OUTPUT_READABLE_ACCELGYRO" if you want to see a tab-separated
// list of the accel X/Y/Z and then gyro X/Y/Z values in decimal. Easy to read,
// not so easy to parse, and slow(er) over UART.
#define OUTPUT_READABLE_ACCELGYRO

// uncomment "OUTPUT_BINARY_ACCELGYRO" to send all 6 axes of data as 16-bit
// binary, one right after the other. This is very fast (as fast as possible
// without compression or data loss), and easy to parse, but impossible to read
// for a human.
//#define OUTPUT_BINARY_ACCELGYRO


#define LED_PIN 13
bool blinkState = false;

void setup() {
    // join I2C bus (I2Cdev library doesn't do this automatically)
    #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
        Wire.begin();
    #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
        Fastwire::setup(400, true);
    #endif

    // initialize serial communication
    // (38400 chosen because it works as well at 8MHz as it does at 16MHz, but
    // it's really up to you depending on your project)
    Serial.begin(38400);

    // initialize device
    Serial.println("Initializing I2C devices...");
    accelgyro.initialize();

    // verify connection
    Serial.println("Testing device connections...");
    Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");

    // use the code below to change accel/gyro offset values
    /*
    Serial.println("Updating internal sensor offsets...");
    // -76	-2359	1688	0	0	0
    Serial.print(accelgyro.getXAccelOffset()); Serial.print("\t"); // -76
    Serial.print(accelgyro.getYAccelOffset()); Serial.print("\t"); // -2359
    Serial.print(accelgyro.getZAccelOffset()); Serial.print("\t"); // 1688
    Serial.print(accelgyro.getXGyroOffset()); Serial.print("\t"); // 0
    Serial.print(accelgyro.getYGyroOffset()); Serial.print("\t"); // 0
    Serial.print(accelgyro.getZGyroOffset()); Serial.print("\t"); // 0
    Serial.print("\n");
    accelgyro.setXGyroOffset(220);
    accelgyro.setYGyroOffset(76);
    accelgyro.setZGyroOffset(-85);
    Serial.print(accelgyro.getXAccelOffset()); Serial.print("\t"); // -76
    Serial.print(accelgyro.getYAccelOffset()); Serial.print("\t"); // -2359
    Serial.print(accelgyro.getZAccelOffset()); Serial.print("\t"); // 1688
    Serial.print(accelgyro.getXGyroOffset()); Serial.print("\t"); // 0
    Serial.print(accelgyro.getYGyroOffset()); Serial.print("\t"); // 0
    Serial.print(accelgyro.getZGyroOffset()); Serial.print("\t"); // 0
    Serial.print("\n");
    */

    // configure Arduino LED pin for output
    pinMode(LED_PIN, OUTPUT);
}

void loop() {
    // read raw accel/gyro measurements from device
    accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);

    // these methods (and a few others) are also available
    //accelgyro.getAcceleration(&ax, &ay, &az);
    //accelgyro.getRotation(&gx, &gy, &gz);

    #ifdef OUTPUT_READABLE_ACCELGYRO
        // display tab-separated accel/gyro x/y/z values
        Serial.print("a/g:\t");
        Serial.print(ax); Serial.print("\t");
        Serial.print(ay); Serial.print("\t");
        Serial.print(az); Serial.print("\t");
        Serial.print(gx); Serial.print("\t");
        Serial.print(gy); Serial.print("\t");
        Serial.println(gz);
    #endif

    #ifdef OUTPUT_BINARY_ACCELGYRO
        Serial.write((uint8_t)(ax >> 8)); Serial.write((uint8_t)(ax & 0xFF));
        Serial.write((uint8_t)(ay >> 8)); Serial.write((uint8_t)(ay & 0xFF));
        Serial.write((uint8_t)(az >> 8)); Serial.write((uint8_t)(az & 0xFF));
        Serial.write((uint8_t)(gx >> 8)); Serial.write((uint8_t)(gx & 0xFF));
        Serial.write((uint8_t)(gy >> 8)); Serial.write((uint8_t)(gy & 0xFF));
        Serial.write((uint8_t)(gz >> 8)); Serial.write((uint8_t)(gz & 0xFF));
    #endif

    // blink LED to indicate activity
    blinkState = !blinkState;
    digitalWrite(LED_PIN, blinkState);
}

try running the I2C scanner - see if finds any devices
maybe worth trying the Adafruit_MPU6050 library

i have tried i2c scanner the response is
I2C device found at address 0x68
then after suggested by you i have also tried adafruit libriary the COM3 output is
14:29:15.939 -> *⸮<⸮Adafruit MPU6050 test!
14:29:26.351 -> Failed to find MPU6050 chip
what other things i can do now ?

0x68 is the correct address for the MPU6050 so I would expect the code to work
if I run File>Examples>Adafruit MPU6050>basic_readings I get

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

hope someone else can come up with ideas!

np thanks for ur efforts :slight_smile:

Hey there all PPL out there I have reached to solution after switching to newer mpu6050 sensor thanks alot for ur serious support :pray::slightly_smiling_face:

Reason:

  1. Check if adriuno Uno or any model are orginal if not use pull up resistor 1kohm to 10kohm .

  2. Don't connect ur lines while circuit is open i already lose my first mpu on first reason.

That's all TBH :smile:
Thanks

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