ModuleNotFoundError: No module named 'bme680'

I went looking at all my older saved files and didn’t find anything that was relevant or useful. I’ve only just recently started using oleds. For the most part I like the color LCD’s. And I like to change my text color on the fly to reflect what I’m showing. Red text for high temperature readings as an example. This has a tendency to make my code more complex and harder to follow for novices. Even me some times, lol.
I am going to post some python code I clip and pasted from a longer file to maybe help.

from pimoroni_i2c import PimoroniI2C
PINS_BREAKOUT_GARDEN = {"sda": 4, "scl": 5}
PINS_PICO_EXPLORER = {"sda": 20, "scl": 21}
i2c = PimoroniI2C(**PINS_BREAKOUT_GARDEN)

from breakout_bme68x import BreakoutBME68X
bme = BreakoutBME68X(i2c)
temp, press, hum, gas_resistance, status, gas_index, meas_index = bme.read() 
# convert pressure to mb
pressuremb = press_out / 100

This isn’t for you display but it’s an example of how to just display the temperature value.
display.text('{:.0f}'.format(temp) + 'c’, 160, 35, 240, 4) You end up with 10'c. If you want places after the decimal you chnage the '{:.0f}' to say '{:.1f}'. That will get you values like 10.5c. ‘{:.2f}’ gets you two places after the decimal etc. I like round numbers.
For Humidity its.
display.text('{:.0f}'.format(hum) + '%', 10, 140, 240, 4)
and presure is
display.text('{:.0f}'.format(pressuremb) + 'mb', 0, 110, 240, 3)
For the above the last four numbers are position and size of text.
I think its X, Y, word wrap, size of text. You will have to adapt / edit that line for your oled.
Put a
temp, press, hum, gas_resistance, status, gas_index, meas_index = bme.read()
line in your while true and each time its run it will get new readings from the sensor.
Then put you print statements after that with a time sleep of say 0.5.

1 Like

Thank you very much Alpha.
Is that micropython?
took some python programing lessons but its long ago. I hae to catch with Python before I can compare with MicroPython. But there seeem to be ideas similar to what I tying to achieve.
I managed to get the sh1066 lcd to display simple stuff and I followed some lesson on youtube from Paul McWhorter. He is excellent. My next step is to get all ideas and examples from here and there and try to code a dedicated script. I will start a new thread/question.
Same for the Oled samples I got and the pimoroni setup for the BME688, they use their own python environments. First I need to figure out if I can crete an environment where to upload all libraries or both devices or if I can operate with the sensos working in their own env and the oled in its.
I havent looked at it so far (is prob evident :) !) but will come back once I know a bit more.
Thanks a lot for your help.

That is python code.

1 Like

Hi Alpha. I’ve done quite a lot of progress, not without some hicups.
Now I can get air quality, temperature and so on ad display on a LCD1202.
Now I need to figure out how can I make a standalone machine that on power on will run the program. possibly have a button to toggle through different options and to finally turn it of (or at least the display to save batteries)
When I did learn some coding, I want to remember it was python (many moon ago) We were able to have different scripts then turn one on and on_user_input, run another program. It used to be done with globals, loading the scripts to memory and having them called.
I haven’t looked much around yet but, if anyone have some tips on it all, please, print here a pointer. maybe things are done different know and I’m just complicating things!
Thanks a lot.

I haven’t ever done anything using globals, can’t help you there.
I usually launch my python file via crontab.
from terminal run crontab -e
then add
@reboot python3 /home/pi/my.py

For a shutdown on button press it goes something like this

import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)  
GPIO.setwarnings(False)
GPIO.setup(5, GPIO.IN, pull_up_down = GPIO.PUD_OFF)  
GPIO.add_event_detect(5, GPIO.FALLING, callback = Shutdown, bouncetime = 2000)
def Shutdown(channel):  
        os.system("sudo shutdown now -P")
        time.sleep(30)    

My button is wired to GPIO 5, and grounds that pin when pressed. Near as I can remember anyway. I haven’t done any Python coding on a Pi in ages. Plus, the device that the above code was written for was retired and doesn’t exist anymore. That Pi got repurposed.