Arduino Uno, MPU 6050, and teapot demo? Not working.

Hi,

I’ve been looking on this forum and other forums trying to figure out why my Teapot demo isn’t working.
I have an Arduino Uno that I connected to the MPU:

VCC → 3.3V
GND → GND
SCL → A5
SDA → A4
INT → 2

Everything in my arduino file is compiling right. I commented out the //#define OUTPUT_READABLE_YAWPITCHROLL and commented in the #define OUTPUT_TEAPOT.

When I compile and run that, I get this set up messages:

Initializing I2C devices...
Testing device connections...
MPU6050 connection failed

Send any character to begin DMP programming and demo:

I also have the teapot code set up in processing, and none of that has a problem that I can see besides some warnings:

1. The field PConstants.OPENGL is deprecated (line 60)
2. Type String[] of the last argument to method println(Object...) doesn't exactly match the varag p... (line 68)

I’ve tried resetting the Arduino, I’m not sure what outputs to make in the Processing code to check things.

Please help! The problem that I’m having is that my airplane just doesn’t move.

MPUTeapot.pde (9.04 KB)

MPU6050_DMP6.ino (15.7 KB)

If you are having the following model of the MPU6050, you need to follow some strict steps to make connection with UNO.

1. Open the MPU6050.h file and not down the address 0x68 or 0x69.
2. If the address is 0x68, make connections as follows (UNO -----> MPU6050):
5V --------------> Vcc
GND ------------> GND
A5(SCL) ---------> SCL
A4(SDA) --------> SDA
GND -------------> AD0

2. If the address is 0x69, make connections as follows (UNO -----> MPU6050):
5V --------------> Vcc
GND ------------> GND
A5(SCL) ---------> SCL
A4(SDA) --------> SDA
5V -------------> AD0

In the MPU6050.h file, things are dfeined as:

#define MPU6050_ADDRESS_AD0_LOW     0x68 // address pin low (GND), default for InvenSense evaluation board
#define MPU6050_ADDRESS_AD0_HIGH    0x69 // address pin high (VCC)
#define MPU6050_DEFAULT_ADDRESS     MPU6050_ADDRESS_AD0_LOW

Also, I put Serial prints on my arduino code. It is stuck in the while loop:

while (!Serial.available());                 // wait for data

Hi.
So I found out that my arduino code is stuck in a while loop:

    // wait for MPU interrupt or extra packet(s) available
    while (!mpuInterrupt && fifoCount < packetSize) {
      Serial.println("STUCK IN WHILE LOOP");
        // other program behavior stuff here
        // .
        // .
        // .
        // if you are really paranoid you can frequently test in between other
        // stuff to see if mpuInterrupt is true, and if so, "break;" from the
        // while() loop to immediately process the MPU data
        // .
        // .
        // .
    }

What’s causing this? How do I get out of this loop?

Does anything inside that while loop update the variables that would allow it to leave the loop?

No, except all of this code is from numerous instructions online. So unless I've copied the wrong code, no one has said anything about editing it besides what I've commented in/out.

This is a pretty popular demo. I'm really just not sure what's going on, if it's my wiring or what.

knorrLover:
This is a pretty popular demo. I’m really just not sure what’s going on, if it’s my wiring or what.

To verify the correctness of your wiring and also the sanity of the sensor, please upload the following simple sketch. This program measures and displays only the temperature acquired by the MPU6050 sensor.

#include <Wire.h>
#include <MPU6050.h>

MPU6050 mpu;   //device address has been keyed in the Library File

void setup() 
{
  Serial.begin(9600); 
  Serial.println("Initialize MPU6050");

  while(!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
  {
    Serial.println("Could not find a valid MPU6050 sensor, check wiring!");
    delay(5000);
  }
}

void loop()
{
  float temp = mpu.readTemperature();

  Serial.print(" Temp = ");
  Serial.print(temp, 2);
  Serial.println(" *C");
  
  delay(2000);
}