Weird output symbols on MPU6050

Hi!I hope someone can help me out. Im getting a weird output for Jeff Rowberg's MPU6050_DMP6 sketch (https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/Examples/MPU6050_DMP6/MPU6050_DMP6.ino)

. Heres a screenshot of the output (WHICH HAS BEEN ATTACHED ALSO):

As you can see, the first characters (initialization) looks ok, but then it goes crazy.

I have tried with different serial baud rates.

My board is Atmega 2560 and the MPU6050 breakout board is GY-521

This is how I connected my pins:

VCC -> 5v
GND -> GND
SDA - > SDA (pin 20 in communications)
SCL -> SCL (pin 21 in communications)
INT -> DIGITAL 2

Am I missing something? Is there anything I have to change in the code to make it work? Thanks

I think you have everything right. The connections are okay.

The dmp example set the baud rate to 115200. So you should use that also in the serial monitor. Or you could change the sketch and use the default 9600.

Can you attach the screenshot ?

Do you use a breadboard ? They cause many problems with bad connections.

You could try a I2C level shifter.

Thanks for replying. I have tried changing the baud rates in both, the serial monitor and the sketch but no improvements. And just attached the image.

When you say i2c level shifter you mean the pull up resistors? I have a 10k ohm resistor between VCC and SDA and between SCL and VCC. Should I try other Resistor values?

And no, we are not in a breadboard.

Should I modify anything in the sketch in this part?

// class default I2C address is 0x68
// specific I2C addresses may be passed as a parameter here
// AD0 low = 0x68 (default for SparkFun breakout and InvenSense evaluation board)
// AD0 high = 0x69

again, thanks!

Now its working! :slight_smile: Well only what i needed... Luckily I didnt need OUTPUT_TEAPOT

I commented out

//#define OUTPUT_TEAPOT

and uncommented

#define OUTPUT_READABLE_YAWPITCHROLL

And i am getting yaw,pitch and roll (which is what I need)

1 Like

hello, I am now doing my FYP project. I am start using MPU6050 and I am not so familiar with programming. I have to research this by myself and I find the problem like this. I am using the same code.
May I know how you commented out and uncommented the original code.
Thanks.

In the file MPU6050_DMP6.ino
You see these blocks:

// uncomment "OUTPUT_READABLE_QUATERNION" if you want to see the actual
// quaternion components in a [w, x, y, z] format (not best for parsing
// on a remote host such as Processing or something though)
//#define OUTPUT_READABLE_QUATERNION

The define is not active, because it is commented out with the "//".
If your remove the "//" in front of the "#define", it is active and used by the compiler.

I got DMP Initialization fail...
I don't know how to do it. :frowning:

Run the i2c scanner, Arduino Playground - I2cScanner
See the sketch if the address is set properly (0x68 or 0x69).
Did you connect INT to Arduino pin 2 ?

Hello i`m having a problem reading data from the sensor, i get this message:
Initializing I2C devices...
Testing device connections...
MPU6050 connection failed

Send any character to begin DMP programming and demo:

the sensor is default InvenSense, 0x68 is his address which ive implemented like follows: MPU6050 mpu(0x68); in his code, ive done all the wire connections good, the i2c sacanner said it found the sensor at 0x68 address.
Please, help!

There seems to be a problem in the connection, perhaps a bad connection or wrong voltage or wrong pull-up resistors or very long wires.
Do you use a breadboard, they sometimes have bad contacts.
Which Arduino board are you using ?
Which sensor board do you have, and how have you connected it ? Vcc to 5V pin or 3.3V pin ?

yes ive used a breadboard in my experiments, but now ive some connectors and ill try again. As for the connection and voltages, it says here https://www.sparkfun.com/products/11028 that the voltage should be between 2.6 and 3.3V, im using a ArduinoUNO board and i supply the sensor with 3.3V included on the board. I must get this problem solved today, it can`t go on like this! Ow yea, and the supplyer said i should give 3.3V to the VIO pin aswell.. the i2c scanner detected it when i gave the 3.3V to the VIO pin, but not before that...
Thanx for the answer on such a short notice, as i said, today it must work!

If you have that Sparkfun board, you should power it with the 3.3V pin of the Arduino Uno.
For a board from Ebay it could be different.
If the I2C scanner found the address at 0x68, the I2C bus is working.

Connect the 3.3V to both the VCC and the VIO.

Run this simplified test: Arduino Playground - MPU-6050
If that is without error, the chip is okay.

Next step is using the i2cdevlib
http://www.i2cdevlib.com/

Start with the easy example
https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/Examples/MPU6050_raw/MPU6050_raw.ino

If that is okay, connect the INT of the sensor board to digital pin 2 of the Arduino board.
Now (at last) you can try the full dmp example
https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/Examples/MPU6050_DMP6/MPU6050_DMP6.ino

Use the #define in the example sketch to select what kind of data you want to send to the PC.

Thank you very much for your help! its working like a charm, i managed to see all the data types the imu can send, euler angles, quaterion, raw values. This is so exciting, cant wait to use it for my balancing robot project, do you have some nice references for me to look at? has someone done a balancing robot project with this imu?? or at least, which data type should i use? which is better, i`m working with Y axis for the acceleration and X axis for gyro :slight_smile: Some pointers for a newbie please! :slight_smile:

This is a good guide, http://forum.arduino.cc/index.php/topic,58048.0.html

You should not think in x and y, but in 3D.

If you understand quaternions, you understand more than I do.