I have a light sensor IC.

I have 2 questions:

  1. The I2C Lines is connected between the microcontroller (3.3V domain) and the light sensor IC. The microcontroller is placed on a PCB and the light sensor is placed on a separate PCB. Both PCBs are connected by a cable of length 30cm.

In this case, is it correct to place the pull ups of the I2C near the microcontroller on the microcontroller PCB, or should I place it on the light sensor PCB? As far as I have read, the pull-up resistors should be placed close to the master and hence I am thinking it should be placed close to the microcontroller. Please confirm.

  1. I am not planning to use the INT pin. INT is an open-drain output pin from the datasheet. I don't want to use that pin because it will help in one connector pin less. So, in order to not use the INT pin, what should I do? The datasheet doesn't recommend what to do with unused pins. So, what should I do? As far as I know, since the INT pin is an open drain pin, can I leave it floating. Please confirm.
  • \$\begingroup\$ Unused pins that are output only, such as the INT pin, should be left open. It's really only unused input pins that should not be left floating, unless otherwise noted. \$\endgroup\$ – DoxyLover Mar 24 at 6:42
  • \$\begingroup\$ Ok thank you. Could you help with the 1st question? \$\endgroup\$ – Newbie Mar 24 at 6:59

These are really two different question:

  • How to handle unused open drain pins, and
  • How to properly terminate I2C bus lines

For the first part it's easy: you simply do not connect them. Or you can also tie the to ground if it helps (usually for thermal conduction). The internal structure is simply a MOSFET with the source to ground and the drain… open (and some ESD protection structure, usually). Just don't tie it to something else different than a ground.

As for the second question, there is a somewhat detailed explanation in the I2C specs (download from NXP) but in short there's and easy rule: pull them up somewhere to the relevant supply with some kiloohm of resistance.

I2C is not impedance controlled so it's not really important where or how you do it. It could be argued that more or less on the middle could be slightly better. The bus itself is multimaster (or at least it can be) so there's not a preferred signal generation point. So just place the pullups where convenient.

As for the value, that is somewhat important. The pullup resistor create an RC circuit with the parasitic track capacity. In short, a bigger resistor causes a longer rise time which could violate the timing specs. A too small resistor would overload the bus drivers.

Unless you have a really long or populated bus or you are doing high speed I2C it really doesn't matter. Popular values are 2k2 or 4k7 ohms. In case of trouble check with a scope and tune them.

  • \$\begingroup\$ Thank you for the answer \$\endgroup\$ – Newbie Mar 24 at 7:26
  • 1
    \$\begingroup\$ On multimaster: The slave drives SDA and it is also allowed to drive SCL. So it is not a question of the number of masters, both signals are generally driven by all bus members. On SCL this happens even at the same time if the slave slows down the clock. \$\endgroup\$ – the busybee Mar 24 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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