Go Down

Topic: MPU6050 SparkFun Breakout to Arduino Uno - No Communication (Read 28811 times) previous topic - next topic

Krodal

#30
Jul 10, 2012, 07:40 pm Last Edit: Jul 10, 2012, 07:42 pm by Krodal Reason: 1
I alread mentioned my sketch : http://arduino.cc/playground/Main/MPU-6050
And it is easier then the Jeff Rowberg code. It doesn't need the interrupt.
On the page there is a link to a i2c_scanner, the device must be visible on the I2C-bus first.
If my sketch is working, you can try the serious code by Jeff Rowberg.

kas

Hi Krodal,

Thanks for your very informative playground article
I bought a GY-52 breakout board which seems rather similar to yours (same manufacturer):



I connected as follow:
VCC - 5V
GND - GND
SCL - A5
SDA - A4

and loaded your code http://arduino.cc/playground/Main/MPU-6050
Amazingly enough, it worked first time

Now, I try to understand why it works  :P  :P
No additional pull up resistors on SDA/SCL
ADO seem to be pulled down (0X68)

Would you mind checking your onboard regulator output, mine is 4.3V with 5V or 3.3V supply
according to datasheet, seems a bit high
Please check the above photo for possible pullup resistors

My final project is a new/better Balancing Robot http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1284738418

Thanks again for this great job
- Rubik's cube Robot solver                 forum.arduino.cc/index.php?topic=271827.0
- Android Bluetooth joystick               forum.arduino.cc/index.php?topic=173246.0
- Balancing robot for dummies           forum.arduino.cc/index.php/topic,8871.0

kas

Answering partially my own questions
Not familiar with SMD  :smiley-roll:
The black components with 3 digits are actually resistors (http://www.hobby-hour.com/electronics/3-digit-smd-resistors.php)
331: 330 ohms
103: 10K
472: 4.7K

So, two 10K pull up resistors
Google is definitly your best friend  ;)  ;)

btw, this board can be had for 15 bucks shipped (Google ...)
- Rubik's cube Robot solver                 forum.arduino.cc/index.php?topic=271827.0
- Android Bluetooth joystick               forum.arduino.cc/index.php?topic=173246.0
- Balancing robot for dummies           forum.arduino.cc/index.php/topic,8871.0

Krodal

#33
Jul 29, 2012, 11:59 pm Last Edit: Jul 30, 2012, 06:06 am by Krodal Reason: 1

...
Thanks for your very informative playground article
...
Would you mind checking your onboard regulator output, mine is 4.3V with 5V or 3.3V supply
...


I'm glad my sketch did help.

I have a good multimeter. My +5V is 4.95V and the 3.3V of the breakout board is 3.31V.
Also the XDA and XCL of the sub-I2C-bus pins are 3.31V (I think they have a pull-up somewhere).
My MPU-6050 is connected to the I2C via a level shifter, so I have not current flow from the I2C to the MPU-6050 voltage.
Can you measure the SDA and SCL (while not active), and check the XDA and XCL ?

Your breakout board has 10k pull-up resistors to the 3.3V.
That should be 4k7 to be safe.
I think that it might perhaps cause the higher voltage.
Can you add another two pull-up resistors of 10k from the SDA and SCL to the 3.3V of the Arduino board ?

The 4k7 prevents that the internal pull-up resistors in the avr chip (on the Arduino board) raises the voltage of the I2C too high for 3.3V devices.

I have added your GY-52 breakout board : http://arduino.cc/playground/Main/MPU-6050

kas

Thanks,

Rechecked voltage: 3.32V   
go figure  :smiley-roll-blue:   I should add some water in my Bordeaux...

I will put additional resistors on SDA and SCL, on the Arduino side
I guess the original 10K's are OK when more sensors are added to the I2C Bus
- Rubik's cube Robot solver                 forum.arduino.cc/index.php?topic=271827.0
- Android Bluetooth joystick               forum.arduino.cc/index.php?topic=173246.0
- Balancing robot for dummies           forum.arduino.cc/index.php/topic,8871.0

Hey guys, who can explain what VLOGIC at 3.3V does to I2C? Does it bring the binary logic level up to 6.6V? Thanks


This is my wiring, all direct connections, no resistors. The simplest wiring possible i think.

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



chazm try this exactly this wiring, take out the resistors, and try to disconnect not mentioned pins.
I may be wrong about the sleep bit, so this is a little more complex code which solves that, it should output accelerometer x values.

This is a video of me executing this code.

http://youtu.be/mtuQPSGQCHE

Code: [Select]
#include <Wire.h>

#define MPU6050_ACCEL_XOUT_H  0x3B
#define MPU6050_ACCEL_XOUT_L  0x3C
#define MPU6050_ACCEL_YOUT_H  0x3D
#define MPU6050_ACCEL_YOUT_L  0x3E
#define MPU6050_ACCEL_ZOUT_H  0x3F
#define MPU6050_ACCEL_ZOUT_L  0x40
#define MPU6050_GYRO_XOUT_H   0x43
#define MPU6050_GYRO_XOUT_L   0x44
#define MPU6050_GYRO_YOUT_H   0x45
#define MPU6050_GYRO_YOUT_L   0x46
#define MPU6050_GYRO_ZOUT_H   0x47
#define MPU6050_GYRO_ZOUT_L   0x48
#define MPU6050_PWR_MGMT_1    0x6B

#define MPU6050_I2C_ADDRESS   0x68

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

