# BME280 Sensor not working

**URL:** <https://forum.arduino.cc/t/bme280-sensor-not-working/385705>\
**Category:** Sensors\
**Created:** [May 13, 2016, 4:58pm UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705 "2016-05-13T16:58:59Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![nzee](https://avatars.discourse-cdn.com/v4/letter/n/e5b9ba/32.png) [@nzee](https://forum.arduino.cc/u/nzee)\
**Post date:** [May 13, 2016, 4:58pm UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/1 "2016-05-13T16:58:59Z")

</div>

Hello,

I'm using an Arduino UNO to read a BME280 sensor. However, when I send it the test code it outputs:

Could not find a valid BME280 sensor, check wiring!

```cpp
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 10

#define SEALEVELPRESSURE_HPA (1013.25)

//Adafruit_BME280 bme; // I2C
//Adafruit_BME280 bme(BME_CS); // hardware SPI
Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO,  BME_SCK);

void setup() {
  Serial.begin(9600);
  Serial.println(F("BME280 test"));

  if (!bme.begin()) {
    Serial.println("Could not find a valid BME280 sensor, check wiring!");
    while (1);
  }
}

void loop() {
    Serial.print("Temperature = ");
    Serial.print(bme.readTemperature());
    Serial.println(" *C");

    Serial.print("Pressure = ");

    Serial.print(bme.readPressure() / 100.0F);
    Serial.println(" hPa");

    Serial.print("Approx. Altitude = ");
    Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
    Serial.println(" m");

    Serial.print("Humidity = ");
    Serial.print(bme.readHumidity());
    Serial.println(" %");

    Serial.println();
    delay(2000);
}

```

I've tried re-wiring and the 12c wiring but the yield the same result. Any advice is greatly appreciated.

---

<div class="post-metadata">

**Author:** ![Koepel](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/koepel/32/637546_2.png) [@Koepel](https://forum.arduino.cc/u/Koepel)\
**Post date:** [May 14, 2016, 6:05am UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/2 "2016-05-14T06:05:36Z")

</div>

Thank you for the sharp and large photos.

You are using this ? [Arduino Test | Adafruit BME280 Humidity + Barometric Pressure + Temperature Sensor Breakout | Adafruit Learning System](https://learn.adafruit.com/adafruit-bme280-humidity-barometric-pressure-temperature-sensor-breakout/wiring-and-test)

Your wiring is for hardware SPI. Both hardware SPI and software SPI should work.  
I think everything is wired okay.

I would like the see the bottom side of the module to check your soldering.  
Could you move it to another location on the breadboard ? Some breadboards are low quality.  
Perhaps the sensor module is broken.  
Do you have a multimeter to measure the voltages of the module ?

Perhaps the I2C is a little easier. You can connect the wires and measure the voltages while the i2c\_scanner is running.  
[Arduino Playground - HomePage](http://playground-archive.arduino.cc/Main/I2cScanner).

At this moment, the soldering of the pins is the first thing to check.

---

<div class="post-metadata">

**Author:** ![zoomx](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/zoomx/32/213669_2.png) [@zoomx](https://forum.arduino.cc/u/zoomx)\
**Post date:** [May 14, 2016, 8:26pm UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/3 "2016-05-14T20:26:46Z")

</div>

Check the address with an I2C scanner. My bme280 is on 76 and not 77 as in the Adafruit library.

---

<div class="post-metadata">

**Author:** ![s-h-a-w-n](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@s-h-a-w-n](https://forum.arduino.cc/u/s-h-a-w-n)\
**Post date:** [December 11, 2016, 6:48pm UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/4 "2016-12-11T18:48:58Z")

</div>

That was my problem, thank you!

Changing **#define BME280\_ADDRESS (0x77)** for **#define BME280\_ADDRESS (0x76)** in the library's Adafruit\_BME280.h solved the problem.

---

<div class="post-metadata">

**Author:** ![zoomx](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/zoomx/32/213669_2.png) [@zoomx](https://forum.arduino.cc/u/zoomx)\
**Post date:** [December 12, 2016, 7:20am UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/5 "2016-12-12T07:20:24Z")

</div>

BME280 is a SPI or I2C sensor. It has two I2C addresses 0x77 and 0x76. The first is the default address, to have the latter you have to put SDO line to GND.  
Adafruit boards have SPI and I2C pins so you can choose which address to use but cheap I2C only boards doesn't allow to choose the address.

---

<div class="post-metadata">

**Author:** ![Eheran](https://avatars.discourse-cdn.com/v4/letter/e/ea5d25/32.png) [@Eheran](https://forum.arduino.cc/u/Eheran)\
**Post date:** [December 12, 2016, 8:23pm UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/6 "2016-12-12T20:23:21Z")

</div>

Why do u need the address when connecting it to SPI?

OT: Is there a (easy) way to use existing SPI-pins as I2C?

---

<div class="post-metadata">

**Author:** ![CrossRoads](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/crossroads/32/214033_2.png) [@CrossRoads](https://forum.arduino.cc/u/CrossRoads)\
**Post date:** [December 12, 2016, 8:49pm UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/7 "2016-12-12T20:49:17Z")

</div>

See page 11, 30, 38  
[https://ae-bst.resource.bosch.com/media/\_tech/media/datasheets/BST-BME280\_DS001-11.pdf](https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BME280_DS001-11.pdf)  
In SPI mode, there is a discrete slave select line to select the part that will respond, vs an address in I2C mode that the part must watch for and respond to.

If multiple parts are to be used, then pin 5, SDO, can be used as a chip select in I2C mode. Drive each devices SDO high with a unique signal. Drive SDO Low to one device and access it at address 76 - the other will be looking for address 77 and will not respond.  
The SDOs can be from a shift register if you are short on pins.  
Tho, if you had that many devices and chip select pins, I don't know why you wouldn't use the much faster SPI (up to 8 MHz) vs the slower I2C (400 KHz).

---

<div class="post-metadata">

**Author:** ![zoomx](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/zoomx/32/213669_2.png) [@zoomx](https://forum.arduino.cc/u/zoomx)\
**Post date:** [December 13, 2016, 8:11am UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/8 "2016-12-13T08:11:21Z")

</div>

Usually these sensors take time for a measurement so faster SPI is useless.  
If we talk about displays or ADCs you're absolutely right, SPI is much better.

---

<div class="post-metadata">

**Author:** ![leonline](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/leonline/32/222940_2.png) [@leonline](https://forum.arduino.cc/u/leonline)\
**Post date:** [July 19, 2017, 10:08pm UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/9 "2017-07-19T22:08:45Z")

</div>

> s-h-a-w-n:  
> Changing **#define BME280\_ADDRESS (0x77)** for **#define BME280\_ADDRESS (0x76)** in the library's Adafruit\_BME280.h solved the problem.

Thank you. Solved my problem 😉

---

<div class="post-metadata">

**Author:** ![zoomx](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/zoomx/32/213669_2.png) [@zoomx](https://forum.arduino.cc/u/zoomx)\
**Post date:** [July 20, 2017, 6:45am UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/10 "2017-07-20T06:45:05Z")

</div>

Reading the documentation (I did it very late!!!!) it seems that you can use bme.begin(0x77) instead of changing the library as I did before.  
I should have read the F.... manual!!!

---

<div class="post-metadata">

**Author:** ![wvmarle](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wvmarle/32/1013044_2.png) [@wvmarle](https://forum.arduino.cc/u/wvmarle)\
**Post date:** [July 29, 2017, 4:47am UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/11 "2017-07-29T04:47:02Z")

</div>

> CrossRoads:  
> Tho, if you had that many devices and chip select pins, I don't know why you wouldn't use the much faster SPI (up to 8 MHz) vs the slower I2C (400 KHz).

I2C: two pins for up to 128 devices. More than fast enough for the few bytes that you read from a sensor.  
SPI: three pins for the bus plus one SS pin for each device. Makes you run out of pins fast.

For me, it's SPI for the MicroSD and I2C for just about everything else.

---

<div class="post-metadata">

**Author:** ![zoomx](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/zoomx/32/213669_2.png) [@zoomx](https://forum.arduino.cc/u/zoomx)\
**Post date:** [July 29, 2017, 8:09am UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/12 "2017-07-29T08:09:49Z")

</div>

If you want to use more sensors, if all share the same address, may be difficult.

---

<div class="post-metadata">

**Author:** ![wvmarle](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wvmarle/32/1013044_2.png) [@wvmarle](https://forum.arduino.cc/u/wvmarle)\
**Post date:** [July 29, 2017, 9:12am UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/13 "2017-07-29T09:12:23Z")

</div>

On the ESP8266 I'd just open a second I2C bus for such a situation, if it ever happens. Don't know how well the ATmega handles that. It just takes two extra pins, still a easy win over SPI in pin count: four BME280 sensors take seven pins for SPI, or four pins with two I2C buses. Well, I'm sure you can come up with a situation where it happens.

---

<div class="post-metadata">

**Author:** ![hnas66](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@hnas66](https://forum.arduino.cc/u/hnas66)\
**Post date:** [November 4, 2017, 10:12am UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/14 "2017-11-04T10:12:35Z")

</div>

> zoomx:  
> Check the address with an I2C scanner. My bme280 is on 76 and not 77 as in the Adafruit library.

after spending many hours changing esp, trying different ports I found that this was the problem, thanks!

---

<div class="post-metadata">

**Author:** ![zoomx](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/zoomx/32/213669_2.png) [@zoomx](https://forum.arduino.cc/u/zoomx)\
**Post date:** [November 4, 2017, 10:21am UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/15 "2017-11-04T10:21:58Z")

</div>

When you have problems using an I2C chip the first action is to discover if it works using an I2C scanner taking care that some few chips have an address that is not recognized by the scanner because is longer that expected, 10 bits instead of 8, if I remember.

---

<div class="post-metadata">

**Author:** ![wvmarle](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wvmarle/32/1013044_2.png) [@wvmarle](https://forum.arduino.cc/u/wvmarle)\
**Post date:** [November 4, 2017, 10:46am UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/16 "2017-11-04T10:46:03Z")

</div>

I2C standard address length is 7 bits.

10 bits gets tricky as it's more than a byte.

---

<div class="post-metadata">

**Author:** ![zoomx](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/zoomx/32/213669_2.png) [@zoomx](https://forum.arduino.cc/u/zoomx)\
**Post date:** [November 4, 2017, 4:51pm UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/17 "2017-11-04T16:51:28Z")

</div>

It is a new addressing  
[https://www.i2c-bus.org/addressing/10-bit-addressing/](https://www.i2c-bus.org/addressing/10-bit-addressing/)

---

<div class="post-metadata">

**Author:** ![mischa72](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@mischa72](https://forum.arduino.cc/u/mischa72)\
**Post date:** [January 7, 2018, 4:23pm UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/18 "2018-01-07T16:23:41Z")

</div>

Guys,

Hope you don't mind asking the same question again.

I use [this](https://www.ebay.com/itm/401000227934) BME280, but when I try to run the same bme280test sketch as mentioned above the serial monitor doesn't give any readings.

Only message on serial monitor: BME280 test

On the I2C\_scanner: I2C Scanner  
Scanning ......

I use a stock Arduino Uno and the BME280 is connected I2C through pins A4 and A5 for SDA and SCL.

Best regards,  
Mischa

---

<div class="post-metadata">

**Author:** ![wvmarle](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wvmarle/32/1013044_2.png) [@wvmarle](https://forum.arduino.cc/u/wvmarle)\
**Post date:** [January 7, 2018, 4:37pm UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/19 "2018-01-07T16:37:30Z")

</div>

If you don't see it show up on the I2C scanner, check wiring, make sure it's all connected properly.  
If still nothing, take another - preferably known good - sensor, see if that one works. That confirms whether your wiring and so is correct, and that the other sensor is probably defective.  
If you also don't see the known good one, start working on your wiring.

---

<div class="post-metadata">

**Author:** ![mischa72](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@mischa72](https://forum.arduino.cc/u/mischa72)\
**Post date:** [January 7, 2018, 6:02pm UTC](https://forum.arduino.cc/t/bme280-sensor-not-working/385705/20 "2018-01-07T18:02:22Z")

</div>

Well, the wiring is not that hard. 5V and GND from the Arduino board, Pin A5 to SCL, Pin A4 to SDA and 2 pullups from +5V to SDA and SCL.

I already tried another BPE280, but it "performs" the same (does nothing).

Yes, 5V is correct as the breakout board has an internal voltage regulator.

Regards,  
Mischa

[Next page](https://forum.arduino.cc/t/bme280-sensor-not-working/385705.md?page=2)
