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() {}
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.
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.
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.
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.