Long story short, I am using this BME280 library which utilizes the GPIO one. Every thing seems to be working great, except that after extended use, I get this fun little error:

Traceback (most recent call last):
  File "Skynet/main.py", line 8, in <module>
    from bme import ReadTPH
  File "/home/pi/Skynet/bme.py", line 9, in <module>
    sensor = BME280(mode=BME280_OSAMPLE_8)
  File "/home/pi/Skynet/Adafruit_BME280.py", line 90, in __init__
  File "/home/pi/Skynet/Adafruit_BME280.py", line 96, in _load_calibration
    self.dig_T1 = self._device.readU16LE(BME280_REGISTER_DIG_T1)
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_GPIO-1.0.3-py2.7.egg/Adafruit_GPIO/I2C.py", line 185, in readU16LE
    return self.readU16(register, little_endian=True)
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_GPIO-1.0.3-py2.7.egg/Adafruit_GPIO/I2C.py", line 164, in readU16
    result = self._bus.read_word_data(self._address,register) & 0xFFFF
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_PureIO-0.2.1-py2.7.egg/Adafruit_PureIO/smbus.py", line 173, in read_word_data
    ioctl(self._device.fileno(), I2C_RDWR, request)
IOError: [Errno 121] Remote I/O error

Now, I can of course catch this with try-except, but what I cannot do is resolve it. There must be a way? The only thing that currently works is unhooking the vin to "reboot" the sensor. Is there a way to do this programmatically? Once this in the final design, I can't tell the user: "unplug this cable when it breaks hur dur"

Any pointers would be greatly appreciated!

EDIT: According to Adafruit, I can force a reset:

You can force a reset by writing 0xB6 to register 0xE0

However, I have no idea how to do that with the libraries at hand.

  • The obvious thing to try is a different software package. Why Adafruit? Was it the first you found?
    – joan
    Apr 2, 2017 at 8:10
  • I bought this stuff from Adafruit, that's why.
    – MattyMatt
    Apr 2, 2017 at 16:41

2 Answers 2


I found some help via the Adafruit forums. From there I got this tidbit

You can force a reset by writing 0xB6 to register 0xE0

From that I was able to find


In the linked BME280 lib. I then simply added a function to that class

def reset_sensor(self):
    self._device.write8(BME280_REGISTER_SOFTRESET, 0xB6)

Of course it hasn't yet crashed again, but I suspect that this will work.


try out this lib and see if it works for you. BME280 Python lib make sure your i2c address is correct.

  • Hi, this isn't quite for the same device, but also, does not solve my problem
    – MattyMatt
    Apr 4, 2017 at 8:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.