bme280-python icon indicating copy to clipboard operation
bme280-python copied to clipboard

Unsure Set-up

Open Mason3548 opened this issue 6 months ago • 1 comments

I couldn't find where the code has the SCK and SDI pins wired to so I went with the default and wired them in the raspberry pi 4b to the SCL and SDA pins. The sensor is on and powered correctly but I not sure exactly where to wire sensor to on GPIO pins. I am currently getting this error:

Traceback (most recent call last): File "/home/mason35/Desktop/Enviroment/env/lib/python3.11/site-packages/bme280/init.py", line 215, in setup chip = self._bme280.get("CHIP_ID") ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/mason35/Desktop/Enviroment/env/lib/python3.11/site-packages/i2cdevice/init.py", line 230, in get self.read_register(register) File "/home/mason35/Desktop/Enviroment/env/lib/python3.11/site-packages/i2cdevice/init.py", line 183, in read_register self.values[register.name] = self._i2c_read(register.address, register.bit_width) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/mason35/Desktop/Enviroment/env/lib/python3.11/site-packages/i2cdevice/init.py", line 288, in _i2c_read for x in self._i2c.read_i2c_block_data(self._i2c_address, register, bit_width // self._bit_width): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/mason35/Desktop/Enviroment/env/lib/python3.11/site-packages/smbus2/smbus2.py", line 619, in read_i2c_block_data ioctl(self.fd, I2C_SMBUS, msg) OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/mason35/Desktop/Enviroment/BME280Weather.py", line 24, in temperature = bme280.get_temperature() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/mason35/Desktop/Enviroment/env/lib/python3.11/site-packages/bme280/init.py", line 248, in get_temperature self.update_sensor() File "/home/mason35/Desktop/Enviroment/env/lib/python3.11/site-packages/bme280/init.py", line 234, in update_sensor self.setup() File "/home/mason35/Desktop/Enviroment/env/lib/python3.11/site-packages/bme280/init.py", line 219, in setup raise RuntimeError("Unable to find bme280 on 0x{:02x}, IOError".format(self._i2c_addr)) RuntimeError: Unable to find bme280 on 0x76, IOError

if anyone knows what this error means please let me know how I can fix this issue

Mason3548 avatar Jul 18 '25 18:07 Mason3548

I2C pins are GPIOs 2 and 3 - https://pinout.xyz/pinout/i2c

A photo of your wiring setup might help with diagnosis.

You can also use i2ctools:

sudo apt install i2c-tools

And check what devices your Pi can see on the I2C bus like so:

sudo i2cdetect -y 1

Gadgetoid avatar Jul 22 '25 13:07 Gadgetoid