This topic have been covered in various places, but I still think it hasn't been thoroughly explained anywhere. Doing google search on connecting Arduino to Raspberry Pi via i2c gives for example, this page.
While apparently this should work, there is a factual error there: on arduino side, pins used for i2c do have internal pull ups, and they are activated by Wire
library.
Digging further, I've found following information:
However, it turns out that these are weak (high-resistance) pull-ups; the Pi has strong pull-ups which dominate those on the Arduino, making direct connection safe.
What does safe mean? And how weaker are those pullups compared to raspberry pi ones?
Let's check:
- rpi i2c pullup: 1K8
- arduino i2c pullup: 20K-50K from datasheet (if I'm looking correctly, I'm using ATmega8), though the above page states 10K.
What can I make of those values? My (intuition rather than) basic knowledge hints me something along the lines:
If the i2c is floating, it means the 5V is connected with 3.3V and there are only those pullups along the way, so:
- calculate voltage drop between 5 and 3.3: 1.7V.
- calculate voltage drop across rpi pullup proportionally to voltage drop across arduino pullup: 1800 / 30000 = 0.06, meaning 0.102V across rpi pullup and 1.598 across arduino pullup, so the actual pulled up voltage is gonna be 3.3V + 0.102V = 5V - 1.598V = 3.402V?
Though I'm pretty sure I'm doing some terrible math here and someone is gonna have good laugh:)
So, my question is not whether it's safe (as it's been proved), but rather why is it safe considering the internet resources are inaccurate on this matter.