# BME280 reading problem

**URL:** <https://community.particle.io/t/bme280-reading-problem/34642>\
**Category:** Troubleshooting\
**Created:** [July 19, 2017, 4:05pm UTC](https://community.particle.io/t/bme280-reading-problem/34642 "2017-07-19T16:05:31Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![ecabanas](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@ecabanas](https://community.particle.io/u/ecabanas)\
**Post date:** [July 19, 2017, 4:05pm UTC](https://community.particle.io/t/bme280-reading-problem/34642/1 "2017-07-19T16:05:31Z")

</div>

Hi.

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

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/d/dd4e25648e3a03ddce4ccf47e91a38976dc7aa1e.png)

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.begin(9600);
	
    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.print(temp);
        Serial.println(" *C");
    
        Serial.print("Pressure = ");
    	float pressure = (bme.readPressure() / 100.0F); // hPa
        Serial.print(pressure);
        Serial.println(" hPa");
    
        Serial.print("Approx. Altitude = ");
        float altitude = (bme.readAltitude(SEALEVELPRESSURE_HPA)); 
        Serial.print(altitude);
        Serial.println(" m");
    
        Serial.print("Humidity = ");
        float humidity = bme.readHumidity(); // % 
        Serial.print(humidity);
        Serial.println(" %");
        
        Serial.println(Time.format(Time.now(), "%H:%M h"));
        delay(5000);
		
}

```

The serial: no reading:  
 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/b/b369a6133b015d6a08f54120860518818f07ea61.png)  
Any idea whats wrong?

Thank’s

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [July 19, 2017, 4:33pm UTC](https://community.particle.io/t/bme280-reading-problem/34642/2 "2017-07-19T16:33:59Z")

</div>

You could try the I2C address scanner sketch to find out whehter the sensor can be found at all  
[https://build.particle.io/libs/OneWire/2.0.1/tab/example/Address\_Scanner.ino](https://build.particle.io/libs/OneWire/2.0.1/tab/example/Address_Scanner.ino)

* * *

_Update:_  
The I2C scanner is actually here  
[https://go.particle.io/shared\_apps/58cda34c77e5d3ec090004fe](https://go.particle.io/shared_apps/58cda34c77e5d3ec090004fe)

---

<div class="post-metadata">

**Author:** ![ecabanas](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@ecabanas](https://community.particle.io/u/ecabanas)\
**Post date:** [July 20, 2017, 8:10am UTC](https://community.particle.io/t/bme280-reading-problem/34642/3 "2017-07-20T08:10:41Z")

</div>

> [@ScruffR](#):
>
> ehter the sensor can b

Hi,

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

thank's in advance

---

<div class="post-metadata">

**Author:** ![mtnscott](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/mtnscott/32/3217_2.png) [@mtnscott](https://community.particle.io/u/mtnscott)\
**Post date:** [July 20, 2017, 7:26pm UTC](https://community.particle.io/t/bme280-reading-problem/34642/4 "2017-07-20T19:26:45Z")

</div>

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 ...");
Serial.begin(9600);
while (!Serial.available()) ; // Wait for serial input
```

---

<div class="post-metadata">

**Author:** ![ecabanas](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@ecabanas](https://community.particle.io/u/ecabanas)\
**Post date:** [July 21, 2017, 9:31am UTC](https://community.particle.io/t/bme280-reading-problem/34642/5 "2017-07-21T09:31:14Z")

</div>

#mtnscoot

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

thanks

best

Eduard

---

<div class="post-metadata">

**Author:** ![Postler](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/postler/32/13693_2.png) [@Postler](https://community.particle.io/u/Postler)\
**Post date:** [July 21, 2017, 8:22pm UTC](https://community.particle.io/t/bme280-reading-problem/34642/6 "2017-07-21T20:22:26Z")

</div>

It seems you are following [this project](https://www.hackster.io/ingo-lohs/bme280-measures-and-displays-on-oled-controlled-by-photon-da3360), Ed. Good decision 🙂  
This [BME280 sensor](https://www.amazon.de/gp/product/B01GQ3T1A4) I suggest to you for \< 10 Euros.  
From which site did you copy the (frizzing) schematic (which shows the BMP280)?

---

<div class="post-metadata">

**Author:** ![samb375](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/samb375/32/9247_2.png) [@samb375](https://community.particle.io/u/samb375)\
**Post date:** [January 9, 2018, 5:18am UTC](https://community.particle.io/t/bme280-reading-problem/34642/7 "2018-01-09T05:18:03Z")

</div>

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);

  delay(10000);

}
```

---

<div class="post-metadata">

**Author:** ![jackhaefner](https://avatars.discourse-cdn.com/v4/letter/j/3e96dc/32.png) [@jackhaefner](https://community.particle.io/u/jackhaefner)\
**Post date:** [December 17, 2018, 1:49pm UTC](https://community.particle.io/t/bme280-reading-problem/34642/8 "2018-12-17T13:49:51Z")

</div>

@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!

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [December 17, 2018, 2:27pm UTC](https://community.particle.io/t/bme280-reading-problem/34642/9 "2018-12-17T14:27:16Z")

</div>

Huh??? That was the wrong link and nobody noticed 😉  
It should actually have been the [I2C-Scanner sketch](https://go.particle.io/shared_apps/58cda34c77e5d3ec090004fe) not the `OneWire-Scanner` 😳

---

<div class="post-metadata">

**Author:** ![jackhaefner](https://avatars.discourse-cdn.com/v4/letter/j/3e96dc/32.png) [@jackhaefner](https://community.particle.io/u/jackhaefner)\
**Post date:** [December 17, 2018, 2:40pm UTC](https://community.particle.io/t/bme280-reading-problem/34642/10 "2018-12-17T14:40:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [December 17, 2018, 2:44pm UTC](https://community.particle.io/t/bme280-reading-problem/34642/11 "2018-12-17T14:44:42Z")

</div>

Try again.

---

<div class="post-metadata">

**Author:** ![jackhaefner](https://avatars.discourse-cdn.com/v4/letter/j/3e96dc/32.png) [@jackhaefner](https://community.particle.io/u/jackhaefner)\
**Post date:** [December 17, 2018, 2:45pm UTC](https://community.particle.io/t/bme280-reading-problem/34642/12 "2018-12-17T14:45:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jackhaefner](https://avatars.discourse-cdn.com/v4/letter/j/3e96dc/32.png) [@jackhaefner](https://community.particle.io/u/jackhaefner)\
**Post date:** [December 17, 2018, 5:16pm UTC](https://community.particle.io/t/bme280-reading-problem/34642/13 "2018-12-17T17:16:22Z")

</div>

> [@ecabanas](#):
>
> #define BME\_SCK D1

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

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [December 17, 2018, 5:26pm UTC](https://community.particle.io/t/bme280-reading-problem/34642/14 "2018-12-17T17:26:32Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![jackhaefner](https://avatars.discourse-cdn.com/v4/letter/j/3e96dc/32.png) [@jackhaefner](https://community.particle.io/u/jackhaefner)\
**Post date:** [December 17, 2018, 5:29pm UTC](https://community.particle.io/t/bme280-reading-problem/34642/15 "2018-12-17T17:29:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![andyr6184](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@andyr6184](https://community.particle.io/u/andyr6184)\
**Post date:** [February 4, 2019, 3:20am UTC](https://community.particle.io/t/bme280-reading-problem/34642/16 "2019-02-04T03:20:48Z")

</div>

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!!!
