user85340: I want to measure changes in capacitance over time. One Arduino is used per capacitance sensor. There is one anode per Arduino and a total of one common cathode (see the picture)
With four Arduinos connected in series via an I²C master-slave connection, successful results were obtained.
With more than four Arduinos, all measurement results were 0, because no voltage is measured at the input pin anymore.
I then lowered the reference voltage for analogRead. So 10 Arduinos in series were possible. However, the measured values are clearly lower. However, no absolute values are to be measured, but any difference in the capacitance is sufficient. Finally 50 Arduinos should be used.
I have thought of the following possibilities:

reduce the reference voltage further, but this may reduce the measurement results further, so that no deflection is measured.
increase the output voltage at the Arduino via an operational amplifier to compensate the voltage drop.

How could I proceed to get a usable result with all 50 Arduinos? The code I used is to be found below.


Master
#include <Wire.h>

volatile byte x1, x2;
volatile int val_slave;

const int OUT_PIN = A0;
const int IN_PIN = A2;


#define nodeMax 10
#define nodeStart 2


void setup() {
  analogReference(DEFAULT);
  Wire.begin();

  pinMode(OUT_PIN,OUTPUT);
  pinMode(IN_PIN,OUTPUT);

  Serial.begin(9600);
  // put your setup code here, to run once:

}

  void loop() {
    
    pinMode(IN_PIN,INPUT);
    digitalWrite(OUT_PIN,HIGH);

    int val = analogRead(IN_PIN);

    digitalWrite(OUT_PIN,LOW);
    pinMode(IN_PIN,OUTPUT);

    
    Serial.print(val);
    Serial.print(",");
  
      delay(10);
      
    for (int node = nodeStart; node <= nodeMax; node++) {

        // Ask the slave to release the input pin.
        Wire.beginTransmission(node);
        Wire.write(0);
        Wire.endTransmission();
        delay(10);  // give it time to do so

        // Charge the capacitors.
        digitalWrite(OUT_PIN, HIGH);

        // Ask the slave to read val.
        Wire.requestFrom(node, sizeof(val));

        // Discharge.
        x1 = Wire.read();
    x2 = Wire.read();

    val_salve = (int)x1 << 8 | (int)x2;

        Serial.print(val_slave);
        Serial.print(",");
        
        digitalWrite(OUT_PIN, LOW);
        delay(10);
     
    }
    Serial.println();
    delay(50);
}

Slave
const int IN_PIN=A2;


#include <Wire.h>
#define node 10



void setup() {
    // ...
    analogReference(DEFAULT);
    Wire.begin(node);
    Serial.begin(9600);

    pinMode(IN_PIN,OUTPUT);
    
    Wire.onReceive(receiveEvent);
    Wire.onRequest(requestEvent);
 
}



// Release IN_PIN when the master sends a message.
void receiveEvent(int byte_count) {
    pinMode(IN_PIN, INPUT);
    while (byte_count--)
        Wire.read();  // discard the received message
}

void loop ()
{
}

void requestEvent() {
    int val = analogRead(IN_PIN);
    // transmit the result... then

    
  
    Wire.write(highByte(val));
    Wire.write(lowByte(val));

    pinMode(IN_PIN, OUTPUT);  // discharge
}






user14095: The I²C bus was never intended as a distribution bus between many computers. The outputs are not designed to drive long wires. With a lot of kludging you may get this to work, but it is definitely not repeatable or reliable.
Consider something else. CAN can do maybe 60 nodes, depending on the transceiver chosen. It is relatively inexpensive.

user10794: You might want to consider using a RS485 protocol. Unlike I2C this uses "balanced" wiring so is more suitable for longer cable runs.
I described a way of coding a number of Arduinos using a "rolling master" protocol here - this lets you connect a considerable number of Arduinos to the two wires, and they take turns to send the data.
However in your case, since you are measuring capacitance (not capacity?) then each of your Arduinos can measure 6 (or possibly more) analog readings, so you don't need 50, you need 50/6 = 8.33 Arduinos (OK, nine).
The Arduino Micro, for example, has 12 analog input channels, so you would only need 4 (to get 48 inputs) or 5 (to get 60 inputs). Then you could stick to I2C.

user7508: The cathode line is being shared by all the Arduinos' OUT_PIN. When
one of them tries to set the pin HIGH, all the others are trying to
hold it LOW. This is a short-circuit condition that can damage the
Arduino's outputs. Even if they do survive, the voltage on the line will
be significantly below 5 V because of those Arduinos pulling the
line LOW. The more of them pull the line LOW, the lower the voltage
will be.
The simple solution would be to change the protocol such that only the
Arduino that is currently making a measurement can pull that line, while
the others keep their OUT_PIN in high-impedance mode (i.e. INPUT).
This is fragile because... bugs happen, and you may still be making a
short-circuit. A more robust solution would be to connect only the
master to the cathode, and give it the responsibility to drive the line
HIGH and LOW.
Now, a coupe of unrelated comments:

