gevo12321

ok so I tried: (I also tried setting the values to HIGH) digitalWrite(A4,LOW); digitalWrite(A5,LOW);it didn't work. I am guessing because :

"This sensor board has a voltage regulator. So it can be used with 3.3V and with 5V. It has pull-up resistors of 2k2 on the I2C-bus. The value of 2k2 is rather low. If it is combined with other sensor board which have also pull-up resistors, the total pull-up impedance might be too low."

did you configure both A4 and A5 as input first?It does not matter what the pullup on your board is. what matters is the cpu internal pullup is to 5v and your sensor board pullup is to 3.3v and you don't want to mix them. A4 and A5 are special pins that are open collector specifically designed so if you disable the internal pull up, only the external pullup wll be used. its all in the atmega328 datasheet if you want to read about it.

Krodal

You did the right thing : Just 4 connections (+5V to VCC, GND to GND, A4 to SDA, A5 to SCL).After that the i2c_scanner should see the device.

Do you have another i2c device ?Perhaps you should try that first, to see if the Arduino is working.Use the i2c_scanner to test it.

If the i2c_scanner can't find anything, some connection is bad, or your sensor board has a problem.Test everything very careful, and check the sensor board with a magnifying glass or take a picture with a camera with macro.Check every solder point. Measure the 3.3V on the sensor board.

gevo12321

Thanks for your help guys. Just wanted to leave a record of how I fixed the problem for future reference.

I did not want to change any of the source code in case I needed the same code without the changes in the future so I ended up getting a logic level converter(they are very cheap).

I got the Sparkfun logic level converter and there is one little detail that should be kept in mind when using it. Since i2c lines need 2 way communication, make sure to use the bidirectional Tx lines on the logic level converter and not the Rx lines.

Anyway, in the end I did not change any of the code and my setup was as follows:

Arduino +5V to VCC on GY-521 and to Hv on the Logic Level ConverterArduino +3.3V to Lv on the Logic Level ConverterArduino GND to GND on Gy-521 and both GNDs on the Logic Level ConverterArduino analog input pin A4 to ch1 Tx on Hv side and ch1 Tx on the Lv side to SDA on GY-521Arduino analog input pin A5 to ch2 Tx on Hv side and ch2 Tx on the Lv side to SCL on GY-521

jjspierx

I am having problems getting the i2C scanner to recognize my GY-521. I am trying to connect it without using a logic level converter if possible.

I tried setting the A4 and A5 pins as inputs, setting them low to disable the internal pull-ups using the following code:

pinMode(A4, INPUT);pinMode(A5, INPUT);

digitalWrite(A4,LOW);digitalWrite(A5,LOW);

However, when I upload this code, the serial monitor doesn't even update, and TX light on the Arduino Uno does not blink. This happens with either the pinMode or digitalWrite functions commented out as well. However, with both of them commented out, the I2C scanner works, but does not see any I2C devices

I also tried adding 4.7k resistors as pullup resistors between SDA and SCL and pins A4 and A5. When I do this the scanner does not find any I2C devices. The GY-521 is on (blue led is lit up) but nothing I do seems to make the I2C scanner find a I2C device.

Any other ideas?

Thank you in advance.

jjspierx

I just got the scanner to recognize the GY-521. I didn't realize the Uno R3 has SDA and SCL pins (next to AREF). Once I hooked up to the dedicated SDA and SCL pins, the device is now recognized. Hopefully this helps somebody else using an Uno R3.

samu_87

Hi, i have an arduino pro mini, and a breackout board GY-521, the board is perfectly recognized from the arduino and i can read the values.But i haven't undestand if are needed the pull up resistor on SDA and SCL. I don't want broke the board.

Thanks for your help guys. Just wanted to leave a record of how I fixed the problem for future reference.

I did not want to change any of the source code in case I needed the same code without the changes in the future so I ended up getting a logic level converter(they are very cheap).

I got the Sparkfun logic level converter and there is one little detail that should be kept in mind when using it. Since i2c lines need 2 way communication, make sure to use the bidirectional Tx lines on the logic level converter and not the Rx lines.

Anyway, in the end I did not change any of the code and my setup was as follows:

Arduino +5V to VCC on GY-521 and to Hv on the Logic Level ConverterArduino +3.3V to Lv on the Logic Level ConverterArduino GND to GND on Gy-521 and both GNDs on the Logic Level ConverterArduino analog input pin A4 to ch1 Tx on Hv side and ch1 Tx on the Lv side to SDA on GY-521Arduino analog input pin A5 to ch2 Tx on Hv side and ch2 Tx on the Lv side to SCL on GY-521

guest566

Thanks for the MPU6050 sketch, I have it up and running on my Arduino. I am looking at the sketch more closely now, and was wondering what all of the definitions at the beginning of the sketch are used for. Do they correspond to inherent properties of the MPU6050 and you are defining them here, or are they there to be used later in code? I saw how the register addresses correspond to the addresses in the MPU6050 register map, but am curious about how the other definitions are used. For example is defining MPU6050_AFS_SEL_2G setting some sensitivity to the device? Because many of the constants aren't used again in the sketch I'm wondering if the definitions have some direct effect on the chip. If you know of other documentation for the MPU6050 other than the product specifications and the register map that may also help.