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

IOError: [Errno 121] Remote I/O error #10

Closed titusece closed 6 years ago

titusece commented 6 years ago

Hello,

I am getting the below error when I run the examples. Installed the libraries based on the README.

Seems my slave address is 0x77, but python code is using 0x76, thats why I am getting this issue ?

BTW, this one works, its C code. https://github.com/twartzek/bme680-raspberry

But I would like to use python.

pi@picontainer1:~/bme680/examples $ 
pi@picontainer1:~/bme680/examples $ python --version
Python 2.7.13
pi@picontainer1:~/bme680/examples $ 
pi@picontainer1:~/bme680/examples $ 
pi@picontainer1:~/bme680/examples $ ls
indoor-air-quality.py  read-all.py  temp-press-hum.py
pi@picontainer1:~/bme680/examples $ python read-all.py
Traceback (most recent call last):
  File "read-all.py", line 6, in <module>
    sensor = bme680.BME680()
  File "/usr/local/lib/python2.7/dist-packages/bme680/__init__.py", line 25, in __init__
    self.chip_id = self._get_regs(CHIP_ID_ADDR, 1)
  File "/usr/local/lib/python2.7/dist-packages/bme680/__init__.py", line 285, in _get_regs
    return self._i2c.read_byte_data(self.i2c_addr, register)
IOError: [Errno 121] Remote I/O error
pi@picontainer1:~/bme680/examples $ 
pi@picontainer1:~/bme680/examples $ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- 77                         
pi@picontainer1:~/bme680/examples $ 
pi@picontainer1:~/bme680/examples $ 

Thanks for the help.

titusece commented 6 years ago

Hello,

Edited the following file for I2C address. https://github.com/pimoroni/bme680/tree/master/library/bme680/__init__.py

    def __init__(self, i2c_addr=I2C_ADDR_PRIMARY, i2c_device=None):
TO
    def __init__(self, i2c_addr=I2C_ADDR_SECONDARY, i2c_device=None):

Where, I2C_ADDR_PRIMARY => 0x76 I2C_ADDR_SECONDARY=> 0x77

Gadgetoid commented 6 years ago

Are you using our add-on board, or a generic bme680 breakout/your own hardware?

djcaff263 commented 6 years ago

I am have the same issue but this didn't fix it for me. My I2C address is also 0x77 and im using a Adafruit bme680 chip.

Traceback (most recent call last):
  File "read-all.py", line 6, in <module>
    sensor = bme680.BME680()
  File "build/bdist.linux-armv7l/egg/bme680/__init__.py", line 25, in __init__
  File "build/bdist.linux-armv7l/egg/bme680/__init__.py", line 285, in _get_regs
IOError: [Errno 121] Remote I/O error
StefanFabian commented 3 years ago

Instead of modifying the library you can also just pass bme680.BME680(i2c_addr=bme680.I2C_ADDR_SECONDARY) to the constructor of the sensor class.