BME280 communication failed

Not able to get readings from the BME280 temperature, humidity and pressure sensor.

Anyone having the same problems?
It is connected to a nodemcuv3 board, code below.
Error message simply says “communication with BME280 failed” (see picture)

Anyone who knows how to solve this?

42

esphome:
  name: temp2
  platform: ESP8266
  board: nodemcuv2

wifi:
  manual_ip:
    static_ip: 192.168.0.18
    gateway: 192.168.0.1
    subnet: 255.255.255.0
  ssid: redacted
  password: redacted

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

i2c:
  sda: D6
  scl: D7
  scan: False

sensor:
  - platform: bme280
    temperature:
      name: "BME280 Temperature"
      id: bme280_temperature
    pressure:
      name: "BME280 Pressure"
      id: bme280_pressure
    humidity:
      name: "BME280 Relative Humidity"
      id: bme280_humidity
    address: 0x76
    update_interval: 15s
  - platform: template
    name: "Altitude"
    lambda: |-
      const float STANDARD_SEA_LEVEL_PRESSURE = 1013.25; //in hPa, see note
      return ((id(bme280_temperature).state + 273.15) / 0.0065) *
        (powf((STANDARD_SEA_LEVEL_PRESSURE / id(bme280_pressure).state), 0.190234) - 1); // in meter
    update_interval: 15s
  - platform: template
    name: "Absolute Humidity"
    lambda: |-
      const float mw = 18.01534;    // molar mass of water g/mol
      const float r = 8.31447215;   // Universal gas constant J/mol/K
      return (6.112 * powf(2.718281828, (17.67 * id(bme280_temperature).state) /
        (id(bme280_temperature).state + 243.5)) * id(bme280_humidity).state * mw) /
        ((273.15 + id(bme280_temperature).state) * r); // in grams/m^3
    update_interval: 15s

did you try address: 0x77 already?

Yes. Same result with 0x77 address

Since I’m not using a NodeMCU with this sensor I can’t test if D6/D7 would work for me. Could you try the default I2C pins?

Connect the sensor’s SDA to the node’s D2. Connect SCL to D1.

Update the I2C config in your sketch:

i2c:
  sda: 4
  scl: 5
  scan: false

Try again with both addresses (all of mine use 0x76).

That didn’t seem to make any difference either unfortunately.
In fact, I tried with 4 different BME280 sensor too, in case it was a faulty sensor. Same results.

I also tried with a ESP32S board in case it was the board. Same result.

So - I am not sure where the problem is.
What board do you use @Florian? Would like to try a non-NodeMCU board and see if that might solve it.

Did you try without the “Altitude” and “Absolute Humidity”

sensor:
  - platform: bme280
    temperature:
      name: "BME280 Temperature"
      id: bme280_temperature
    pressure:
      name: "BME280 Pressure"
      id: bme280_pressure
    humidity:
      name: "BME280 Relative Humidity"
      id: bme280_humidity
    address: 0x76
    update_interval: 15s

I’m using only Wemos D1 mini boards in combination with the BME280 sensors. I have seven of them running and all are working fine.

Below is one of my device’s config. It’s running in “weather station” configuration (1x oversampling, 60 seconds interval). Remove the mqtt and the filters part if you don’t need it.

esphome:
  name: living_room_bme280
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: !secret esphome_wifi_ssid
  password: !secret esphome_wifi_password

  manual_ip:
    static_ip: 192.168.1.101
    gateway: 192.168.1.1
    subnet: 255.255.255.0
    dns1: 1.1.1.1
    dns2: 1.0.0.1

logger:

api:
  password: !secret esphome_api_password

ota:
  password: !secret esphome_ota_password

mqtt:
  broker: !secret esphome_mqtt_broker
  username: !secret esphome_mqtt_username
  password: !secret esphome_mqtt_password
  discovery: false

i2c:
  sda: 4
  scl: 5
  scan: false

sensor:
  - platform: bme280
    temperature:
      name: "Living Room Temperature"
      oversampling: 1x
      filters:
        - or:
          - heartbeat: 900s
          - delta: 0.25
    pressure:
      name: "Living Room Pressure"
      oversampling: 1x
      filters:
        - or:
          - heartbeat: 900s
          - delta: 0.35
    humidity:
      name: "Living Room Humidity"
      oversampling: 1x
      filters:
        - or:
          - heartbeat: 900s
          - delta: 0.25
    address: 0x76
    update_interval: 60s
  - platform: wifi_signal
    name: "Living Room BME280 WiFi Signal"
    update_interval: 900s

binary_sensor:
  - platform: status
    name: "Living Room BME280"

status_led:
  pin:
    number: GPIO2
    inverted: yes

tried myself on 0x76 and 0x77 . Same issue with bme280 not
Nodemcu esp32s and BME280 4 pin output.
my ic2 is 21 and 22

