BME688 Sensor

I am trying to setup the BME688 sensor bought from Pimoroni but when I run the test code below I get the following error message:

ImportError: no module named ‘breakout_bme68x’

The code I am using is:
“”“BME688 / BME680 demo
This demo will work for both the BME680 and BME688.
“””
import time
from breakout_bme68x import BreakoutBME68X, STATUS_HEATER_STABLE
from pimoroni_i2c import PimoroniI2C

PINS_BREAKOUT_GARDEN = {“sda”: 4, “scl”: 5}
PINS_PICO_EXPLORER = {“sda”: 20, “scl”: 21}

i2c = PimoroniI2C(**PINS_BREAKOUT_GARDEN)

bmp = BreakoutBME68X(i2c)

If this gives an error, try the alternative address

bmp = BreakoutBME68X(i2c, 0x77)

while True:
temperature, pressure, humidity, gas, status, _, _ = bmp.read()
heater = “Stable” if status & STATUS_HEATER_STABLE else “Unstable”
print(“{:0.2f}c, {:0.2f}Pa, {:0.2f}%, {:0.2f} Ohms, Heater: {}”.format(
temperature, pressure, humidity, gas, heater))
time.sleep(1.0)

I have run the command below to setup the sensor but still get the same error message.
curl https://get.pimoroni.com/bme680 | bash

Any ideas?

Thanks Mike

What do you have the sensor connected to (and how do you have it connected?)

I don’t have the sensor connected as yet, I was connecting it over Stemma/QT (QW/ST)
once I got the software to run through with no errors.

Might need some more info about your setup to be able to help here I’m afraid - are you using a Raspberry Pi or a Raspberry Pi Pico?

It is a Raspberry Pi Pico with ‘rp2-pico-20220618-v1.19.1.uf2’ installed.

Ah OK - is that a version of MicroPython downloaded from the Raspberry Pi website? You’ll need to install our custom MicroPython version to have the BME688 drivers built in: Releases · pimoroni/pimoroni-pico · GitHub. You’ll need the Pico flavoured image - here’s a direct link.

Note that the example code may throw an error if you don’t have the breakout physically connected to the Pico, either by Qw/ST or by some other means.

I have now downloaded the correct UF2 file and it has gone past the initial error message.

I will now have a look at which I2C pins to use on the PICO

Thanks a lot for your help.

Mike

1 Like

Everything working fine now.

Thanks again for your help.

Regards
Mike

Hi Mike,

Would you be able to share which pins you used to connect your Pico to the BME688?
I can’t seem to find an official document on what that should be?

I found one for the BM280 and have been unsuccessful so far:


Source: Raspberry Pi Pico W: Wireless Weather Station - YouTube

For reference, this is my code:

from breakout_bme68x import BreakoutBME68X
from pimoroni_i2c import PimoroniI2C

PINS_BREAKOUT_GARDEN = {"sda": 4, "scl": 5}
PINS_PICO_EXPLORER = {"sda": 0, "scl": 1}

i2c = PimoroniI2C(**PINS_PICO_EXPLORER)
bme = BreakoutBME68X(i2c)

Hi, I have connected the ME688 to pins 6 & 7
For the SDA & SCL. If that doesn’t work, try reversing the two connections.