Problem with a Sparkfun MPU6050

Hello.

I encountered a problem during one of my project.

I have a accelerometer MPU-6050 sell by Sparkfun ((https://www.sparkfun.com/products/11028), but the I only have zero on the monitor (when i have something). I have tried several combination and several code, the ones on this site and the ones on github (i2cdevlib/Arduino/MPU6050 at master · jrowberg/i2cdevlib · GitHub) but nothing change, I only have zero or nothing.

I think my problem come from the fact that I don't connect correctly the card and the sensor and/or I have not correctly calibrate the I2C protocol.

I use a leonardo card.

Thank for all help you can give me.

You have given us little to work with to help you. A clear photo of the wiring of your project would help. Make sure that we can see all of the wires and where they go. Also the code that you tried and a description of what the code actually does and how that differs from what you expect.

I have not correctly calibrate the I2C protocol.

What does that mean? I have never heard of the need to calibrate the I2C protocol.

It's the second time use arduino so I still really new.

The program is a basic display of the G force and the position of the accelerometer in the monitor. Nothing really difficult but i have problem to recover the data from the sensor. All I have is zero in all the variable.

For the wires:

I have four connections:
Leonardo -> MPU6050
SDL -> SDL
SDA -> SDA
5V -> VCC
GND -> GND

If I try other connection (for example use the INT like I have see on several tuto) it display me nothing.

For the I2C forget what I said I was not sure of how to use it but I figured out.

I have read that the VIO pin needs to be connected to 3.3V (NOT 5V). From the Sparkfun product page comments:

I didn’t see anything in the provided documentation from Sparkfun about having to connect the VIO line to a 3V3 source as an IO Reference voltage. This should be documented better.

The first thing that I do when I have trouble with an I2C device is to run an I2C scanner sketch to confirm that I am using the right I2C address and that the device is communicating over the bus.

Try this I2C scanner and, please, report the results.

// I2C scanner by Nick Gammon.  Thanks Nick.

#include <Wire.h>

void setup() {
  Serial.begin (115200); //*****  make sure serial monitor baud matches *****

  // Leonardo: wait for serial port to connect
  while (!Serial) 
    {
    }

  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
  
  Wire.begin();
  for (byte i = 1; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() {}

From the picture it looks like the blue wire is connected to AREF (not SDA) on the Arduino.

From the picture it looks like the blue wire is connected to AREF (not SDA) on the Arduino.

Sure does. Good eye.

I have connected the VIO to a 3.3V alim and it work. I cannot bielieve it's just that. I have spend four hours trying to understand what was not okay.

GroundFungus, for your I2C tester where i connect the TX and RX on the sensor?

bms001:
From the picture it looks like the blue wire is connected to AREF (not SDA) on the Arduino.

And yes when I connected the sensor and the card for the pictures I have misconnected SDA. My bad.

Thank for your help.

GroundFungus, for your I2C tester where i connect the TX and RX on the sensor?

You leave the sensor connected normally to the I2C pins. Upload the sketch. When it is uploaded, open the serial monitor. Make sure that the serial monitor baud rate is 115200. You may need to reset the Arduino, but you should see the output from the scanner.

Done.

I have that:

I2C scanner. Scanning ...
Found address: 104 (0x68)
Done.
Found 1 device(s).

I think is good no?

I think is good no?

Probably not.

Although it appears from that simple test to be working, the module has very likely been damaged by connecting to 5V. You cannot trust it to function properly, if at all.

jremington:
Probably not.

Although it appears from that simple test to be working, the module has very likely been damaged by connecting to 5V. You cannot trust it to function properly, if at all.

Seriously, but in several tuto it's on the 5V. I know that the datasheet said 2.375-3.46V but it worked on 5V.

But It's true that the result on the X axies are weird.

Thank for the info.

Seriously, but in several tuto it's on the 5V.

There is an unbelievable amount of incorrect information on the internet. Any goofball can post a "tuto".

Always read the datasheet for the module and/or the chip. If the datasheet said 2.375-3.46V, then you should never expose it to any higher voltage. That includes the I/O pins! I'm surprised the module works at all.

Don't worry, I've certainly fried a few boards by not paying attention, and I think most other forum members have too.

There are different MPU6050 boards with different requirements. Some have voltage regulators and require 5V power. The SparkFun board does not, so it needs 3.3V. Mixing and matching boards and tutorials does not work.