Adafruit_BME280_RK release?

Hi,

@rickkas7, Has Adafruit_BME280_RK library been release? I am following the example on https://docs.particle.io/faq/particle-devices/i2c-faq/photon/#bme280-to-google-spreadsheet to get the temperature of the bme280 that I got from Adafruit. I try the Adafruit_BME280_RK library on the particle desktop IDE but when I compile the code, I got SPISettings was not declared in this scope, src/Adafruit_BME280_RK.cpp:156:73… etc… Am I suppose to be using another library for BME280? The code I compile was:

#include "Adafruit_BME280_RK.h"

Adafruit_BME280 bme; // I2C

const unsigned long PUBLISH_PERIOD_MS = 60000;
const char *FIELD_SEPARATOR = "|||";
const char *EVENT_NAME = "tempSensor";

bool sensorReady = false;
unsigned long lastPublish = 0;
char buf[256];

void setup() {
    Serial.begin(9600);

    sensorReady = bme.begin();
}


void loop() { 
    if (millis() - lastPublish >= PUBLISH_PERIOD_MS && sensorReady) {
        lastPublish = millis();

        float temp = bme.readTemperature(); // degrees C
        float pressure = bme.readPressure() / 100.0; // hPa
        float humidity = bme.readHumidity(); // % 

        snprintf(buf, sizeof(buf), "%.02f%s%.02f%s%.01f", temp, FIELD_SEPARATOR, pressure, FIELD_SEPARATOR, humidity);
        Particle.publish(EVENT_NAME, buf, PRIVATE);
    }
}

Thanks

I updated the library to version 1.0.6 to fix those issues when building with 0.7.0.

@rickkas7, cool, will test more tomorrow, the update did fix the compile errors. Thanks

@rickkas7, I am encountering "return false" with bme.begin().
It seem like its failing in this condition in Adafruit_BME280_RK.cpp:

if (read8(BME280_REGISTER_CHIPID) != 0x60)

Look like its not able to grab the chip id. Blow is my wiring like your example:

 #include "Adafruit_BME280_RK.h"

 Adafruit_BME280 bme; // I2C

 const unsigned long PUBLISH_PERIOD_MS = 10000;

 unsigned long lastPublish = 0;

 void setup() {
     Serial.begin(9600);

     delay(10000);
     Serial.println("Setup Begin");

     while(! bme.begin()){
       	Serial.println("bme280 not found");
       	delay(1000);
      }

      delay(10000);

      Serial.println("Setup end");

 }


 void loop() {
      Serial.println("loop");
     if (millis() - lastPublish >= PUBLISH_PERIOD_MS) {
         lastPublish = millis();

         float temp = bme.readTemperature(); // degrees C
         float pressure = bme.readPressure() / 100.0; // hPa
         float humidity = bme.readHumidity(); // %

         Serial.println("temp, pressure, hum");
         Serial.printlnf("%f, %f, %f", temp,pressure,humidity);

     }
 }

I check there is voltage to the BME280, i2c lines is connected. Could it be a bad board from Adafruit? Is anything else I can check before calling this a bad board? I am just wondering anyone have encounter the same problem. Thanks.

It’s possible that your BME280 has a different I2C ID.

Run the I2C scanner and see what it returns:

https://docs.particle.io/faq/particle-devices/i2c-faq/electron/#i2c-scanner

That will also verify if is visible on the I2C bus at all.

1 Like

@rickkas7, it seem like the address have change since the library been release according to Adafruit:

By default, the i2c address is 0x77. If you add a jumper from SDO to GND, the address will change to 0x76.

By changing the BME280_Address to 0x77 from 0x76 in the Adafruit_BME280.h fixes the issue. I will keep testing to see if anything else come up. Thanks

You can also just call

bme.begin(0x77);

so you don’t need to modify the library.

@rickkas7, cool, I will do that instead.

I also published a new version 1.0.7 that changes the default back to 0x77. That change was not intentional.

My custom boards default to 0x76 but the library probably ought to be configured for the real Adafruit boards.