I²C only works when I short-circuit my Arduino I'm trying to connect an Arduino Nano with a Raspberry Pi 3 via I²C.

This is the small test-program I found and used for I²C.

#include &lt;Arduino.h&gt;
#include &lt;Wire.h&gt;

void setup() {
  Wire.begin(4);                // join i2c bus with address #8
  Wire.onReceive(receiveEvent); // register event
  Serial.begin(9600);           // start serial for output
}

void loop() {
  delay(100);
}

// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany) {
  while (1 &lt; Wire.available()) { // loop through all but the last
    char c = Wire.read(); // receive byte as a character
    Serial.print(c);         // print the character
  }
  int x = Wire.read();    // receive byte as an integer
  Serial.println(x);         // print the integer
}


After compiling and uploading, I ssh-ed into my Pi and executed sudo i2cdetect -y 1 which prints an empty I²C table.

Here are images of how I connected the two devices, as far as I know the connection itself is okay. I also tested the cables with a multimeter.





Now the strange thing is, when I short-circuit my Arduino for a brief moment between GND and VIN I²C works, but Serial via USB with my PC stops working. Also the chip gets very hot and stays hot even though it isn't short-circuited anymore.

Any ideas what I'm doing wrong? I don't think the Arduinos are broken, since I tested it with 2 different ones. (while testing I accidentally short-circuited one and it worked)

EDIT: I tested I²C between the two Arduinos and it works flawlessly, but still doesn't want to work with my Pi. :(
Any ideas what I'm doing wrong?


Apart from deliberately shorting +5V to ground? Sheesh!



Get, or make, a level-shifter. You can't pump 5V from the Nano to the Pi and expect things to work. Example schematic:



In this example the low voltage (3.3V) side is marked LV, and the high voltage (5V) side is marked HV.




  You can use a level shifter with I²C but you don't need one. The Pi has pullup to 3.3V. Provided there are no other pullup it works. I routinely do this.


The important phrase there is "Provided there are no other pullup".

Wire.begin() enables the pull-ups. So make sure that on the Nano side you disable them again:

 

  Wire.begin (4);
  // disable internal pullups for twi.
  digitalWrite(SDA, LOW);
  digitalWrite(SCL, LOW);