Skip to content

Added temperature offset #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 28, 2020
Merged

Added temperature offset #32

merged 4 commits into from
Jul 28, 2020

Conversation

evaherrada
Copy link
Collaborator

The BME680's sensor almost always measures 5 degrees C hotter than the temperature actually is due to heat created by the sensor itself. Other libraries also have this offset set to 5 degrees. This fixes part of #29

@evaherrada evaherrada requested a review from a team July 16, 2020 17:41
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you point to where this offset exists in other libraries? We shouldn't include it in this library unless it's explicitly recommended by Bosch. I don't see it here: https://github.com/BoschSensortec/BME680_driver/blob/master/bme680.c#L867-L882

@evaherrada
Copy link
Collaborator Author

@tannewt Yep. This library uses the bsec library and has that offset. Also, issue #29 indicates that without the offset, the Adafruit library is inaccurate. I did verify this by running both libraries and found that the one built on top of the bsec library was correct.

https://github.com/alexh-name/bsec_bme680_linux#configure-and-compile

@evaherrada
Copy link
Collaborator Author

evaherrada commented Jul 23, 2020

@tannewt Also, I took a quick read through the datasheet, and it seems clear they want you to do the offset that accounts for the temperature around the sensor. It does seem like the bsec library has functions to do that, although the library I linked doesn't appear to use them.

edit: looked through the bsec library. Couldn't find any functions that offset the temperature, although it is pretty clear that's something they expect should be done if you want to get the ambient temperature

@tannewt
Copy link
Member

tannewt commented Jul 23, 2020

I don't think this belongs in the library itself because it will depend on what surrounds the sensor. Instead, please update the example to demonstrate shifting the temp value. That will make it clear that someone needs to adjust it for accuracy.

@evaherrada
Copy link
Collaborator Author

@tannewt Ok, I'll do that

@evaherrada
Copy link
Collaborator Author

@tannewt What would you think about me changing the default value of temp_offset to 0 and then adding the explanation to the example?

@tannewt
Copy link
Member

tannewt commented Jul 24, 2020

I don't think the library should do the offset because it's only for the chip. The temperature is correct for the chip itself. Offsetting is something that should be done externally in calibration.

So, I think it should only be in the example and the Learn guide.

@evaherrada
Copy link
Collaborator Author

@tannewt Ok, that makes sense

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split it out separately so it's clearer.

@evaherrada evaherrada requested a review from tannewt July 28, 2020 15:29
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt tannewt merged commit 570da14 into master Jul 28, 2020
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Aug 1, 2020
while True:
print("\nTemperature: %0.1f C" % bme680.temperature)
print("\nTemperature: %0.1f C" % bme680.temperature + temperature_offset)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will throw. Parentheses should be surrounding the calculation.

print("\nTemperature: %0.1f C" % (bme680.temperature + temperature_offset))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@houmark Good catch! If you could file an issue, it would be greatly appreciated. Or, if you're comfortable submitting a PR, that would be amazing too!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was actually fixed in a this commit, so nothing more to do here ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants