I2C-Communication problems between D1 mini and Nano

Good evening,

I'm trying to make a D1 mini and a Nano communicate trough Standard Serial Communication (TX/RX).
The data, I'm trying to send, comes from an Bluedot-BME280-TSL2591 Sensor. I use 2 of those Sensors. Because the TSL2591 is hardwired to the 0x77 adress, 1 Bluedot ist connected to the D1 mini and the other one to the Nano. I was able to succesfully send a structs of the Bluedot information from the Nano to the D1.

Now I tried to expand the communcation and let the D1 mini send his recieved Bluedot-Information TO the Nano after recieving the Bluedot-Information FROM the Nano. Unfortunately the D1 mini still recieves the information from the Nano and shows it on the Serial-Monitor, but not vice versa.

Serial-Monitor of the Nano:

R⸮⸮AQBH⸮{D⸮⸮CBECR.... etc.

Reciever-Code(D1 mini):

//Wachtdog eingügen//
#include <Wire.h>
#include "BlueDot_BME280_TSL2591.h"

BlueDot_BME280_TSL2591 bme280;
BlueDot_BME280_TSL2591 tsl2591;

union binf {
  byte bin[4];
  float num;
};

struct stats {
  union binf temperature;
  union binf humidity;
  union binf pressure;
  union binf altitude;
  union binf lux;
};

struct stats myRData;
struct stats mySensorData;

union binf *ptr;
int count = 0;
byte inByte;

void recieveAndSend(){

   if(Serial.available()){
    if(Serial.read() == '\001'){
      Serial.println("FIRST");
      while(!Serial.available());//Solange nicht im Empfängerbuffer ist warten
      if(Serial.read() == '\002') {
        Serial.println("SECOND");
        ptr = (union binf*)&myRData;
        while(!Serial.available());        
        while(inByte != '\003') {
          for( int i = 0; i<4; i++){
            if(inByte == '\003'){
              count++;
              break;
            }
            ptr -> bin[i] = Serial.read();
            inByte = ptr -> bin[i];
            count++;
            while(!Serial.available());                     
          }
          if(count < 20 ){
            Serial.println(ptr -> num, 3);
            *(ptr+1);
          }else{
            ptr = (union binf*)&myRData;
            count = 0;
          }        
        }
        inByte = 0;
        Serial.print("\004"); //Senden einleiten
        
        mySensorData.temperature.num = bme280.readTempC();
        mySensorData.humidity.num = bme280.readHumidity();
        mySensorData.pressure.num = bme280.readPressure();
        mySensorData.altitude.num = bme280.readAltitudeMeter();
        mySensorData.lux.num = tsl2591.readIlluminance_TSL2591();

        Serial.write((const uint8_t*)&mySensorData, sizeof(struct stats));

        Serial.print("\005");
      }
    } 
    while(Serial.available()){
    Serial.read(); //Zum Schluss Empfangsbuffer flushen (Wegen NOW READING vom Sender)
  }    
  }
}

void setup() {
  // Begin the Serial at 9600 Baud
  Serial.begin(9600);

   Wire.begin(D2,D1);

  bme280.parameter.I2CAddress = 0x77;                 //The BME280 is hardwired to use the I2C Address 0x77              
  tsl2591.parameter.I2CAddress = 0x29;

  tsl2591.parameter.gain = 0b01;
  tsl2591.parameter.integration = 0b000; 

  tsl2591.config_TSL2591();

  bme280.parameter.sensorMode = 0b11;
  bme280.parameter.IIRfilter = 0b100;
  bme280.parameter.humidOversampling = 0b101;
  bme280.parameter.tempOversampling = 0b101;
  bme280.parameter.pressOversampling = 0b101;
  bme280.parameter.pressureSeaLevel = 1013.25;
  bme280.parameter.tempOutsideCelsius = 9;

  if (bme280.init_BME280() != 0x60)  
  {        
    Serial.println(F("Ops! BME280 could not be found!"));
    //while(1);
  }
  else
  {
    Serial.println(F("BME280 detected!"));
  }

  if (tsl2591.init_TSL2591() != 0x50)  
  {        
    Serial.println(F("Ops! TSL2591 could not be found!"));
    //while(1);
  }
  else
  {
    Serial.println(F("TSL2591 detected!"));
  }
  
  Serial.println();
  Serial.println();

}

void loop() {
  recieveAndSend();
}

Sender-Code(Nano)

#include <Wire.h>
#include <avr/wdt.h>
#include "BlueDot_BME280_TSL2591.h"

BlueDot_BME280_TSL2591 bme280;
BlueDot_BME280_TSL2591 tsl2591;

long sendTime = 10000; //Intervall(Millisek.) nach dem Weitterdaten gesendet werden (20min = 1200000ms)
unsigned long previousMillis; //Zeitpunkt des letzten Sendevorgangs

union binf {
  byte bin[4];
  float num;
};

struct stats {
  union binf temperature;
  union binf humidity;
  union binf pressure;
  union binf altitude;
  union binf lux;
};

struct stats mySensorData;
struct stats myRData;

union binf *ptr;
int count = 0;
byte inByte;

void sendAndRecieve() {

  unsigned long currentMillis = millis(); //Aktuelle Laufzeit abfragen

  if(currentMillis - previousMillis >= sendTime){
    mySensorData.temperature.num = bme280.readTempC();
    mySensorData.humidity.num = bme280.readHumidity();
    mySensorData.pressure.num = bme280.readPressure();
    mySensorData.altitude.num = bme280.readAltitudeMeter();
    mySensorData.lux.num = tsl2591.readIlluminance_TSL2591();
    
    Serial.print("\001\002");
    Serial.write((const uint8_t *)&mySensorData,sizeof(struct stats));
    Serial.print("\003");
    while(!Serial.available());
   
      if(Serial.read() == '\004'){
        Serial.println("NOW READING");
        ptr = (union binf*)&myRData;
        while(!Serial.available());
        while(inByte != '\005') {
          for(int i = 0; i<4; i++) {
            if(inByte == '\005') {
              count++;
              break;
            }
            ptr -> bin[i] = Serial.read();
            inByte = ptr -> bin[i];
            count++;
            while(!Serial.available());
          }
          if(count < 20) {
            Serial.println(ptr -> num, 3); //Float mit drei Nachkommastellen angeben
            *(ptr+1); //Pointer um 1 versetzen
          }else {
            ptr = (union binf*)&myRData;
            count = 0;
          }
        }
        inByte = 0;
        
      }
   
    

    previousMillis = currentMillis;

    while(Serial.available()){
    Serial.read(); //Zum Schluss Empfangsbuffer flushen (Wegen NOW READING vom Sender)
  }
  }
}


void setup() {
  // Begin the Serial at 9600 Baud
  Serial.begin(9600);

  Wire.begin();

  bme280.parameter.I2CAddress = 0x77;                 //The BME280 is hardwired to use the I2C Address 0x77              
  tsl2591.parameter.I2CAddress = 0x29;

  tsl2591.parameter.gain = 0b01;
  tsl2591.parameter.integration = 0b000; 

  tsl2591.config_TSL2591();

  bme280.parameter.sensorMode = 0b11;
  bme280.parameter.IIRfilter = 0b100;
  bme280.parameter.humidOversampling = 0b101;
  bme280.parameter.tempOversampling = 0b101;
  bme280.parameter.pressOversampling = 0b101;
  bme280.parameter.pressureSeaLevel = 1013.25;
  bme280.parameter.tempOutsideCelsius = 9;

  if (bme280.init_BME280() != 0x60)  
  {        
    Serial.println(F("Ops! BME280 could not be found!"));
    //while(1);
  }
  else
  {
    Serial.println(F("BME280 detected!"));
  }

  if (tsl2591.init_TSL2591() != 0x50)  
  {        
    Serial.println(F("Ops! TSL2591 could not be found!"));
    //while(1);
  }
  else
  {
    Serial.println(F("TSL2591 detected!"));
  }
  
  Serial.println();
  Serial.println();
}

void loop() {
  sendAndRecieve();
}

I'm yet not very experienced in I2C-Communication, so I can't find my failure and I'm hoping you guys can help me.

Why do you need to receive and send on the D1 ?

Make it the slave to the Nano.
D1 mini reads sensor #1 and sends to Nano.
Nano reads sensor #2 and reads the data for sensor #1 sent by D1 mini..
Nano does something with data from both sensors.

.

@ieee488

Because with the D1 mini I want to show the information provided by both of the Sensors on a webserver and the Nano controlls the actuators.

I have no experience with the D1 mini so I have no clue why its Serial would act any different than the Nano's.

.