A float is four bytes: there is no point in transmitting ten bytes.

You can measure up to four capacitors with each Arduino (pins A0
through A3, you can use a digital pin for OUT_PIN), it is wasteful
to use one Arduino per capacitor.


Edit: If only the master controls OUT_PIN, then some communication
protocol is needed in order to synchronize it with the slaves, so that
they can release IN_PIN at the right time. The simplest protocol I can
think of is the following: when the master sends something (anything)
to a slave, this message means “please release IN_PIN now”.
Here is some untested code implementing this idea:
master:
void loop() {
    // ...
    for (int node = nodeStart; node <= nodeMax; node++) {

        // Ask the slave to release the input pin.
        Wire.beginTransmission(node);
        Wrire.write(0);
        Wire.endTransmission();
        delay(10);  // give it time to do so

        // Charge the capacitors.
        digitalWrite(OUT_PIN, HIGH);

        // Ask the slave to read the capacitance.
        Wire.requestFrom(node, sizeof(capacitanceSlave));

        // Discharge.
        digitalWrite(OUT_PIN, LOW);

        // ...
    }
}

slave:
void setup() {
    // ...
    Wire.onReceive(receiveEvent);
    Wire.onRequest(requestEvent);
}

// Release IN_PIN when the master sends a message.
void receiveEvent(int byte_count) {
    pinMode(IN_PIN, INPUT);
    while (byte_count--)
        Wire.read();  // discard the received message
}

void requestEvent() {
    int val = analogRead(IN_PIN);
    // transmit the result... then
    pinMode(IN_PIN, OUTPUT);  // discharge
}


85340: <p>I want to measure changes in capacitance over time. One Arduino is used per capacitance sensor. There is one anode per Arduino and a total of one common cathode (see the picture)</p>
<p>With four Arduinos connected in series via an I²C master-slave connection, successful results were obtained.
With more than four Arduinos, all measurement results were 0, because no voltage is measured at the input pin anymore.</p>
<p>I then lowered the reference voltage for analogRead. So 10 Arduinos in series were possible. However, the measured values are clearly lower. However, no absolute values are to be measured, but any difference in the capacitance is sufficient. Finally 50 Arduinos should be used.</p>
<p>I have thought of the following possibilities:</p>
<ol>
<li>reduce the reference voltage further, but this may reduce the measurement results further, so that no deflection is measured.</li>
<li>increase the output voltage at the Arduino via an operational amplifier to compensate the voltage drop.</li>
</ol>
<p>How could I proceed to get a usable result with all 50 Arduinos? The code I used is to be found below.</p>
<p><a href="https://i.stack.imgur.com/5KHSo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5KHSo.png" alt="Enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/JGqCJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JGqCJ.png" alt="enter image description here" /></a></p>
<h3>Master</h3>
<pre><code>#include &lt;Wire.h&gt;

volatile byte x1, x2;
volatile int val_slave;

const int OUT_PIN = A0;
const int IN_PIN = A2;


#define nodeMax 10
#define nodeStart 2


void setup() {
  analogReference(DEFAULT);
  Wire.begin();

  pinMode(OUT_PIN,OUTPUT);
  pinMode(IN_PIN,OUTPUT);

  Serial.begin(9600);
  // put your setup code here, to run once:

}

  void loop() {
    
    pinMode(IN_PIN,INPUT);
    digitalWrite(OUT_PIN,HIGH);

    int val = analogRead(IN_PIN);

    digitalWrite(OUT_PIN,LOW);
    pinMode(IN_PIN,OUTPUT);

    
    Serial.print(val);
    Serial.print(&quot;,&quot;);
  
      delay(10);
      
    for (int node = nodeStart; node &lt;= nodeMax; node++) {

        // Ask the slave to release the input pin.
        Wire.beginTransmission(node);
        Wire.write(0);
        Wire.endTransmission();
        delay(10);  // give it time to do so

        // Charge the capacitors.
        digitalWrite(OUT_PIN, HIGH);

        // Ask the slave to read val.
        Wire.requestFrom(node, sizeof(val));

        // Discharge.
        x1 = Wire.read();
    x2 = Wire.read();

    val_salve = (int)x1 &lt;&lt; 8 | (int)x2;

        Serial.print(val_slave);
        Serial.print(&quot;,&quot;);
        
        digitalWrite(OUT_PIN, LOW);
        delay(10);
     
    }
    Serial.println();
    delay(50);
}
</code></pre>
<h3>Slave</h3>
<pre><code>const int IN_PIN=A2;


#include &lt;Wire.h&gt;
#define node 10



void setup() {
    // ...
    analogReference(DEFAULT);
    Wire.begin(node);
    Serial.begin(9600);

    pinMode(IN_PIN,OUTPUT);
    
    Wire.onReceive(receiveEvent);
    Wire.onRequest(requestEvent);
 
}



