1
\$\begingroup\$

Following the diagram below, is it wrong to use the MCU 5V to supplying both SDA and SCL lines? I applied this into my circuit and my device are not communicating when connected to this circuit.

enter image description here

update: Yes this does not work. I tried this wiring and the controller stops working when 5V is tapped to the SDA/SCL.

\$\endgroup\$
5
  • \$\begingroup\$ Keep one master silent, send a known i2c command from another. Make sure the correct slave address is used. If possible, reset or shutdown unnecessary i2c devices. Probe the line via oscilloscope, and check if the waveform (including voltage levels) and the response from the slave is right. \$\endgroup\$
    – Light
    Commented Oct 16, 2020 at 2:54
  • \$\begingroup\$ Yes i checked my master, and yes it is sending signals (through oscilloscope). When i removed the circuit (connecting to 5V) the communication works properly \$\endgroup\$
    – Julius
    Commented Oct 16, 2020 at 3:07
  • \$\begingroup\$ If that's a raspberry pi, then yes, it's wrong to be using a 5 volt I2C bus! This is not a sensible way to connect a pi and an Arduino at all, but plugging the Arduino into the pi's USB host ports might be. If there's a legitimate reason why you need both computers (eg, Arduino doing more realtime things) then parcel out the sensors to each be owned exclusively by one or the other, without a joint I2C bus which will add complication to usually no benefit at all. \$\endgroup\$ Commented Oct 16, 2020 at 3:29
  • \$\begingroup\$ Check that you don't have too much pull-up resistance across all those modules. Posting an oscilloscope screenshot of the clock and data line would illustrate the question. \$\endgroup\$ Commented Oct 16, 2020 at 4:31
  • \$\begingroup\$ I used 1k Ohms for this and the devices are just ESP32 and Arduino mega and nano. I will post oscilloscope screenshot of the data line next week \$\endgroup\$
    – Julius
    Commented Oct 16, 2020 at 5:31

1 Answer 1

1
\$\begingroup\$

Yes, it's wrong. There are two things that went wrong when using 1kohm pull-up resistors connected to 5V supply for I2C.

The first issue is that you have devices on I2C bus that can only tolerate 3.3V voltage on their I2C pins. In this case the pull-ups must not be connected to 5V supply. If there are both 5V and 3.3V devices on bus, then there is a need to have 5V logic levels for 5V devices, and 3.3V logic levels for 3.3V devices, and some form of level conversion is needed to allow communication between 3.3V and 5V bus segments. By force feeding 5V via 1kohm resistor into a 3.3V device may damage it.

Second issue is that the I2C bus and compliant devices are generally specified to being able to sink 3mA current, unless otherwise stated that all devices on bus can sink more current, and that the voltage is low enough to be seen as logic low level by all devices. Connecting 1kohm resistor to 5V makes the devices need to sink 5mA of current, and that assumption does not include the fact that many boards may already have on-board pull-ups. But you need to check the current sink rating of each device to know what pull-up resistances should be used in order to not exceed the chip current sinking ratings. It gets a bit more complicated if you have both 5V and 3.3V bus segments, but a simple way is to design it so that half of the current comes from 3.3V pull-ups and half of the current comes from 5V pull-ups.

\$\endgroup\$

Your Answer

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

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