Closed
Description
Hello,
I just received a Adafruit BMP280 and I can't make the SPI example work. This is the error I get:
Traceback (most recent call last):
File "/home/iyan/bmp280/example.py", line 13, in <module>
bmp280 = adafruit_bmp280.Adafruit_BMP280_SPI(spi, bmp_cs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/iyan/bmp280/.venv/lib/python3.11/site-packages/adafruit_bmp280.py", line 531, in __init__
super().__init__()
File "/home/iyan/bmp280/.venv/lib/python3.11/site-packages/adafruit_bmp280.py", line 143, in __init__
raise RuntimeError("Failed to find BMP280! Chip ID 0x%x" % chip_id)
RuntimeError: Failed to find BMP280! Chip ID 0xff
I2C works just as described in the example and in the tutorial.
I was first using a Raspberry Pi 5, but because I read other people having issues with the latest RPi, I also tried on a RPi 3B with the same outcome. I was also using a GPIO Extension Board, but just in case I also tried connecting the cables directly, but it doesn't make a difference.
This is the exact example I'm trying to run:
import time
import board
import digitalio
import adafruit_bmp280
spi = board.SPI()
bmp_cs = digitalio.DigitalInOut(board.D10)
bmp280 = adafruit_bmp280.Adafruit_BMP280_SPI(spi, bmp_cs)
bmp280.sea_level_pressure = 1013.25
while True:
print("\nTemperature: %0.1f C" % bmp280.temperature)
print("Pressure: %0.1f hPa" % bmp280.pressure)
print("Altitude = %0.2f meters" % bmp280.altitude)
time.sleep(2)
And here is a photo of the setup:
Probably related to this I found this closed issue (#27) and this closed thread in the forum.
Any ideas what might I be doing wrong? Or how to debug further? I have no prior experience with SPI.
Metadata
Metadata
Assignees
Labels
No labels