I2C Communication Possible or Not?

So I came up with an idea more like a project but there is a problem which I'm not sure
if the components I'm using will be able to handle it.

Question
1st I'd like someone to tell me what's the relationship between Master and Slaves, as I know there can be only one Master and multiple slaves, does only the master is capable to send to the slaves or only slaves send to master?

Project
The basic idea of this project it to have a lot of sensors doing some tasks and save the data.
So bellow is the components and connections:

3x Arduino Uno
5x Sensors
1x SD Card module

The 3 Arduinos and 5x sensors all connected to Analog pins 4 and 5.

The Nr.1 Arduino Uno

Will receive the data from the Arduino nr.2 of the 4x (1s,2s,3s,4s) sensors and store them into
a separated variables for each sensor, after that using that values will do the necessary tasks.
[The arduino nr.1 will store the flash code of the variables and extra components tasks]

The Nr.2 Arduino Uno
Will receive the data from 4x (1s,2s,3s,4s) sensors thru I2C and (transmit)/send the data to
Arduino nr.1 and Arduino nr.2
[The arduino nr.2 will store the flash code of the 4x sensors]

The Nr.3 Arduino Uno
Will receive data from 1x (5s) sensor, will receive the data from Arduino nr.2 of the
4x (1s,2s,3s,4s) sensors and store all the data from the 5x sensors to the SD Card module
[The arduino nr.3 will store the flash code of the 5th sensor and the sd card]

So is that possible? Probably yes, but
Which should I make master/slave?
What resistors do I need for the I2C and how to calculate that?
How do I get the data from each sensor, with just the sensor lib. code or do I need extra coding?

A master initiates communications, requesting data from a slave. A slave responds to requests for data.

Slaves can not initiate communication with the master.

While the sensors may be I2C, the communication between the Arduinos does not have to be.

Though pushing data to an Arduino doesn't really make sense.

Why do you need three Arduinos? It seems to me that reading 5 sensors, storing data on the SD card, and making some decisions could all be done on one Arduino.

A master initiates communications, requesting data from a slave. A slave responds to requests for data.

So the Slave only send/transmit and Master only take/receive?!

Why do you need three Arduinos? It seems to me that reading 5 sensors, storing data on the SD card, and making some decisions could all be done on one Arduino.

Yea I thought about that too but there is not enough space inside the ATmega328p to store all that
code for 5x sensors, sd card and extra components to work and do taks/ calculations. I'm thinking about
2x ATmegas, could be possible, but in my case 1 is not enough.

What about those questions:

What resistors do I need for the I2C and how to calculate that?
How do I get the data from each sensor, with just the sensor lib. code or do I need extra coding?

What resistors do I need for the I2C and how to calculate that?

That depends to some extent on which sensors and how many sensors. The built-in I2C circuit contains what are generally appropriate resistors. You would need to disable them to include external resistors.

How do I get the data from each sensor, with just the sensor lib. code or do I need extra coding?

Which sensors? Which libraries?

Obviously you need to write the code to call the library functions and to do something with the data.

Which sensors? Which libraries?

Obviously you need to write the code to call the library functions and to do something with the data.

What I mean is, having 5 sensors the I2C as I understand can't call all sensors in the same period of time
you need to call one by one, call one sensors, pause the other 4 till you done with the 1st one.

So I'll just need the sensor basic code to call the sensor data and make all sensor in a millis loop to call them
one by one or should I add extra code for I2C ?

Unless distance is the issue between the sensors you can run them all from one Arduino. I2C sensors or devices have addresses. While you cannot have two devices on an I2C bus that have the same address, you can use something like the PCA9518 5-channel I2C-bus hub that has one channel to the Arduino SCL and SDA then you use 4 data pins to select the I2C bus you want to communicate with at that time. The I2C-bus Hubs can be daisy chained for more busses. Some devices will have built in pull up resistors. 10K is typical. The most I2C devices I have bread boarded up this way was 16 ADS1115's having 64 channels of 16 bit ADC using only 1 PCA9518.

You do need the libraries and you will need to write some code to use those libraries.

Many I2C devices have addressing so that you can have the same type of device on the same bus. some addressing is done by pull up resistors and others may be different like the ADS1115 uses an address pin that either connects to ground, VCC, SDA or SCL.

While you cannot have two devices on an I2C bus that have the same address

Yes I know about that, if I use +2x ATmegas I need to put a unique address so they can communicate
with each other. About the sensors as I know they have their own address no need to set up one as I know
Libraries in the arduino IDE they already know how to communicate with it unless you/someone use more
than +2x same sensors but in my case I use different type of sensors.

Some devices will have built in pull up resistors. 10K is typical.

Well that's my question here, almost all my sensors have on board pull up resistors, do I need to add
extra or I'm ok to go with the on board ones and no need to add any extra or I better add extra resistors
for safety ? But how do I know what K/Ohm to add?

Domino60:
Well that's my question here, almost all my sensors have on board pull up resistors, do I need to add
extra or I'm ok to go with the on board ones and no need to add any extra or I better add extra resistors
for safety ? But how do I know what K/Ohm to add?

The total should be about 5 to 10K ohms. You might have to pull some resistors off if you have too many. Use the formula for parallel resistance to calculate it. It's on the web.

The total should be about 5 to 10K ohms. You might have to pull some resistors off if you have too many. Use the formula for parallel resistance to calculate it. It's on the web.

Here is another question, each sensor got their own pull up resistor but if they are in between
5 to 10K is it really necessary to unsolder them? Well I mean if each sensor will send the data to the atmega
one by one using even a millis loop for each sensor do I really need to add extra pull up resistors? They already have on pcb.

Those resistors are always there, regardless if you communicate with the devices or not. If you have too many, you load the bus to a level that causes signal corruption.

By the way, to confuse you a bit :wink: You can have multiple masters; but only one can talk to a slave at a time on the bus. A mechanism has been defined to detect collisions when two masters try to talk at the same time. If you use the hardware I2C, it is implemented in the hardware of the micro (at least in the 328 as used in the Uno); I do not know if the I2C library makes use of it.

The basics of multimaster:
The master devices read back the data bits that they put on the bus. If it does not match with what they have sent, they will stop sending; at the end there will be one 'winner' that can communicate.