Pages: [1] 2 3   Go Down
Author Topic: MPU6050 SparkFun Breakout to Arduino Uno - No Communication  (Read 24602 times)
0 Members and 1 Guest are viewing this topic.
NYC
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To whom it may concern,
First-off, thank you for taking the time and reading this.
I am doing a school project that will keep a servo level by using an MPU6050 SparkFun Break out board. I am developing this by first experimenting through an Arduino UNO and, in the future, planing to connect it to a ProMini.
My problem is that the MPU6050 is not producing any readings when connected (directly) to the UNO.
Connections: MPU6050 - Arduino UNO
VDD - 3.3V
GND - GND
INT - DIGITAL 2
SCL - A5
SDA - A4

I am using code and libraries from here: https://github.com/jrowberg/i2cdevlib/tree/master/MPU6050
And have also received an MPU_Test code from Jeff to basically test for the WHO_AM_I Register which worked for him.

These are the reading I get in the Serial Monitor when trying the DMP6, RAW, & MPU_TEST examples respectively:
DMP
Code:

o 0...
d flag...
.


Resetting MPU6050...?H
2
g
?H
2
g
i
ê bG¤õ êi
Checking hardware revision...
Revision @ user[16][6] = 0
Resetting m êi
Reading OTP bank valid flag...
OTP bank is valid!

1
1
1




1929
ERROR! DMP code veri??H

 

RAW:
Code:
Initializing I2C devices...
Testing device connections...
MPU6050 connection failed
a/g: 0 0 0 0 0 0
a/g: 0 0 0 0 0 0
a/g: 0 0 0 0 0 0
a/g: 0 0 0 0 0 0
a/g: 0 0 0 0 0 0
a/g: 0 0 0 0 0 0
a/g: 0 0 0 0 0 0
a/g: 0 0 0 0 0 0


MPU_Test:
Code:
I2C bus connected.
Checking WHO_AM_I register contents: 0xFF
Disabling sleep mode...
-1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1


