Best way to communucate 8 arduinos both send and receive data

Hi fellows,

I im making a system like that;

I have 7 arduinos each one has 3 load cells.And eighth arduino(which i call master) has 2 buttons(and other stuffs, not just buttons), when user push that button, this arduino will send other 7 arduino button1 HIGH.7 arduinos will receive that and will make scaling.And than they will send that values to master arduino.Also Some arduinos far away about 1.5meters from master arduino.

I confused about which communucation can do it better?

And how can i ensure that values do not mix?

For instance when button1 pressed and master arduino send that signal to other 7 arduino.They start to take value from load cells like
Arduino1 loadcell1=100gr loadcell2=200gr loadcell3=300gr
Arduino2 loadcell4=300gr loadcell5=200gr loadcell6=100gr
...
Arduino7 loadcell19=100gr loadcell20=200gr loadcell21=300gr

“ Also Some arduinos far away about 1.5meters from master arduino.”

I2C should work for you.

"And how can i ensure that values do not mix?"

The master can call the individual slave arduinos in turn asking for the cell data so their transmissions do not collide.

SPI Protocol could be a choice.

Thank you all,

I choosed i2c protocol,

This code from droneworkshoprobot and i will use that code;
For master;

/*
  https://dronebotworkshop.com
*/
 
// Include Arduino Wire library for I2C
#include <Wire.h>
 
// Define Slave I2C Address
#define SLAVE_ADDR 9
 
// Define Slave answer size
#define ANSWERSIZE 5
 
void setup() {
 
  // Initialize I2C communications as Master
  Wire.begin();
  
  // Setup serial monitor
  Serial.begin(9600);
  Serial.println("I2C Master Demonstration");
}
 
void loop() {
  delay(50);
  Serial.println("Write data to slave");
  
  // Write a charatre to the Slave
  Wire.beginTransmission(SLAVE_ADDR);
  Wire.write(0);
  Wire.endTransmission();
    
  Serial.println("Receive data");
  
  // Read response from Slave
  // Read back 5 characters
  Wire.requestFrom(SLAVE_ADDR,ANSWERSIZE);
  
  // Add characters to string
  String response = "";
  while (Wire.available()) {
      char b = Wire.read();
      response += b;
  } 
  
  // Print to Serial Monitor
  Serial.println(response);
}

For slaves;

/*
  I2C Slave Demo
  i2c-slave-demo.ino
  Demonstrate use of I2C bus
  Slave receives character from Master and responds
  DroneBot Workshop 2019
  https://dronebotworkshop.com
*/
 
// Include Arduino Wire library for I2C
#include <Wire.h>
 
// Define Slave I2C Address
#define SLAVE_ADDR 9
 
// Define Slave answer size
#define ANSWERSIZE 5
 
// Define string with response to Master
String answer = "Hello";
 
void setup() {
 
  // Initialize I2C communications as Slave
  Wire.begin(SLAVE_ADDR);
  
  // Function to run when data requested from master
  Wire.onRequest(requestEvent); 
  
  // Function to run when data received from master
  Wire.onReceive(receiveEvent);
  
  // Setup Serial Monitor 
  Serial.begin(9600);
  Serial.println("I2C Slave Demonstration");
}
 
void receiveEvent() {
 
  // Read while data received
  while (0 < Wire.available()) {
    byte x = Wire.read();
  }
  
  // Print to Serial Monitor
  Serial.println("Receive event");
}
 
void requestEvent() {
 
  // Setup byte variable in the correct size
  byte response[ANSWERSIZE];
  
  // Format answer as array
  for (byte i=0;i<ANSWERSIZE;i++) {
    response[i] = (byte)answer.charAt(i);
  }
  
  // Send response back to Master
  Wire.write(response,sizeof(response));
  
  // Print to Serial Monitor
  Serial.println("Request event");
}
 
void loop() {
 
  // Time delay in loop
  delay(50);
}

But i have a couple of questions;

1-I will send request load cell datas from slaves, that datas some times have 5 number like "1002.5" gr and sometimes have "5" gr for 3 load cells i have 15 digits for maximum, so i cant adjoint all data to one variable(ie loadcell1's value 100 lc2's value 200 lc3's value 5000 adjoint all to one variable like 1002005000) how can i send three load cell datas seperately?

2-I will take datas to master arduino with requestfrom(Adress,answersize), for 7 slave arduino i'll write that;
requestfrom(1,answersize)
requestfrom(2,answersize)
requestfrom(3,answersize)
...
requestfrom(7,answersize)

so slave arduinos's adresses will be 1 2 3... 7 is it true?

3-What is answer size in requestfrom(adress,answersize), is that matters

Don't bother trying to send ASCII over I2C. Define a common struct that all the slaves can use and send it as binary. That will ensure that all transfers are the same number of bytes which makes things a lot easier. Dummy data can be sent if a particular slave doesn't need to use certain members of the struct.

tlhsglm:
1-I will send request load cell datas from slaves, that datas some times have 5 number like "1002.5" gr and sometimes have "5" gr for 3 load cells i have 15 digits for maximum, so i cant adjoint all data to one variable(ie loadcell1's value 100 lc2's value 200 lc3's value 5000 adjoint all to one variable like 1002005000) how can i send three load cell datas seperately?

2-I will take datas to master arduino with requestfrom(Adress,answersize), for 7 slave arduino i'll write that;
requestfrom(1,answersize)
requestfrom(2,answersize)
requestfrom(3,answersize)
...
requestfrom(7,answersize)

so slave arduinos's adresses will be 1 2 3... 7 is it true?

3-What is answer size in requestfrom(adress,answersize), is that matters

On your first question, if I am understanding your question correctly, I would put a delimiter character between each load cell value. It would look like: "123.45%234%456.78". You can parse this after reading the data to the master.

On your second question, you have this correct.

In your last question, the size argument is the byte count. Each read() decrements the byte count by one until it is zero. For example:

Wire.requestFrom(My_Address,2,true);
uint8_t lsb = Wire.read();
uint8_t msb = Wire.read();

Gfvalvo replied at the same time. I agree that using structs would probably be better over I2C. I didn't think of it because my experience with structs is quite limited.

Some previous similar discussions.

https://www.google.com/search?ie=UTF-8&oe=UTF-8&q=comma+delimited+data&domains=https%3A%2F%2Fforum.arduino.cc&sitesearch=https%3A%2F%2Fforum.arduino.cc