how many devices can you connect to i2c?

I'm trying build a homemade weather station with my uno R3. most of the sensors i have comunicate via i2c. the problem i have is that the uno has 1 SCL and SDA line. how many devices can i conect to the UNO's SCL & SDA at the same time? if only one at a time is there another solution? can i change any of the other pins to SCL & SDA?

Theoretically, up to 128 - the limit of unique I2C addresses.
All I2C devices get connected in parallel, and a pair of 4.7K pullup resistors brings the SCL & SDA lines high.

1 Like

The speed is limited by the "capacitance" (as in capacitor) of the line.
That is the total capacitance of all devices and all wires.

IIRC there exists I2C multiplexers to increase the number of devices.

But be aware that the more devices you have the less times per second you can talk to them (all).

I2C mux is only needed if you have devices with the same address - say 2 of the same simple sensor that does not support multiple addresses.

I2C mux can be used to go beyond the 127 devices , and yes indeed it is done by reuse the same address space again and again and again (4 way mux in mind)

so then, should i have a delay in between the reading and communication with each sensor, or can all the sensors comunicate at the same time?

You can only talk to 1 at a time.

ok thanks for all your help. one last question please...will 5 millisec be enough delay? if not what should it be?

Read the datasheet for your parts - how much time does each need to do whatever conversion it is doing? Or, are they converting all the time and have a value ready to spit out as soon as requested?