BME 280 how to use it?

  • I bought a BME 280 and don´t know how to wire it, because the sensor is different to the normal ones.

  • Mod

    @wardur looks to be the same as I think?

    For i2c, you only connect Vcc, Gnd, Scl and Sda.

  • /***************************************************************************
      This is a library for the BME280 humidity, temperature & pressure sensor
      Designed specifically to work with the BME280 Breakout board
      This sketch only supports the I2C bus for connection.
    #include <Wire.h>
    #include "cactus_io_BME280_I2C.h"
    // Create the BME280 object
    BME280_I2C bme;          
    // I2C using default 0x77 
    // or
    //BME280_I2C bme(0x76);  // I2C using address 0x76
    void setup() {
      Serial.println("Bosch BME280 Barometric Pressure - Humidity - Temp Sensor |"); 
      if (!bme.begin()&&!bmee.begin()) {
        Serial.println("Could not find a valid BME280 sensor, check wiring!");
        while (1);
    void loop() {
        Serial.print(bme.getPressure_MB()); Serial.print("\t\t");    // Pressure in millibars
        Serial.print(bme.getHumidity()); Serial.print("\t\t");
        Serial.print(bme.getTemperature_C()); Serial.print(" *C\t");
        Serial.print(bme.getTemperature_F()); Serial.println(" *F\t");
        // add a 2 second delay to slow down the output

    i use this code and he can´t find a device:/

  • Mod

    Try to run an I2C scanner, it could be the sensor has a different address

  • Mod

    @wardur make sure you power it at the correct level (see the breakout's specs) and use the same power level in communication to the arduino. Either use the same level for bme and arduino, or use a level shifter.

  • Mod

    @wardur this is my stripped down code I use to read data from the BME280

    Adafruit_BME280 bme; // I2C
    uint8_t BME280_i2caddr = 0x76;
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    MyMessage msgPress(CHILD_ID_BARO, V_PRESSURE);
    void setup()
    	metric = getControllerConfig().isMetric;  // was getConfig().isMetric; before MySensors v2.1.1
    	Wire.begin(); // Wire.begin(sda, scl)
    	if (!bme.begin(BME280_i2caddr)) {
    		Serial.println("Could not find a valid BME280 sensor, check wiring!");
    		while (1);
    	// weather monitoring
    	Serial.println("-- Weather Station Scenario --");
    	Serial.println("forced mode, 1x temperature / 1x humidity / 1x pressure oversampling,");
    	Serial.println("filter off");
    		Adafruit_BME280::SAMPLING_X1, // temperature
    		Adafruit_BME280::SAMPLING_X1, // pressure
    		Adafruit_BME280::SAMPLING_X1, // humidity
    	// suggested rate is 1/60Hz (1m)
    void loop()
    	float HUM = bme.readHumidity();
    	float TEMP = bme.readTemperature();
    	float BARO = bme.readPressure() / 100;
    	send(msgHum.set(HUM, 2));
    	send(msgTemp.set(TEMP, 2));
    	send(msgPress.set(BARO, 1));

Log in to reply

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.