BME280 reading problem


I’m triying to connect a bme280 and I have a lot of problems.
wire connection:

The code

#include "Adafruit_BME280.h"
#include "Adafruit_Sensor.h"

Adafruit_BME280 bme; // I2C

// I2C wiring
#define BME_MOSI D0
#define BME_SCK D1

#define SEALEVELPRESSURE_HPA (1013.25)

unsigned long lastUpdate = 0;
char buf[64];

void setup() {
    Serial.println(F("BME280 + OLEDisplay 128x64"));

    if (bme.begin()) {
        Serial.println("BME280 sensor works!");


void loop() { 

    	Serial.print("Temperature = ");
    	float temp = bme.readTemperature(); // degrees C
        Serial.println(" *C");
        Serial.print("Pressure = ");
    	float pressure = (bme.readPressure() / 100.0F); // hPa
        Serial.println(" hPa");
        Serial.print("Approx. Altitude = ");
        float altitude = (bme.readAltitude(SEALEVELPRESSURE_HPA)); 
        Serial.println(" m");
        Serial.print("Humidity = ");
        float humidity = bme.readHumidity(); // % 
        Serial.println(" %");
        Serial.println(Time.format(, "%H:%M h"));

The serial: no reading:

Any idea whats wrong?


You could try the I2C address scanner sketch to find out whehter the sensor can be found at all

The I2C scanner is actually here

1 Like


I checked and the address is 0x77, what could I do now?

thank’s in advance

Are you sure you are using the BME280 and not the BMP280?

The BME includes humidity and has different math.

Are you getting the following output from your app in the beginning?
“BME280 sensor works!”

If you are connecting to the serial port a little late you may miss that message. I typically add the following in setup() to initialize the serial port and wait for the return key to be pressed. It’s helpful when debugging initialization messages, however can be troublesome if you forget it’s there and want the photon run without the serial port when powered on.

Serial.println("Waiting for keypress ...");
while (!Serial.available()) ;       // Wait for serial input
1 Like


DAMMMMMM the problem is this!! the supplier send to me the wrong sensor and are bmp280…




1 Like

It seems you are following this project, Ed. Good decision :slight_smile:
This BME280 sensor I suggest to you for < 10 Euros.
From which site did you copy the (frizzing) schematic (which shows the BMP280)?

I had the same problem. Here is some code that worked for me… hope this helps. Note, I used the Grove BME280 with an address 0x76.

// You'll need to include the Adafruit BME280 library from the libraries section
#include <Adafruit_BME280.h>
#include <Adafruit_Sensor.h>

Adafruit_BME280 bme;

#define BME_MOSI D0
#define BME_SCK D1

#define SEALEVELPRESSURE_HPA (1013.25)

// setup() runs once, when the device is first turned on.
void setup() {

  if (bme.begin(0x76)) {
      Particle.publish("BME280 sensor works!",PRIVATE);


// loop() runs over and over again, as quickly as it can execute.
void loop() {
  // The core of your code will likely live here.

  float t = bme.readTemperature(); // *C
  float h = bme.readHumidity(); // %
  float p = bme.readPressure() / 100.0F; // hPa
  float a = bme.readAltitude(SEALEVELPRESSURE_HPA);

  // Get some data - measure battery voltage
  String data = String::format("%.2f",t) + "*C:" + String::format("%.2f",h) + "%:"
   + String::format("%.2f",p) + "hPa:" + String::format("%.2f",a) + "m";

  // Publish data to Particle Cloud
  Particle.publish("data", data,PRIVATE);


1 Like

@ScruffR, can you give more connection details for how I might use your recommended sketch to reveal the address of my BME280? Your example is for a 18B20 probe–how do I modify your instructions for my BME280? Thanks!

Huh??? That was the wrong link and nobody noticed :wink:
It should actually have been the I2C-Scanner sketch not the OneWire-Scanner :flushed:

Thanks. Maybe that’s why it wouldn’t work for me… I can’t, however, get at I2C-Scanner sketch. Is it private?

1 Like

Try again.

Thanks. I can access now. Will work with this over the next few days.

Thanks, @ScruffR. That code works well…but I’m getting a “No I2C devices found” message on the serial terminal. Rechecked my connections that are identical to the connection fritzing above. Also added the following at the top of the code in the I2C-Scanner sketch since I thought I’d need access to the device itself:

// This #include statement was automatically added by the Particle IDE.
#include <Adafruit_BME280.h>
#include <Adafruit_Sensor.h>

Adafruit_BME280 bme;

#define BME_MOSI D0
#define BME_SCK D1

#define SEALEVELPRESSURE_HPA (1013.25)
//end project specifics

@jackhaefner, I have the same BME280 board and even though it appears to have I2C pull-up resistors, I could not get it to work until I added my own 4.7K pull-ups. I am using the Adafruit_BME280 library v1.1.4 but I don’t use the Adafruit_Sensor library.

1 Like

Thanks, @peekay123. I’ll give that a try

After a bunch of screwing around. Using the Adafruit library and wiring as in the diagram above, this code worked perfectly. I didn’t try the serial monitor. Just Particle.publish(). Thanks!!!