Tested with BMP280 on SPI (esp32) and BME280 on I2C (esp32 and esp8266).
Thank you! Created a repo under mongoose-os-libs, you're an admin: https://github.com/mongoose-os-libs/bme280 , feel free to push your code there.
That is great. Would it also be possible to create native drivers for the BME680? Could not find Bosch Sensortec reference drivers for this, but maybe I just did not search in the right place?
I don't have BME680 sensors...
Here is Bosch Sensortec's BME680 reference driver: https://github.com/BoschSensortec/BME680_driver
i spent the weekend trying to build a similar Lib for the BME680. Unfortunately I cannot get a I2C connection to the device.
I used the https://github.com/watterott/BME680-Breakout
The library is https://github.com/sistar/bme680.
I tried to use it with this sample https://github.com/sistar/bme680-sample
For building I did --local builds and included the library as git submodule in deps
It always fails
[Jan 14 16:11:00.639] user_i2c_write Could not write i2c
[Jan 14 16:11:00.653] commonInit BME680 device not found - -2
[Jan 14 16:11:00.659] mgos_app_init BME680 connected: 0
I successfully tried the BME680 breakout with an Arduino and Adafruits Lib.
I tried both ESP 8266 D1 Mini and ESP 32 Geekworm Kit ESP 32 C1 Pins 21 and 22
Would be grateful for any help on troubleshooting I2C!
For the ESP32 the default i2c pins are sda=32, scl=33 :https://github.com/mongoose-os-libs/i2c/blob/master/mos_esp32.yml
If you want to use sda=21, scl=22, you have to add definitions tor them in the application's `mos.yml:
- ["i2c.sda_gpio", 21]
- ["i2c.scl_gpio", 22]
For the ESP8266 sda=12, scl=14: https://github.com/mongoose-os-libs/i2c/blob/master/mos_esp8266.yml
LE. Also check the i2c address of the device.
LLE. You can also add
- ["i2c.debug", true]
- ["debug.level", 3]
to get more debug messages in the console log.
LLE. grep your console log for i2. You will find something like
[Jan 12 19:51:35.317] mgos_i2c_create I2C GPIO init ok (SDA: 32, SCL: 33)