Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

BME680 example code doesn't work
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

BME680 example code doesn't work

by SnarfQ on Mon Aug 10, 2020 4:50 pm

I've updated the BME680 library to version 3.2.3
It's running on a raspberry pi 3
When I run the example code, it doesn't work

I get the following error message:

Traceback (most recent call last):
File "/home/pi/Adafruit_CircuitPython_BME680-master/examples/bme680_simpletest.py", line 19, in <module>
print("\nTemperature: %0.1f C" % bme680.temperature + temperature_offset)
TypeError: can only concatenate str (not "int") to str

Line 19 looks like this:
print("\nTemperature: %0.1f C" % bme680.temperature + temperature_offset)

I changed it to:
print("\nTemperature: %0.1f C" % bme680.temperature + str(temperature_offset))

Then my output was:
Temperature: 27.3 C-5

That's not what I hoped for.


Could someone tell me what to do?

SnarfQ
 
Posts: 3
Joined: Wed Oct 23, 2019 2:23 pm

Re: BME680 example code doesn't work

by mikeysklar on Mon Aug 10, 2020 6:09 pm

Hello SnarfQ,

I think I understand what you are seeing. Looking at the github archive for Adafruit_CircuitPython_BME680 I see a code change that was made 13 days ago for temperature_offset.

Our developer moved the temperature offset from the driver into the simpletest example I think so it can be more easily manipulated by the user:

The new line that you see is:
Code: Select all | TOGGLE FULL SIZE
    print("\nTemperature: %0.1f C" % bme680.temperature + temperature_offset)


The old code was this:
Code: Select all | TOGGLE FULL SIZE
    print("\nTemperature: %0.1f C" % bme680.temperature)


You could do your print the old way and remove the offset. I'm not sure if the right thing to do is not print the offset or maybe label things more clearly so it is understood why a -5 is showing up.

mikeysklar
 
Posts: 1730
Joined: Mon Aug 01, 2016 8:10 pm

Re: BME680 example code doesn't work

by SnarfQ on Fri Aug 14, 2020 3:43 pm

Hello mikeysklar,

Thank you for your reply.
When I use the old program it works again.

I was very exited about the temperature offset, so I wanted to put it 0,6 degrees celcius lower.
I was looking in the "main program" (adafruit_bme680.py) and couldn't find the offset parameter there either.
On the Github page you see on several lines the temperature offset code. See link below
https://github.com/adafruit/Adafruit_Ci ... 91d742233#

My question is:
Is it possible to run the code with the temperature offset?

Greetings SnarfQ

SnarfQ
 
Posts: 3
Joined: Wed Oct 23, 2019 2:23 pm

Re: BME680 example code doesn't work

by mikeysklar on Tue Aug 18, 2020 4:48 pm

SnarfQ,

Two questions for you to try and answer:

1) running the latest library CP BME680 library from github with the example code also from github do you still get the line: 19 error about about type declaration?

https://github.com/adafruit/Adafruit_Ci ... hon_BME680

2) If you simply remove the temperature_offset and for experiment sake just type in the value you want -0.6 in this form does it work with you desired offset?

Code: Select all | TOGGLE FULL SIZE
print("\nTemperature: %0.1f C" % bme680.temperature - 0.6 )

mikeysklar
 
Posts: 1730
Joined: Mon Aug 01, 2016 8:10 pm

Please be positive and constructive with your questions and comments.