i tried to test whether my MPU6050 is sending proper data to Arduino but the result keep showing 0. how do i fix this?
With a new I2C device, always test I2C function first, by running the I2C Address Scanner program. Check for the appearance of the expected address.
In the future, please post text and code properly, using quote and code tags, rather than pictures.
i am sorry this is my first time using this platform. btw, i am using Arduino uno. i have run I2C Scanner Sketch. it says "I2C device found at address 0x68 !". this is the connections:
|VCC--->5V|
|GND---->GND|
|SDA---->A4|
|SCL---->A5|
#include <Wire.h>
#include <I2Cdev.h>
#include <MPU6050.h>
MPU6050 mpu;
void setup() {
Wire.begin();
Serial.begin(9600);
Serial.println("Initializing I2C devices...");
mpu.initialize();
Serial.println("Testing MPU6050 connection...");
if (mpu.testConnection()) {
Serial.println("MPU6050 connection successful");
} else {
Serial.println("MPU6050 connection failed");
}
}
void loop() {
int16_t ax, ay, az, gx, gy, gz;
mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
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);
delay(500);
}
but the result still showing "a/g: 0 0 0 0 0 0"
The MPU-6050 uses 3.3V logic levels. To connect it to a 5V Arduino, bidirectional logic level shifters are required. Example.
The MPU-6050 has long been obsolete. Much better ones are available these days, some with the logic level shifters built in.
Better, since almost all sensors are now 3.3V, use a 3.3V Arduino board and connect them directly together.

