Connect multiple BME680 sensors to 1 Arduino / Change analog pins used by BME680

Hi, I want to connect 2 BME680 sensors to my Arduino. Normally I just put the first sensor on pins A5 and A4. Can I change the analog pins for the second sensor to A3 and A2 so that both sensors work completely separately but still go through one Arduino? With some other sensors, I can just input the Analog address I want to use but for the BME680 I don't know how to do this. Thanks in advance for the help.

Best reply by CheesLover

Update: In the end, I asked Chat GPT using the following prompt: 

"Search the web for beginner-friendly information regarding connecting two BME680 sensors to Arduino Uno/Mega using the Arduino IDE, and reading temperature, pressure, humidity, and gas resistance data from them. Also include troubleshooting tips for when the SDO pin of the sensor is connected to the GND pin of the Arduino but no readings are obtained. Include information on how to verify the correct wiring of the BME680 sensors and how to properly configure the SDO pin for data reading. Look for resources that provide code examples on how to read temperature, pressure, humidity, and gas resistance data from two BME680 sensors simultaneously. "

This gave me the following steps with some explenaiton added: 

  1. Connect the VCC pin of each sensor to the 3.3V pin of the Arduino, GND pin to GND, SDA pin to A4, and SCL pin to A5.

  2. To differentiate between the two sensors, connect the SDO pin of one sensor to GND and the SDO pin of the other sensor to VCC.

  3. Install the BME680 library in the Arduino IDE. You can do this by going to Sketch > Include Library > Manage Libraries and then searching for "BME680".

  4. Once the library is installed, open the example code by going to File > Examples > Adafruit BME680 Library > bme680test.

  5. Modify the code to include the second sensor by copying the initialization and data reading functions and changing the I2C address to 0x77 for the second sensor.

  6. Upload the modified code to the Arduino and open the serial monitor to see the readings from both sensors.

but it still wasn't clear, so I asked for a code example:

"I followed step 1 to 5, but i can't find the part of the code where i need to change 0x76 to 0x77. Can you show me a code example where this is located. "

This is the code that chat GPT gave me and it worked perfectly for me I had change nothing.

CONCLUSION:

This code solved my problems and worked perfectly with the following cables connected for both sensors: 

-Connect the VCC pin of each sensor to the 3.3V pin of the Arduino, GND pin to GND, SDA pin to A4, and SCL pin to A5

And the following connection wich is different for both sensors:

-To differentiate between the two sensors, connect the SDO pin of one sensor to GND and the SDO pin of the other sensor to the 3.3V

 

View original
3 replies
Resolved