role of resistors in a circuit with chip 74HC4052

Hi all, I'm following this sketch for multiplexing four I2C accellerometers.

As you can see, I'm using the 74HC4052, as indicated in this post

http://forum.arduino.cc/index.php?topic=21794.0

I'm wondering what is the use of the 2k2 resistors between lines and power supply. For now I tested the circuit without these resistors and it works. Maybe the resistors protect the circuit someway?

On SCL & SDA, those are the resistors that provide a HIGH level during communications - all I2C devices can only pull the line low. I would suggest all these resistors be on the other side of the device so that all devices see a valid high on their control lines when not selected. Further, only the SCL line needs to be muxed. If a device has activity on SDA but not on SCL, its should not be responding. Check your device data sheet to confirm. On A & B, those just keep the line HIGH when the uC is in reset state. Not really needed. Keeps channel 3 selected unless A and/or B go low to select a different channel . On Enable/, that keeps all IO disabled when the uC is in reset state. When the IO are disabled, the need for pullups per 1st comment really comes into play.

Ok, so as I can understand from your answer, these resistors are for a clean communication, and not to protect the circuit.

Regarding this

CrossRoads: I would suggest all these resistors be on the other side of the device

do you mean something like that?

https://plus.google.com/u/0/photos/105563585590680769581/albums/6233717834161874273/6233717839408397522

thanks a lot

No, they should not be inline on the SCL and SDA pins. They need to remain pullups. The I2C bus can hang if no pullups on the signals are present.

Opsss! my fault! I meant somethingh like this:

https://plus.google.com/u/0/photos/105563585590680769581/albums/6233722984637383361/6233722982869215362

That was my schematic. It comes from a very well tested, and out in the field in their millions, commercial product.

Yes you can move them to the other side of the switch but you need them on all the I2C lines. They are pull up resistors and need to be between the resistor and the power rail. This is because the I2C bus works with open collector outputs, that is what allows many to be connected to the same bus.

Having them on the side they are shown reduces the number of resistors that are needed. If you move them like you showed you need more of them.

If they are on the common side of the '4052, then unselected devices are not pulled up at all. If they are on the selected channel side, then yes, more are needed, but the signals are guaranteed to be at valid levels while power is applied, vs floating around and possibility getting into a hung state if there is sufficient noise on the lines.