[17:58:00][I][i2c:048]: Scanning i2c bus for active devices...
[17:58:00][I][i2c:064]: Found no i2c devices!
[17:58:00][C][logger:159]: Logger:
[17:58:00][C][logger:160]:   Level: DEBUG
[17:58:00][C][logger:161]:   Log Baud Rate: 115200
[17:58:00][C][logger:162]:   Hardware UART: UART0
[17:58:00][C][sensor.bme280:151]: BME280:
[17:58:00][C][sensor.bme280:152]:   Address: 0x76
[17:58:00][E][sensor.bme280:155]: Communication with BME280 failed!
[17:58:00][C][sensor.bme280:164]:   IIR Filter: OFF
[17:58:00][C][sensor.bme280:165]:   Update Interval: 60000 ms
[17:58:00][C][sensor.bme280:167]:   Temperature 'BME280 Temperature'
[17:58:00][C][sensor.bme280:167]:     Unit of Measurement: '°C'
[17:58:00][C][sensor.bme280:167]:     Accuracy Decimals: 1
[17:58:00][C][sensor.bme280:168]:     Oversampling: 1x
[17:58:00][C][sensor.bme280:169]:   Pressure 'BME280 Pressure'
[17:58:00][C][sensor.bme280:169]:     Unit of Measurement: 'hPa'
[17:58:00][C][sensor.bme280:169]:     Accuracy Decimals: 1
[17:58:00][C][sensor.bme280:169]:     Icon: 'mdi:gauge'
[17:58:00][C][sensor.bme280:170]:     Oversampling: 16x
[17:58:00][C][sensor.bme280:171]:   Humidity 'BME280 Humidity'
[17:58:00][C][sensor.bme280:171]:     Unit of Measurement: '%'
[17:58:00][C][sensor.bme280:171]:     Accuracy Decimals: 1
[17:58:00][C][sensor.bme280:171]:     Icon: 'mdi:water-percent'
[17:58:00][C][sensor.bme280:172]:     Oversampling: 16x
[17:58:00][C][sensor.wifi_signal:042]: WiFi Signal 'WiFi Signal Sensor'
[17:58:00][C][sensor.wifi_signal:042]:   Unit of Measurement: 'dB'
[17:58:00][C][sensor.wifi_signal:042]:   Accuracy Decimals: 0
[17:58:00][C][sensor.wifi_signal:042]:   Icon: 'mdi:wifi'
[17:58:00][C][api:089]: API Server:
[17:58:00][C][api:090]:   Address: node1.local:6053

Check if it is a BMP280 (sometimes mislabeled on the silkscreen)

I have the same problem. I’m using this PCB: https://www.aliexpress.com/item/I2C-SPI-BMP280-3-3V-Digital-Barometric-Pressure-Altitude-Sensor-DC-High-Precision-BME280-1-8/32654011852.html?spm=a2g0s.9042311.0.0.1e5e4c4d88KaXq

I have the same problem. I’m using a wemos d1 mini pro, sda on pin 4 sclk on pin5 and the sensor is a BME280. This is one of the first projects I’m trying to do using hassio and espHome, it is ridiculously simple and it doesn’t work. I have programmed the same exact setup with espEasy and it worked like a charm. Below is my latest code which has been modified numerous times, It is basically from one of the authors in this chain without the password info, but still no love from esphome…

esphome:
name: shroomsense
platform: ESP8266
board: d1_mini_pro
i2c:
sda: 4
scl: 5
scan: false

sensor:

  • platform: bme280
    temperature:
    name: “Living Room Temperature”
    oversampling: 1x
    filters:
    - or:
    - heartbeat: 900s
    - delta: 0.25
    pressure:
    name: “Living Room Pressure”
    oversampling: 1x
    filters:
    - or:
    - heartbeat: 900s
    - delta: 0.35
    humidity:
    name: “Living Room Humidity”
    oversampling: 1x
    filters:
    - or:
    - heartbeat: 900s
    - delta: 0.25
    address: 0x76
    update_interval: 60s

did you try 0x77 already?

Florian,
Using EspEasy the system works and it’s address is 0x76. Prior to that, I have tried both addresses using EspHome. I’ll try to dig through the ESPHome code for the BME280, I have a feeling the address is not getting changed correctly. But if you have any other ideas I’m all ears

Thanks
Mark

So I tried to change the frequency of the I2C component from 50kHz to 200khz. However when I ran the logs it always says I2C Frequency is 50kHz? I did a clean rebuild but still no luck.

The only other thing i can think of is to check youre i2c wiring configuration again and maybe set scan: true to see if anything is returned. Other than that I’m out of ideas…

I’m having the same issue, but for BME680. I’ve seen numerous threads with this issue, but all are closed with no resolution. Very frustrating.

I’m having the same problem using a bme280

here is some of the code:

esphome:
  name: garage
  platform: ESP8266
  board: d1_mini

.....

i2c:
  scan: true

sensor:
  - platform: bme280
    temperature:
      name: "BME280 Temperature"
      oversampling: 16x
    pressure:
      name: "BME280 Pressure"
    humidity:
      name: "BME280 Humidity"
    address: 0x77
    update_interval: 60s

I’m connecting the bme280 using 3.3V

@ricreis394
your address: 0x77 needs to go under the i2c component not the individual sensor component. But you’ve already got it scanning, so if you want to add a direct address there, then remove the scan: true

even without the address line, checking the logs at boot, it says “Found no i2c devices”

you don’t have your SDA/SCL pins defined.

i2c: scan: true sda: y scl: x

Also, I lied. I just looked at the config the address: line does go within the sensor for some reason. I guess it kind of makes sense, but makes more senese to me to define i2c devices within the i2c config. shrug. Sort out your sda/scl and it will work.