I have spoken to SarkFun, Jeff, and got an ADXL345 to test the I2C connection on the UNO (which worked). After thinking that it was a faulty MPU, I received another one (tested at SparkFun's location). Note: From what I know, Jeff tested the MPU on a MEGA1280 and an veal board from InvenSense.
I really appreciate your help. Thank you,

Roman
Logged

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11718
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That breakout board is this one right http://www.sparkfun.com/products/11028 ??

It cannot be directly connected to the Uno, its a 3.3V board.  You may have fried it.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ya I had the same issue with the MPU6000 and an UNO except SPI.  I was able to get away with some low resistance voltage dividers to bring the voltage down to 3.3 V.  You probably didn't fry it though since I believe it can handle 5V on the data lines.  I would also try tieing VIO to VDD if you have the sparkfun breakout board.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just plugged it in and it works with the Uno at 5V I2C... I thought it wouldn't but then again I never really looked at the datasheet.  I was using the latest I2C dev library off of github, using example code raw data, pin connections SCL-A5 SDA-A4 GND-GND VDD-3.3V VIO-3.3V, make sure the serial monitor is at 38400 and you should see streaming data.  Good luck!
Logged

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11718
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ya I had the same issue with the MPU6000 and an UNO except SPI.  I was able to get away with some low resistance voltage dividers to bring the voltage down to 3.3 V.  You probably didn't fry it though since I believe it can handle 5V on the data lines.  I would also try tieing VIO to VDD if you have the sparkfun breakout board.

inputs have to be between -0.5V and Vdd+0.5V, not 5V compatible.  resistive dividers or level shifter needed.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think that I'm having the same no communication problem. I'm using an Arduino Duemilanove. I get the same error:
MPU6050 connection failed
a/g:   0   0   0   0   0   0

I'm not using any resistors.

I think that the problem might be with my installation of the mpu6050 library.
I've noticed that when I import the mpu6050 library the mpu6050 part stays black. Whereas the all the other libraries' text turns red.
For example
#include <MPU6050.h>
instead of
#include <I2Cdev.h>
Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 594
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Once I accidentally configured USER_CONFIG register to disable I2C, while using I2C, and then the MPU never responded, kind of like what you appear to show.

You need pull-up resistors, probably should disable the internal 5V resistors and use your own 4K7 resistors to 3.3V
Logged

Freelance engineer, consultant, contractor. Graduated from UW in 2013.

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I finally got around to using the external 4k7 Ohm resistors. I still get the same error.  I'm using the same code as the original poster so I don't know if it has anything to do with USER CONFIG.  I think that I'm making some noob mistake with the installation of the library. Out of all of my libraries the MPU6050 doesn't red text where all the others do.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

chazm, did you check this link?

http://www.i2cdevlib.com/devices/mpu6050#help
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you mixx. I checked out the link and I think that it's a step closer to the solution.
From the link the problem that I'm having the solution to the problem are posted:

I connected my MPU-6050 breakout board and it seems to be responding correctly, but all I get are zeros from the accel/gyro sensor registers! What's wrong?
This is a very common problem, and fortunately one that is very easy to fix. When the device powers on, it starts up in sleep mode, which must be explicitly disabled in order to begin normal operations. To do this, simply write a 0 to the PWR_MGMT_1 (0x6B) register. If you are using the I2Cdev MPU6050 class, calling _device_.setSleepEnabled(false) will set the correct bit for you.

I didn't know how to use the command:
calling _device_.setSleepEnabled(false)

So I decided to write 0 to PWR_MGMT_1 (0x6B)
0x6B turns out to be 107 in decimal so i added the following code to void setup();
Wire.beginTransmission(107);
Wire.send(0);
Wire.endTransmission();

I still get the same error, but when I looked at the registry map for the mpu6050, I notice that bit number 6 of 0x6B controls the sleep settings. I think that I just need to write 0 to that individual bit. I don't know how to do this yet, I'm still searching to figure out how to write this individual bit instead of the whole PWR_MGMT_1.
Thanks again mixx for setting me in the right direction.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi.

I was having the same problem, but finally found the solution.
Forget about resistors, what you need to do with SparkFun's MPU-6050 is to connect the VIO pin to the same 3.3v supply that VDD is connected to.

The sleep settings in SparkFun's board are correct from default, so you don't need to change the sleep bit value.

Also the I2C bus is a bit tricky, you must write the registry address you want to write to or read from to the I2C address which is 0x68 by default, and then do the Wire.requestFrom to this address.

VDD ----> 3.3v
GND ----> GND
SDA ----> A4
SCL ----> A5
VIO ----> 3.3v (same VDD supply)

And you are ready to go, the following code should read the WHO AM I registry with a 0x68 output.

Code:
#include <Wire.h>

#define MPU6050_WHO_AM_I    0x75 
#define MPU6050_I2C_ADDRESS 0x68  //The I2C default address for MPU-6050

void setup() {
 
  Serial.begin(9600);
  Wire.begin();
   
  Serial.println("Who am i?");
 
  //This part, tells the I2C default address you want to read from
  //MPU6050_WHO_AM_I registry
  Wire.beginTransmission(MPU6050_I2C_ADDRESS);
  Wire.write(MPU6050_WHO_AM_I);
  Wire.endTransmission(false);

  //You read the data in MPU6050_WHO_AM_I registry through I2C default
  //address, set in the previous step.
  Wire.requestFrom(MPU6050_I2C_ADDRESS, 1, true);
  while(Wire.available()) {
    Serial.print("0x");
    Serial.println(Wire.read(), HEX);
  }
}

void loop() {
}
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm starting to think that my sensor may actually be broken. I tried your code Obakemono, and all I saw on the Serial Monitor was:

Who am i?
Who am i?

I think that I may have broken it by not using resistors when I first got the device. I didn't use resistors for about a couple weeks, then I hooked up 4k7s on the I2C lines.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No resistors are needed if you power the board with 3.3v.
I have had it running with 5v by mistake for a while and it isn't fried.

¿Can you post a picture of your wiring please?
I'll do the same in a couple of hours, i can't right now.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm having the same problem as you. I've loaded Obakemono code on my duemilanove nano, wiring just like you said, only my board has different pins, actualy has a 5v pin, 3.3v, GNd, SCL, SDA, INT.
Everithing should work but I only see "who am I?" on the serial monitor.

just looking at the code, the addres shoul be x68 or x6B????



* Photo 25-06-12 23 01 31.jpg (875.09 KB, 2592x1936 - viewed 324 times.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The mpu 6050 is connected to an Arduino Duemilanove through a SparkFun ProtoShield.
The VDD and VIO are connected together with the yellow wire and then to the 3.3v.
The Gnd is connected to the CLK and they are then both grounded with a grey wire.
The SCL is connected to Analog pin5 through a 4k7 Ohm resistor.
The SDA is connected to Analog pin4 through a 4k7 Ohm resistor.
INT is connected to Digital pin2.


* IMG_20120625_233632.jpg (787.34 KB, 2592x1944 - viewed 260 times.)
Logged

Pages: [1] 2 3   Go Up
Jump to: