Is there a way to connect Two BME280 sensors to a LoRa Dev Board: HTCC-AB01 and read data off of each? On other arduino boards you can do this by creating multiple I2C address and connection both to the I2C bus. Not sure how I would do this with the cube cell board. Any help is greatly appreciated!
TWO BME280 over I2C
This article illustrates how to set the I2C address on one particular type of BME280 module [to either 0x76 or 0x77] (the default on this module is 0x76).
While I’ve not tried it on a CubeCell, this thread also discusses the definition of a second I2C bus, which, provided the relevant Cubecell library supports it, allows the specification of a separate pair of SDA/SCL pins for the second bus. In this case, since they are on separate buses, you can use the default BME280 I2C on each module.
Thank you. I ended up using an adafruit BME280 library and I had to physically solder a jumper per the article you sent on BME280’s so thank you!
Here is some example code that I got to work. 0x76 is the default.
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme1; // I2C
Adafruit_BME280 bme2; // I2C
void setup() {
Serial.begin(9600);
if (!bme1.begin(0x76)) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
//while (1);
}
if (!bme2.begin(0x77)) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
//while (2);
}
}
void loop() {
Serial.print("Temperature1 = ");
Serial.print(bme1.readTemperature());
Serial.println("*C");
Serial.print("Temperature2 = ");
Serial.print(bme2.readTemperature());
Serial.println("*C");
/*
Serial.print("Pressure = ");
Serial.print(bme1.readPressure() / 100.0F);
Serial.println("hPa");
Serial.print("Approx. Altitude = ");
Serial.print(bme1.readAltitude(SEALEVELPRESSURE_HPA));
Serial.println("m");
Serial.print("Humidity = ");
Serial.print(bme1.readHumidity());
Serial.println("%");
Serial.println();
*/
delay(1000);
}