0
\$\begingroup\$

I have three I2C bus devices: 1) gas sensor (3V), 2) temperature and humidity sensor (3V), and 3) ESP32 (3.3V). They all connect to an I2C bus master: ATMEGA32U4. Using the typical application circuit provided in the datasheet, I used 2.2K resistors for both bus master and bus devices. My question is, do I only need to connect a resistor to the bus master once, and not for every bus device added?

typical application circuit for PCA9306

schematic diagram of my application circuit

The 3 V sensors can be on the same bus (you only need one pullup resistor for SCL and one pullup resistor for SDA for each bus), and the 5 V bus can also be shared. It looks like you only need two PCA9306s -- one to level translate the 3 V bus and another to level translate the 3.3 V bus.

Thank you! It didn't occur to me that you can combine same level SCL/SDA buses.

fixed application circuit

\$\endgroup\$
1
  • 1
    \$\begingroup\$ The 3 V sensors can be on the same bus (you only need one pullup resistor for SCL and one pullup resistor for SDA for each bus), and the 5 V bus can also be shared. It looks like you only need two PCA9306s -- one to level translate the 3 V bus and another to level translate the 3.3 V bus. \$\endgroup\$
    – Null
    Commented Sep 12, 2023 at 14:39

1 Answer 1

0
\$\begingroup\$

A single set of pull-up resistors per bus segment is enough, unless special conditions apply or some standards say otherwise, such as in case of devices that have hot-pluggable I2C bus.

However the values of the resistors are important. If one device pulls a bus wire low, current flows through all pull-ups on the bus. For example the 2.2 kohm resistor on 3.3V bus alone provides 1.5mA of current, and the currents through other resitors easily provide over 5mA, and that may be too much for your sensors.

You need to read how much your chips can handle, as some sensor chips are not even rated to handle the 3mA of I2C standard.

\$\endgroup\$
2
  • \$\begingroup\$ May I ask you how you calculated the currents? I tried to think about it as three parallel resistors which would mean an effective resistance of 733 ohms. Meaning components on 3V, 3V3, and 5V would receive a current of around 4.1 mA, 4.5 mA, and 6.8 mA respectively. Did I understand correctly? \$\endgroup\$ Commented Oct 1, 2023 at 11:36
  • \$\begingroup\$ @FridgeDetail I don't recall any more, but simply use Ohm's law. When MCU or any other chip is holding e.g. the data wire low at 0V, all resistors have one end at 0V and one end at their respective pull-up voltage, and they all pass a current that is determined by resistance and voltage, and the data pin must sink all those currents summed together. So you can't calculate a parallel resistance from resistances alone as they are different currents due to different voltage even if resistances are identical. The effective resistance isn't. \$\endgroup\$
    – Justme
    Commented Oct 1, 2023 at 11:44

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.