// Release IN_PIN when the master sends a message.
void receiveEvent(int byte_count) {
    pinMode(IN_PIN, INPUT);
    while (byte_count--)
        Wire.read();  // discard the received message
}

void loop ()
{
}

void requestEvent() {
    int val = analogRead(IN_PIN);
    // transmit the result... then

    
  
    Wire.write(highByte(val));
    Wire.write(lowByte(val));

    pinMode(IN_PIN, OUTPUT);  // discharge
}




</code></pre>
 14095: <p>The I²C bus was never intended as a distribution bus between many computers. The outputs are not designed to drive long wires. With a lot of kludging you may get this to work, but it is definitely not repeatable or reliable.</p>
<p>Consider something else. <a href="https://en.wikipedia.org/wiki/CAN_bus" rel="nofollow noreferrer">CAN</a> can do maybe 60 nodes, depending on the transceiver chosen. It is relatively inexpensive.</p>
 10794: <p>You might want to consider using a RS485 protocol. Unlike I2C this uses &quot;balanced&quot; wiring so is more suitable for longer cable runs.</p>
<p>I described a way of coding a number of Arduinos using a &quot;rolling master&quot; protocol <a href="https://gammon.com.au/forum/?id=11428" rel="nofollow noreferrer">here</a> - this lets you connect a considerable number of Arduinos to the two wires, and they take turns to send the data.</p>
<p>However in your case, since you are measuring capacitance (not capacity?) then each of your Arduinos can measure 6 (or possibly more) analog readings, so you don't need 50, you need 50/6 = 8.33 Arduinos (OK, nine).</p>
<p>The <a href="https://store-usa.arduino.cc/products/arduino-micro?selectedStore=us" rel="nofollow noreferrer">Arduino Micro</a>, for example, has 12 analog input channels, so you would only need 4 (to get 48 inputs) or 5 (to get 60 inputs). Then you could stick to I2C.</p>
 7508: <p>The cathode line is being shared by all the Arduinos' <code>OUT_PIN</code>. When
one of them tries to set the pin <code>HIGH</code>, all the others are trying to
hold it <code>LOW</code>. This is a short-circuit condition that can damage the
Arduino's outputs. Even if they do survive, the voltage on the line will
be significantly below 5 V because of those Arduinos pulling the
line <code>LOW</code>. The more of them pull the line <code>LOW</code>, the lower the voltage
will be.</p>
<p>The simple solution would be to change the protocol such that only the
Arduino that is currently making a measurement can pull that line, while
the others keep their <code>OUT_PIN</code> in high-impedance mode (i.e. <code>INPUT</code>).
This is fragile because... bugs happen, and you may still be making a
short-circuit. A more robust solution would be to connect <em>only</em> the
master to the cathode, and give it the responsibility to drive the line
<code>HIGH</code> and <code>LOW</code>.</p>
<p>Now, a coupe of unrelated comments:</p>
<ul>
<li><p>A <code>float</code> is four bytes: there is no point in transmitting ten bytes.</p>
</li>
<li><p>You can measure up to four capacitors with each Arduino (pins <code>A0</code>
through <code>A3</code>, you can use a digital pin for <code>OUT_PIN</code>), it is wasteful
to use one Arduino per capacitor.</p>
</li>
</ul>
<p><strong>Edit</strong>: If only the master controls <code>OUT_PIN</code>, then some communication
protocol is needed in order to synchronize it with the slaves, so that
they can release <code>IN_PIN</code> at the right time. The simplest protocol I can
think of is the following: when the master sends something (<em>anything</em>)
to a slave, this message means “please release <code>IN_PIN</code> now”.</p>
<p>Here is some untested code implementing this idea:</p>
<p><strong>master</strong>:</p>
<pre class="lang-cpp prettyprint-override"><code>void loop() {
    // ...
    for (int node = nodeStart; node &lt;= nodeMax; node++) {

        // Ask the slave to release the input pin.
        Wire.beginTransmission(node);
        Wrire.write(0);
        Wire.endTransmission();
        delay(10);  // give it time to do so

        // Charge the capacitors.
        digitalWrite(OUT_PIN, HIGH);

        // Ask the slave to read the capacitance.
        Wire.requestFrom(node, sizeof(capacitanceSlave));

        // Discharge.
        digitalWrite(OUT_PIN, LOW);

        // ...
    }
}
</code></pre>
<p><strong>slave</strong>:</p>
<pre class="lang-cpp prettyprint-override"><code>void setup() {
    // ...
    Wire.onReceive(receiveEvent);
    Wire.onRequest(requestEvent);
}

// Release IN_PIN when the master sends a message.
void receiveEvent(int byte_count) {
    pinMode(IN_PIN, INPUT);
    while (byte_count--)
        Wire.read();  // discard the received message
}

void requestEvent() {
    int val = analogRead(IN_PIN);
    // transmit the result... then
    pinMode(IN_PIN, OUTPUT);  // discharge
}
</code></pre>
