TCA9548A with BME680

Hi Team,

I am unable to retrieve BME680 data using 8 Port Multiplexer. Could you please advise.

import time
import board
import busio
import adafruit_bme680
import adafruit_tca9548a

Create I2C bus as normal

i2c = board.I2C() # uses board.SCL and board.SDA

Create the TCA9548A object and give it the I2C bus

tca = adafruit_tca9548a.TCA9548A(i2c)

Select channel 1

tca.channels[1].enabled = True

Create separate I2C instance for channel 1

i2c_bme680 = busio.I2C(board.SCL, board.SDA)

For the BME680 sensor, create it using the separate I2C instance

bme680 = adafruit_bme680.Adafruit_BME680_I2C(i2c_bme680)

After initial setup, you can use the BME680 sensor as normal.

while True:
temperature = bme680.temperature
humidity = bme680.humidity
pressure = bme680.pressure
gas = bme680.gas

print("Temperature:", temperature)
print("Humidity:", humidity)
print("Pressure:", pressure)
print("Gas Resistance:", gas)

time.sleep(1)

Thanks,
Ravi

Hi, do you have any problems with the code or any other wiki? Can you point out which wiki is the problem?
Maybe you can try to check whether the wiring is correct, whether the interface is loose, if not the above problem, you need to consider the problem of the code part