Go Down

Topic: how many devices can you connect to i2c? (Read 2184 times) previous topic - next topic

jasonvanwyk

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?

CrossRoads

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.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Erdin

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

robtillaart

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).
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

CrossRoads

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.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

robtillaart

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)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

jasonvanwyk

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?

CrossRoads

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

jasonvanwyk

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

CrossRoads

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?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up