1

I've been trying to connect an MPU6050 to my MKR WIFI 1010 following these general instructions and using the I2CDev library, but I keep running into problems.

For a while the Arduino just didn't show up as connected in the IDE when all the pins were connected, which I think I've gathered was due to a lack of pull-up resistors for the SCL/SDA pins. Adding 10 kOhm pull-up resistors helped a little (in making the Arduino visible) but it would hang when trying to upload the example sketch. 2.2 kOhm resistors seemed to do the trick, where now the example sketches (MPU6050_DMP6 or MPU6050_raw) can be uploaded. They still fail to read any actual values, however. The raw sketch gives 0 for everything, and the DMP6 sketch prints

Initializing I2C devices...
Testing device connections...
MPU6050 connection failed

Send any character to begin DMP programming and demo: 
Initializing DMP...
DMP Initialization failed (code 1)

Does anyone know why the sensor still fails to give any measurements? I connect VCC and GND from the sensor to VCC (3.3V) and GND from my Arduino. SCL and SDA from the sensor are connected to VCC via 2.2 kOhm resistors and to the SCL and SDA pins of the Arduino (12 and 11). And INT from the sensor is connected to digital pin 2. (I tried this on a couple other pins like 0 and 1 since it seems from the tech specs that 2 is not an External Interrupt pin, but that didn't change anything.)

The sensor and examples worked without any extra effort on my Arduino Uno, but unfortunately I fried that with a 12V power supply by accident. I'll probably just get another Uno, but I'm curious why this didn't work, if I'm missing something about I2C or the MKR WIFI.

I'll also note that I had to add

define #BUFFER_LENGTH 64

to wire.h in order to get sketches including I2Cdev to compile (following these instructions).

8
  • Yes, it was defined as 64, good catch. (Edited now.) I did not run any I2C scanner sketch, but I can try that. The wiring for SDA/SCL used a breadboard with both pins from the sensor connected to their own rows, a 2.2 kOhm resistor from each row to the +3.3V column (which itself connects to VCC on both the Arduino and sensor), and jumper cables from those rows to pins 11 and 12 on the Arduino for SDA/SCL respectively. The other wiring is GND (sensor) to negative column on breadboard to GND (Arduino) and INT (sensor) to digital pin 2 (which I wasn't sure about, so I also tried 0 and 1).
    – Frecka
    Sep 14, 2020 at 13:41
  • try the I2CScanner sketch without the pullups too
    – Juraj
    Sep 14, 2020 at 16:50
  • I'm seeing "I2C device found at address 0x60" and "I2C device found at address 0x6B", regardless of whether anything is plugged into my Arduino. When I tried to connect the sensor without the pull-up resistors, I got the error message "java.io.IOException: jssc.SerialPortException: Port name - COM3; Method name - setEventsMask(); Exception type - Can't set mask" and the orange CHRG light came on (with quick pulsing)
    – Frecka
    Sep 15, 2020 at 1:25
  • the MKR1010 has I2C devices on board
    – Juraj
    Sep 15, 2020 at 5:38
  • So it never detected the sensor then. Could different pull up resistors help? 4.7 kOhm seems to be a typical value used
    – Frecka
    Sep 15, 2020 at 14:32

1 Answer 1

1

The sensor was indeed broken, and I had no problems after ordering a new one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.