I’m attaching a BME280 to a Raspberry Pi Pico using an Adafruit PiCowbell Adalogger for Pico - MicroSD, RTC & STEMMA QT. I can talk on the I2C bus successfully to a PiicoDev board, but I’m having trouble with the BME280.
The code examples for the BME280 all require the use of smbus2 module to pull in SMBus class.
I’ve installed smbus2 in Thonny so it’s there as a lib. When I run code on my Raspberry Pi Pico:
import smbus2
I get the following:
MPY: soft reboot
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/lib/smbus2/__init__.py", line 23, in <module>
File "/lib/smbus2/smbus2.py", line 25, in <module>
ImportError: no module named 'fcntl'
So next, I install micropython-fcntl, and that gets me the following:
MPY: soft reboot
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/lib/smbus2/__init__.py", line 23, in <module>
File "/lib/smbus2/smbus2.py", line 25, in <module>
File "/lib/fcntl.py", line 1, in <module>
ImportError: no module named 'ffi'
Installing fcntrl brought in the dependency of ffilib, which is the only thing that comes up searching for micropython-ffi.
If I search for just “ffi”, I get a long list of packages all with different names:
abc @ micropython-lib
<No description>
cmd @ micropython-lib
<No description>
dht @ micropython-lib
DHT11 & DHT22 temperature/humidity sensor driver.
gzip @ micropython-lib
<No description>
io @ micropython-lib
<No description>
mip @ micropython-lib
On-device package installer for network-capable boards
os @ micropython-lib
<No description>
ssl @ micropython-lib
<No description>
uu @ micropython-lib
<No description>
copy @ micropython-lib
<No description>
hmac @ micropython-lib
<No description>
html @ micropython-lib
<No description>
stat @ micropython-lib
<No description>
time @ micropython-lib
<No description>
venv @ micropython-lib
Support for creating MicroPython virtual environments using `micropython -m venv`
Does anyone know what I need to do to get the BME280 talking on a Pi Pico?