I2C interference SENSOR(SCL+SDA) and MasterSlave comm I am building a weather station with an Arduino slave (dedicated to a rain gauge - depicted below as a reed switch) and a NodeMCU master with some additional sensors.



One such sensor, a BMP280 uses D1 and D2 as SCL and SDA, while slave control is using D3 and D4 for communication with Arduino.

When I enable Wire.begin for slave communication, my BMP280 readings go nuts


#include &lt;Adafruit_BMP280.h&gt;

#define BMP_SCK 13
#define BMP_MISO 12
#define BMP_MOSI 11 
#define BMP_CS 10

Adafruit_BMP280 bmp;

// masterSlave
#include &lt;Wire.h&gt;
#define I2CAddressESPWifi 8
...

void setup() {

    if (!bmp.begin()) {  
        Serial.println("Could not find a valid BMP280 sensor, check wiring!");
        while (1);
    }

    // masterSlave - generates problem with BMP280...
    Wire.begin(0,2);//Change to Wire.begin() for non ESP. D3 SDA  D4 SCL



  BMP280 Temp = -136.42 *C 
  
  Pressure = 125136.25 Pa 


as opposed to this reading when Wire.begin is commented out.

    // COMMENTED OUT FOR DEBUGGING
    //masterSlave - generates problem with BMP280...
    //Wire.begin(0,2);//Change to Wire.begin() for non ESP. D3 SDA  D4 SCL



  BMP280 Temp = 20.01 *C
  
  Pressure = 93464.36 Pa


I attempted setting D3 and D4 to LOW while reading from BMP280, but it had no effect on readings.
The Adafruit BMP280 library uses the Wire library. It calls begin() at default pins (D1, D2). And then you begin() the same Wire object at different pins. From that moment the BMP280 library can't communicate with the sensor.

The I2C (a.k.a. TwoWire or Wire) is a bus. Many devices can be wired to the same pair of pins. They must listen on different addresses. So wire both devices to the D1, D2 and use in slave Arduino an address different then the address of the sensor.

The esp8266 and the sensor are 3.3 V devices. The Uno is a 5 V device. You should use logic level conversion on SDA/SCL to Uno.