void setup() {
 uint8_t c = 0;
 
 Serial.begin(9600);
 Wire.begin();
 
 MPU6050_write(MPU6050_PWR_MGMT_1, &c, 1); //Stop device from reseting/sleeping

 Serial.println("START");
}

void loop() {
 
 ax = calculate_value(MPU6050_ACCEL_XOUT_H, MPU6050_ACCEL_XOUT_L, 1);
 ax = (ax-32500)/8.192;
 
 Serial.println(ax);
}

uint16_t calculate_value(int address_h, int address_l, int size) {
 
 uint8_t hi, lo;
 uint16_t value;
 
 hi = MPU6050_read(address_h, size);
 lo = MPU6050_read(address_l, size);
 
 value = ((hi)<<8);
 value |= lo;
 
 return(value);
 
}

uint8_t MPU6050_read(int address, int size) {
 
 uint8_t value;
 
 Wire.beginTransmission(MPU6050_I2C_ADDRESS);
 Wire.write(address);
 Wire.endTransmission(false);

 Wire.requestFrom(MPU6050_I2C_ADDRESS, size, true);
 while(Wire.available()) {
   value = Wire.read();
 }
 
 return (value);
}

int MPU6050_write(int address, uint8_t *data, int size) {
 
 Wire.beginTransmission(MPU6050_I2C_ADDRESS);
 
 Wire.write(address);        // write the start address

 Wire.write(data, size);  // write data bytes

 Wire.endTransmission(true); // release the I2C-bus
 
 return (0);         // return : no error
}




hi OBAKEMONO! I have a mpu6050. I want to use for myquadcopter.I use PIC16F877 as process.I use CCS C as program language.But I dont know how to use this sensor.which pin connect to PIC16F877.is the INT pin used? can you tell me which pin connect to where? wait your answer!!
THANKS...


Check your wiring once more.
AD0 must be connected to ground or 3.3V (with solder jumper). Connect it to ground for I2C address 0x68.
SCL and SDA are connected directly to the Arduino, but you could add extra pull-up resistors to the 3.3V. The resistors could be 4k7 or 10k (the board already has 10k pull-up resistors, but I prefer 4k7).
You don't need the INT, you could leave it open.
The CLKIN and FSYNC can be tied to ground, because they are not used.

If you have all this, the scanner sketch should be able to find it.


I'm confused !
Is this crossposting ?  http://arduino.cc/forum/index.php/topic,111698.0.html
If you bought a new sensor module, and started a new topic, you should have mentioned at the beginning that you made this posting before.
It's okay, as long as you let us know.



hi KRODAL! I have a mpu6050. I want to use for myquadcopter.I use PIC16F877 as process.I use CCS C as program language.But I dont know how to use this sensor.which pin connect to PIC16F877.is the INT pin used? can you tell me which pin connect to where? wait your answer!!
THANKS...

Krodal

That is the Sparkfun breakout board, https://www.sparkfun.com/products/11028

Connect it as written a few posts earlier.
Vcc and Vio to 3.3V
SDA and SCL are the I2C bus. The Sparkfun board has already 10k pull-up resistors.
Gnd to Gnd.

I don't know PIC microcontrollers. Do they have a I2C bus ?

Fedefuz

hello guys..

i have a problem with the "MPU6050_DMP6" sketch from GitHub that Jeff has posted...and just with that..  (https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/Examples/MPU6050_DMP6/MPU6050_DMP6.ino).

I have a MPU6050 SparkFun Breakout connected to an Arduino MEGA 2560 and i've followed all the instructions for wiring and all as well as looking at almost all the posts of this and Arduino's forum for, but haven't really found a solution:

so basically, once finished uploading the sketch "MPU6050_DMP6, i see on the Arduino Mega
the TX led going ON for about 1 second, and then stopping any transmission. On the Serial Monitor,
instead, i see a short message like "Myÿ£eæÇô¸".

The "RAW" example sketch works giving me some weird digit values on the Serial Monitor like:
$°°gŵ 40ű°Åµ0¥?ű°§40ű°•Ì §%Å°°Åµ†4%°1$.....and goes on forever

the "I2CScanner.pde" sketch from Tod E. Kurt (http://todbot.com/blog/) something like:
òö(åà÷s a÷s à÷sL»÷sLà÷s à÷s (à÷sL»÷sLà÷såà÷s....

while instead the example sketch from Krodal (http://playground.arduino.cc/Main/MPU-6050?action=sourceblock&num=1) is actually working perfectly:

Inyro, error = 0
accel x,y,z: 304, -532, 17572
temperature: 30.153 degrees Celsius
gyro x,y,z : -169, -49, 204,
l, temp and gyro, error = 0
accel x,y,z: 304, -532, 17572
temperature: 30.153 degrees Celsius
gyro x,y,z : -169, -49, 204,
InvenSense MPU-6050
June 2012
WHO_AM_I : 68, error = 0
PWR_MGMT_1 : 0, error = 0

and on and on with correct the data readings.....

as well as working are all the patches from this previous page of the forum:
http://forum.arduino.cc/index.php?PHPSESSID=khqj3vmde300r2lokg3aakuh37&topic=103408.15

I'm sorry but i really cannot figure out what is the problem, i've tried to #include the "Wire.h",
#define whatever MPU6050_ACCEL_XOUT_H  0x3B and so on, but the Main patch gives me always
those unreadable values on the Serial Monitor..

Do you maybe have a clue on what is wrong?

thanx a lot!


Federico

michinyon

Your problem would appear to be a speed mismatch between your arduino and your computer.

Go Up