pimoroni / bme680-python

Python library for the BME680 gas, temperature, humidity and pressure sensor.
https://shop.pimoroni.com/products/bme680
MIT License
260 stars 93 forks source link

Solution for "BME680 Not Found. Invalid CHIP ID: 0x-79" #23

Closed hongbo-miao closed 5 years ago

hongbo-miao commented 5 years ago

First, thank you for this awesome library!

This is just to save some time for future people who might meet same error.

I am using BME680 on Jetson TX2. I got the error

RuntimeError: BME680 Not Found. Invalid CHIP ID: 0x-79

In my case, my I2C address is using 0x77.

Based on the example code, it should automatically switch to 0x77 if 0x76 failed, but it does not.

examples/read-all.py

try:
    sensor = bme680.BME680(bme680.I2C_ADDR_PRIMARY)  # 0x76
except IOError:
    sensor = bme680.BME680(bme680.I2C_ADDR_SECONDARY)  # 0x77

Solution 1

So basically you just need replace

sensor = bme680.BME680(bme680.I2C_ADDR_PRIMARY)

to

sensor = bme680.BME680(bme680.I2C_ADDR_SECONDARY)

It will work.

Solution 2

Or you can connect BME680's SDO PIN to the ground, which will change I2C address from 0x77 to 0x76.