Problems with I2C Communication Using Arduino Uno & GY-85 IMU

Dear all,

I have an arduino uno and a GY-85 IMU sensor. I wired it up similar to this: https://theccontinuum.files.wordpress.com/2012/09/gy-80.png

I am using the Wire.h to implement I2C Communication the ADXL345 (Address 0x53). Wire.endTransission() returns very often "Error: 2". Does someone know that problem?

Here is my code. It starts the transmission (Wire.beginTransmission(0x53)) and immidiatly stopps it again. I need to retry the transmission at least 3 to 4 times, otherwise i get error = 2.

I know error = 2 means: received NACK on transmit of address. But I don't how to solve the problem.

Can anyone help me?
Best regards
natasia

#include <Wire.h>

void setup()
{
  Wire.begin();
  Serial.begin(9600);
  Serial.println("\nI2C Scanner");
  delay(100);
}

void loop()
{
  byte i = 0; byte error = -1;
  while (error != 0){
    Wire.beginTransmission(0x53);
    error = Wire.endTransmission();
    i++;
  }
  Serial.print("got it ");
  Serial.println(i);
  
  delay(500);
}

Hi, welcome to the forum.

The error is not printed, how can you tell what the error was ?
Trouble with I2C can be: wrong cable (for example flat ribbon cable) or long cables (more than 50cm) or a breadboard with bad contacts.

Hey Peter,

thanks for your answer. Right, in that source code i don't print the error. But after trying and reserching for one day, I know that error code :wink:

I use breadbord cables. The length is about 5 to 10 cm. I will try to measure the resistance of the breadboard contacts plus cables later. Since it is a new breadboard, i think (hope) the conectors shoud be fine...

Maybe try a couple additional pullup resistors. Try a 10K from 5v to both the SDA and SCL lines on the breadboard.

A module like this ? GY-85 6DOF 9DOF IMU Sensor Module for Arduino - Free shipping - DealExtreme

That one has a level shifter on the board. With pullup resistors already on the board on both sides of the level shifter.
Wait a moment... In the photo at dx.com, I see 4 pullup-resistors of 2k2. That is nuts. Those values are too low.

Can you read the resistor values of the 4 resistors. In the middle, near the connection holes. If they all 4 say "222", that is too low. In that case, you have to replace and/or remove some/all of them.

Because of the level shifter and voltage regulator on the GY-85, apply Arduino 5V to GY-85 VCC_IN. Do not connect the GY-85 3.3V.

Hey,

thanks for the answers. The problem is solved. As peter sugested it was a problem with "bad contacts". The ground cable had a resistance of more than 1000k. I replaced that cable and now it works fine.

Thank you
natasia