yanbe / bme280-esp-idf-i2c

Sample code for reading values from a BME280 temperature-humidity-pressure sensor, via ESP-IDF's I2C master driver, supports both normal mode and forced mode described in the datasheet. https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BME280_DS001-11.pdf
Apache License 2.0
42 stars 17 forks source link

Update code to work with version 3.3.4 of Bosch driver #2

Open kumekay opened 6 years ago

kumekay commented 6 years ago

Probably I shouldn't make pull request, because this updated code doesn't work perfectly - it works as expected only with very low i2c clock speeds, like 40000. If master_clk is ~ 100000 only pressure and humidity are sent by sensor, if master_clk is 400000 or more - only humidity is sent (as non zero value). I spent some time, but didn't find root of this issue, but it would be great, if you can help. Expect of this problem this commit fully supports lastest Bosch driver (v3.3.4)

meltdown03 commented 4 years ago

I got the your Pull #2 to work with the latest Bosch drivers (Master Branch as of today) by changing the I2C speed to 100000 from 40000. I also changed the return type of the BME280_I2C_bus_write function to the correct uint8_t type. I'm even running it on the Master Branch of ESP-IDF using a ESP32-S2-Saola-1R board. I'm using it in the Smart Outlet example and uploading the data instead of using the examples random Temperature data.