Did you know that the BME280 sensor has two different I2C addresses? That means, you can read two BME280 sensors at the same time on the I2C bus. One sensor will use the default address (0x77) and the other sensor will use the alternative address (0x76).
First, let's connect the sensors like this:
When you leave the SDO pin from one sensor unconnected, you are telling this sensor to use the default I2C address (0x77).
But when you connect the SDO pin from the second sensor to GND, you are telling it to use the alternative I2C address (0x76).
Now we need the software. If you did not do this yet, download and install the BlueDot BME280 library through the Arduino IDE. This is important, because the BlueDot library does work with two BME280 sensors on the I2C bus.
Not every library for the BME280 available on the internet works with two sensors on the I2C bus. Just to be safe, download and install the BlueDot BME280 library.
Just go to Sketch -> Include Library -> Manage Libraries... and search for the BlueDot BME280 Library. Now click on it and install the library. You can also visit the GitHub repository to download the latest version of the library or just click on this button bellow.
After installing the library, run the example for multiple sensors on the I2C bus. Open up File -> Examples -> BlueDot_BME280_library -> BME280_MultipleSensorsI2C.
After uploading the code into your Arduino, open up the Serial Monitor at 9600 baud speed to get the temperature, humidity, pressure and altitude from both sensors at the same time.
The functions for each sensor are slightly different. At the beginning of the program you declare two objects bme1 and bme2, one for each sensor. We need those to keep the calibration parameters for each sensor separated from each other.
BlueDot_BME280 bme1; //Object for Sensor 1 BlueDot_BME280 bme2; //Object for Sensor 2
Now, the functions starting with bme1 refers to the first sensor, while the functions starting with bme2 refers to the second sensor.
Serial.println(bme1.readTempC()); Serial.println(bme1.readTempF()); Serial.println(bme1.readHumidity()); Serial.println(bme1.readPressure()); Serial.println(bme1.readAltitudeMeter()); Serial.println(bme1.readAltitudeFeet()); Serial.println(bme2.readTempC()); Serial.println(bme2.readTempF()); Serial.println(bme2.readHumidity()); Serial.println(bme2.readPressure()); Serial.println(bme2.readAltitudeMeter()); Serial.println(bme2.readAltitudeFeet());