Skip to content
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

Sensor driver for BME680 sensor - update to version 3.5.9 #2969

Merged
merged 1 commit into from
Dec 9, 2019

Conversation

vsky279
Copy link
Contributor

@vsky279 vsky279 commented Nov 23, 2019

Fixes #2944.

  • This PR is for the dev branch rather than for master.
  • This PR is compliant with the other contributing guidelines as well (if not, please describe why).
  • I have thoroughly tested my contribution.
  • The code changes are reflected in the documentation at docs/*.

Solves the issue where the air pressure, humidity and gas resistance are not compensated during ambient temperature changes.

Updates the Bosh BME680 driver from version 3.5.1 to current version 3.5.9.

docs/modules/bme680.md Outdated Show resolved Hide resolved
@marcelstoer
Copy link
Member

marcelstoer commented Nov 27, 2019

@Michal78S it would be great to get your confirmation that this fix solves the issue. Can you build a firmware from @vsky279's branch for testing?

@vsky279
Copy link
Contributor Author

vsky279 commented Nov 27, 2019

I agree that it is good idea to know whether it solves @Michal78S's issue.
But even if it doesn't we should merge as it upgrades the driver and solves the same issue in my case.

@Michal78S
Copy link

Michal78S commented Nov 28, 2019

It is an honor for me, but since I have started nodemcu i build firmware with cloud builder...

@vsky279
Copy link
Contributor Author

vsky279 commented Nov 29, 2019

@Michal78S What modules do you need? I will compile the fw for you. Floating version?

@Michal78S
Copy link

The standard modules: GPIO, net, node, timer, uart, wifi and of course i2c, BME680.
The open issue is IAQ. Is it possible to add it to BME680 module? There is on the market one solution which uses STM32 and Bme680 and provides both: IAQ index and gas resistance.

@vsky279
Copy link
Contributor Author

vsky279 commented Dec 3, 2019

Please find the compiled module here: https://github.com/vsky279/bme680_bin/blob/master/nodemcu_float_bme680_20191203-0946.bin.

The issue with IAQ calculation is that the algorithm has not been published by Bosh. Please see module documentation:

This module is able to measure the gas resistance (see Bosch's datasheet). The gas resistance is not the IAQ (Indoor Air Quality) Index. But apparently it can be used as some proxy. The value still should somehow reflect the air quality. It seems that the higher value the air quality is better.

The algorithm for IAQ calculation from the gas restistances (probably measured at different temperatures) is not publicly available. Bosch says that at this point of time the calculations for the Indoor Air Quality index are offered only as a pre-compiled library (see discussion here: BoschSensortec/BME680_driver#6). It is available as the BSEC Library. The algorithm is implemented in the library bsec/algo/bin/ESP8266/libalgobsec.a. Unfortunately I did not even manage to run the Bosch BSEC example on ESP8266 using this library.

If you find somewhere module implementing IAQ calculation then we can replicate it here.

@shimosaurus
Copy link

I made the Lua code for reading data from module GY-MCU680V1 with sensor BME680 and STM32. It reads IAQ and gas resistance values: https://github.com/shimosaurus/mcu680

@marcelstoer
Copy link
Member

marcelstoer commented Dec 3, 2019

@shimosaurus Woah, you even used our documentation template in your README 😄 Great job. Is that really all the code it takes? Were your inspired by this gist https://gist.github.com/xxlukas42/a878f5c44f1ec108a460e9b9500b79f5 ?

@vsky279
Copy link
Contributor Author

vsky279 commented Dec 3, 2019

I made the Lua code for reading data from module GY-MCU680V1 with sensor BME680 and STM32. It reads IAQ and gas resistance values: https://github.com/shimosaurus/mcu680

Have you tested it? I can't imagine this can be the way to get the IAQ value. Bosch's documentations says the IAQ calculation is made available through the BSEC library which is not open-sourced.

The code you provide is a bit weak as the commands sent to the sensor are not documented.

@Michal78S
Copy link

I made the Lua code for reading data from module GY-MCU680V1 with sensor BME680 and STM32. It reads IAQ and gas resistance values: https://github.com/shimosaurus/mcu680

Nice job :) but it works only with module GY-MCU680 where are STM32 and BME680. Main job and calculations provides STM32. This solution has groving number of ussers because is one of few available so adding Lua code for it is good idea.

@shimosaurus
Copy link

@shimosaurus Woah, you even used our documentation template in your README smile Great job. Is that really all the code it takes? Were your inspired by this gist https://gist.github.com/xxlukas42/a878f5c44f1ec108a460e9b9500b79f5 ?

I was inspired here: https://forum.mysensors.org/post/94736 but @xxlukas42 used probably the same source.

Have you tested it? I can't imagine this can be the way to get the IAQ value. Bosch's documentations says the IAQ calculation is made available through the BSEC library which is not open-sourced.
The code you provide is a bit weak as the commands sent to the sensor are not documented.

As @Michal78S wrote - my code doesn't count IAQ, but reads "only" the STM32 output on the GY-MCU680 board where BSEC is running. But as long as the BSEC library is closed-source, this solution is a way to obtain IAQ values ​​into the NodeMCU Lua.

My comment was not directed mainly to this pull request but to query @Michal78S how to get IAQ values.

@vsky279
Copy link
Contributor Author

vsky279 commented Dec 5, 2019

My comment was not directed mainly to this pull request but to query @Michal78S how to get IAQ values.

Oh, I see that puzzled me.

@Michal78S
Copy link

I can confirm, new BME680 driver works better. I got the same readings of pressure from BME680 and BME280. During weekend I'm going to make outdoor tests (wider temp. range).

Other importatnt thing is @shimosaurus solution. Many NodeMCU users don't konow about it, so how about add it to the cloud builder?

@marcelstoer
Copy link
Member

...@shimosaurus solution. Many NodeMCU users don't konow about it

Jan could make a PR to have the script hosted at https://github.com/nodemcu/nodemcu-firmware/tree/master/lua_modules - that's up to him. It would then also show up under the Lua modules at https://nodemcu.readthedocs.io/en/latest/.

so how about add it to the cloud builder?

Contrary to C modules Lua modules are not built into the firmware binary. You need to provision them separately via SPIFFS or LFS.

@Michal78S
Copy link

Checked. New driver gives stable and reliable readings air pressure from BME680. Yesterday in the afternoon pressure rapidly dropped. It was registered by BME680, and values are near identical with the forecast and readings from BME280 and amateur weather station.
pogoda

@marcelstoer marcelstoer merged commit c7d0f83 into nodemcu:dev Dec 9, 2019
@vsky279 vsky279 deleted the bme680 branch December 9, 2019 22:27
vsky279 added a commit to vsky279/nodemcu-firmware that referenced this pull request Dec 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants