BME280 detected, but read fails with Remote I/O Error

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
mknoll
 
Posts: 5
Joined: Mon Sep 10, 2012 5:33 pm

BME280 detected, but read fails with Remote I/O Error

Post by mknoll »

Hoping someone might be able to help reading a BME280 on a Raspberry Pi. I've tried different OS, different code samples, different Raspberry Pis, so I suspect a faulty sensor, but, am hopeful someone might know a configuration error or other solutions.

I have te BME280 breakout board with a QWIIC shim connected to a raspberry pi. My i2c bus is enabled. i2c-detect finds the sensor on 0x77:

$ sudo 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

Using example code to read the values, I get a Remote I/O error. I've used SparkFun's example code, and others I've found online. I've verified the address is 0x77. I get the same error with other addresses.

$ python bme280.py

SparkFun BME280 Sensor Example 1

Error connecting to Device: 77, [Errno 121] Remote I/O error
The Qwiic BME280 device isn't connected to the system. Please check your connection


I've tested on a rather old raspbian install on a Raspberry Pi 1 A+. I've also tested on a newly downloaded version of rasbian, on the same pi. Also, the same newly downloaded version, on a Raspberry Pi 3 B.

Anyone have any suggests? Might the sensor or shim be faulty?

Thanks,
Mike

User avatar
freddyboomboom
 
Posts: 267
Joined: Wed Feb 16, 2022 7:55 pm

Re: BME280 detected, but read fails with Remote I/O Error

Post by freddyboomboom »

Can you provide a link to the sensor you are using?

Can you provide a copy of the code you're using, or a link to the code?

What version of Python are you using?

mknoll
 
Posts: 5
Joined: Mon Sep 10, 2012 5:33 pm

Re: BME280 detected, but read fails with Remote I/O Error

Post by mknoll »

I'm using this sensor: https://www.adafruit.com/product/2652
This shim: https://www.adafruit.com/product/4463

I've tried this code: https://learn.sparkfun.com/tutorials/qw ... ample-code
I've also tried this code: https://www.raspberrypi-spy.co.uk/2016/ ... in-python/

On an old raspbian install, I was using Python version 2.7.13.
On a new raspbian install, I was using the latest 3.x version.

User avatar
freddyboomboom
 
Posts: 267
Joined: Wed Feb 16, 2022 7:55 pm

Re: BME280 detected, but read fails with Remote I/O Error

Post by freddyboomboom »

The second code has the default address of the sensor as 0x76.

The first code seems to have it set in the qwiic_bme280 library. Sparkfun's version of the sensor seems to be using the same address that Adafruiit's sensor is using.

What happens when you use Adafruit's code from the breakout board's Learn Guide? https://learn.adafruit.com/adafruit-bme ... ython-test

User avatar
adafruit_support_carter
 
Posts: 29457
Joined: Tue Nov 29, 2016 2:45 pm

Re: BME280 detected, but read fails with Remote I/O Error

Post by adafruit_support_carter »

The Adafruit libraries are now all Python 3 only. Python 2 is no longer supported. So please stick with the newer OS with Python 3 setup.

As suggested above, please try running the example per the guide:
https://learn.adafruit.com/adafruit-bme ... ython-test

Don't overlook the link to the other guide which has a lot of initial required setup:
https://learn.adafruit.com/circuitpytho ... rypi-linux

mknoll
 
Posts: 5
Joined: Mon Sep 10, 2012 5:33 pm

Re: BME280 detected, but read fails with Remote I/O Error

Post by mknoll »

I tried those libraries, on a clean raspbian install, on a Pi 3 B, on python 3. Still the same Remote I/O error. Output below.

Starting to suspect I have a bad device, cable or shim. But it's odd that i2cdetect shows a device on the address, But that's the most I've gotten from the device.

Thanks for your help! Let me know if you have any other thoughts.



Python 3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import board
>>> from adafruit_bme280 import basic as adafruit_bme280
>>> i2c = board.I2C() # uses board.SCL and board.SDA
>>> bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/adafruit_bus_device/i2c_device.py ", line 174, in __probe_for_device
self.i2c.writeto(self.device_address, b"")
File "/usr/local/lib/python3.9/dist-packages/busio.py", line 169, in writeto
return self._i2c.writeto(address, buffer, stop=stop)
File "/usr/local/lib/python3.9/dist-packages/adafruit_blinka/microcontroller/g eneric_linux/i2c.py", line 52, in writeto
self._i2c_bus.write_bytes(address, buffer[start:end])
File "/usr/local/lib/python3.9/dist-packages/Adafruit_PureIO/smbus.py", line 3 14, in write_bytes
self._device.write(buf)
OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/adafruit_bus_device/i2c_device.py ", line 180, in __probe_for_device
self.i2c.readfrom_into(self.device_address, result)
File "/usr/local/lib/python3.9/dist-packages/busio.py", line 159, in readfrom_ into
return self._i2c.readfrom_into(address, buffer, stop=stop)
File "/usr/local/lib/python3.9/dist-packages/adafruit_blinka/microcontroller/g eneric_linux/i2c.py", line 59, in readfrom_into
readin = self._i2c_bus.read_bytes(address, end - start)
File "/usr/local/lib/python3.9/dist-packages/Adafruit_PureIO/smbus.py", line 1 81, in read_bytes
return self._device.read(number)
OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/dist-packages/adafruit_bme280/basic.py", line 3 70, in __init__
self._i2c = i2c_device.I2CDevice(i2c, address)
File "/usr/local/lib/python3.9/dist-packages/adafruit_bus_device/i2c_device.py ", line 61, in __init__
self.__probe_for_device()
File "/usr/local/lib/python3.9/dist-packages/adafruit_bus_device/i2c_device.py ", line 183, in __probe_for_device
raise ValueError("No I2C device at address: 0x%x" % self.device_address)
ValueError: No I2C device at address: 0x77

User avatar
adafruit_support_carter
 
Posts: 29457
Joined: Tue Nov 29, 2016 2:45 pm

Re: BME280 detected, but read fails with Remote I/O Error

Post by adafruit_support_carter »

Does the issue always occur on the same line of code?

After it hits the erorr, can you exit python and still get the address to show up in an I2C scan?

And if you repeat several I2C scans back-to-back, the address always shows up?

mknoll
 
Posts: 5
Joined: Mon Sep 10, 2012 5:33 pm

Re: BME280 detected, but read fails with Remote I/O Error

Post by mknoll »

I purchases a different adapter for the Pi to Qwiic, https://www.sparkfun.com/products/15945. With it, I am able to read the sensor values

Switching back to the shim, it appears it is making a poor connection to the Pi. If I apply some lateral force to the pin header, I am able to read the sensor as well.

Is there any advice on getting the shim, https://www.adafruit.com/product/4463, to connect securely to the Pi?

Thanks!
Mike

User avatar
freddyboomboom
 
Posts: 267
Joined: Wed Feb 16, 2022 7:55 pm

Re: BME280 detected, but read fails with Remote I/O Error

Post by freddyboomboom »

The shim is a Sparkfun product also. Maybe they have a suggestion.

My suggestion would be to solder on a proper connector instead of expecting holes to be "good enough".

User avatar
adafruit_support_carter
 
Posts: 29457
Joined: Tue Nov 29, 2016 2:45 pm

Re: BME280 detected, but read fails with Remote I/O Error

Post by adafruit_support_carter »

Yep, please contact Sparkfun and see what they may advise. It's a tricky design issue attempting to provide a solder free option. Since it relies on fitting just right so it pushes against the pins, any amount of slop could compromise that connection. And it may do so intermittently.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”