BME280 communication failed

I was also in trouble and I just confirmed that either the Chinese or me was wrong. Configure the BME280 but the Chinese sent BMP280.

went on to work when I switched to BMP280 and removes Humidity.

sensor:
## Sensor Wifi
  - platform: wifi_signal
    name: "Sinal WiFi"
    update_interval: 60s

## Sensor Tensao da Bateria  
  - platform: adc
    pin: GPIO33
    name: "Tensão da Bateria"
    update_interval: 60s
    filters:
      - multiply: 1.05
    attenuation: 11db
    
## Sensor Pressao Atmosferica     
  - platform: bmp280
    address: 0x76
    update_interval: 60s
    temperature:
      name: "Temperatura"
      oversampling: 16x
    pressure:
      name: "Pressão"
      oversampling: 16x
    #humidity:
      #name: "Umidade Relativa"
      #oversampling: 1x
        
i2c:
  sda: GPIO21
  scl: GPIO22
  scan: false
  id: bus_a

The other day some one in the esphome chat repeatedly failed to read from (in total 3 different) bme280 sensors while esphome was able to detected (scan) the devices on the i2c bus (calling out the right address from the sensor).

Long story short: Shitty cables.

So double/triple check your connection! :man_factory_worker:

Ran into this issue. Not sure what is causing it. I have checked and rechecked the connections, there seems to be nothing wrong there. I have tried all the suggestions posted in this thread, but no cigar so far. Next I will try to change the chip to see if its faulty, and try using Arduino IDE

Working on D1 Mini. I just noticed that it’s (v3.1.0) labeled differently on the front and back.

When following @imbehind’s instructions on the D1 Mini, D1 & D2 labels on one side correspond to 4 and 5 labels on the other side. So you’re using internal pins 4 & 5, which correspond to D1 & D2 on one side, and in yaml.

After copy/pasting from their yml, it still didn’t work for me until I changed it to BME280 instead of BMP280. My sensor is labeled “BME/BMP280”, but only works in E mode.

Working yaml
# i2c
i2c:
  sda: D1
  scl: D2
  scan: False
  id: bus_a

sensor:
  - platform: bme280
    i2c_id: bus_a
    temperature:
      name: "BMP280 Temperature"
      id: bmp280_temperature
      oversampling: 16x
      filters:
      - offset: -1.6
    pressure:
      name: "BMP280 Pressure"
      id: bmp280_pressure
      oversampling: 16x
      filters:
      - offset: 14.3

    humidity:
      name: "BME280 Humidity"
      oversampling: 16x
    update_interval: 60s
    address: 0x76

For what ever reason my BME stopped working after about 6 months of continuous operation. Original setup was as follows:-

i2c:
sda: D1
scl: D2
scan: True
id: bus_a

So me thinking the BME had failed I purchased another, but still had a problem, also programmed another Wemos D1 mini, but to no avail, whilst it done the initial scan and would find the BME, it would not log any data saying communication failed. How I fixed mine was to go back to the original D1 mini, change the pins to the following:

i2c:
sda: D3
scl: D4
scan: True
id: bus_a
and now everything is working fine again…crazy but it worked for me.

I was having the same issue with failure of the BME280. Reading this thread, I came up with the following. Besides what is prior (redacted) this is my NODEMCU setup and its working. You can change the name prior to temp and pressure to what ever you want.

i2c:
sda: GPIO14
scl: GPIO2
scan: true

sensor:

  • platform: bme280
    temperature:
    name: “BMP280 Temperature”
    oversampling: 16x
    pressure:
    name: “BMP280 Pressure”
    address: 0x76
    update_interval: 30s

I am also facing similar issue with Wemos mini D1 and BME/BMP280. My configuration includes:

light:
  - platform: fastled_clockless
    chipset: WS2812B
    pin: D4
    num_leds: 50
    rgb_order: GRB
    name: "Office SmartLED"
    effects:
      - random:
          name: "Slow Random Effecr"
          transition_length: 30s
          update_interval: 30s
      - random:
          name: "Fast Random Effect"
          transition_length: 4s
          update_interval: 5s
      - strobe:
      - flicker:
      - addressable_rainbow:

i2c:
  sda: D2
  scl: D1
  scan: True

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

Any suggestio? Error log is showing below communication error for BME 280:

NFO Successfully connected to 192.168.0.235
[17:57:46][I][app:100]: ESPHome version 1.14.5 compiled on Aug  3 2020, 17:56:54
[17:57:46][C][wifi:415]: WiFi:
[17:57:46][C][wifi:283]:   SSID: [redacted]
[17:57:46][C][wifi:284]:   IP Address: 192.168.0.235
[17:57:46][C][wifi:286]:   BSSID: [redacted]
[17:57:46][C][wifi:287]:   Hostname: 'office_smart_led'
[17:57:46][C][wifi:291]:   Signal strength: -44 dB ▂▄▆█
[17:57:46][C][wifi:295]:   Channel: 1
[17:57:46][C][wifi:296]:   Subnet: 255.255.255.0
[17:57:46][C][wifi:297]:   Gateway: 192.168.0.1
[17:57:46][C][wifi:298]:   DNS1: (IP unset)
[17:57:46][C][wifi:299]:   DNS2: (IP unset)
[17:57:46][C][i2c:028]: I2C Bus:
[17:57:46][C][i2c:029]:   SDA Pin: GPIO4
[17:57:46][C][i2c:030]:   SCL Pin: GPIO5
[17:57:46][C][i2c:031]:   Frequency: 50000 Hz
[17:57:46][I][i2c:033]: Scanning i2c bus for active devices...
[17:57:46][I][i2c:049]: Found no i2c devices!
[17:57:46][D][api.connection:583]: Client 'Home Assistant 0.112.4 (192.168.0.214)' connected successfully!
[17:57:46][C][fastled:019]: FastLED light:
[17:57:46][C][fastled:020]:   Num LEDs: 50
[17:57:46][C][fastled:021]:   Max refresh rate: 400
[17:57:46][D][api.connection:583]: Client 'Home Assistant 0.112.4 (192.168.0.202)' connected successfully!
[17:57:46][C][logger:175]: Logger:
[17:57:46][C][logger:176]:   Level: DEBUG
[17:57:46][C][logger:177]:   Log Baud Rate: 115200
[17:57:46][C][logger:178]:   Hardware UART: UART0
[17:57:46][C][light:177]: Light 'Office SmartLED'
[17:57:46][C][light:179]:   Default Transition Length: 1.0s
[17:57:46][C][light:180]:   Gamma Correct: 2.80
[17:57:46][C][bme280.sensor:142]: BME280:
[17:57:46][C][bme280.sensor:143]:   Address: 0x76
[17:57:46][E][bme280.sensor:146]: Communication with BME280 failed!
[17:57:46][C][bme280.sensor:155]:   IIR Filter: OFF
[17:57:46][C][bme280.sensor:156]:   Update Interval: 60.0s
[17:57:46][C][bme280.sensor:158]:   Temperature 'BME280 Temperature'
[17:57:46][C][bme280.sensor:158]:     Unit of Measurement: '°C'
[17:57:46][C][bme280.sensor:158]:     Accuracy Decimals: 1
[17:57:46][C][bme280.sensor:158]:     Icon: 'mdi:thermometer'
[17:57:46][C][bme280.sensor:159]:     Oversampling: 16x
[17:57:46][C][bme280.sensor:160]:   Pressure 'BME280 Pressure'
[17:57:46][C][bme280.sensor:160]:     Unit of Measurement: 'hPa'
[17:57:46][C][bme280.sensor:160]:     Accuracy Decimals: 1
[17:57:46][C][bme280.sensor:160]:     Icon: 'mdi:gauge'
[17:57:46][C][bme280.sensor:161]:     Oversampling: 16x
[17:57:46][C][bme280.sensor:162]:   Humidity 'BME280 Humidity'
[17:57:46][C][bme280.sensor:162]:     Unit of Measurement: '%'
[17:57:46][C][bme280.sensor:162]:     Accuracy Decimals: 1
[17:57:46][C][bme280.sensor:162]:     Icon: 'mdi:water-percent'
[17:57:46][C][bme280.sensor:163]:     Oversampling: 16x
[17:57:46][C][captive_portal:169]: Captive Portal:
[17:57:47][C][ota:029]: Over-The-Air Updates:
[17:57:47][C][ota:030]:   Address: 192.168.0.235:8266
[17:57:47][C][ota:032]:   Using Password.
[17:57:47][C][api:095]: API Server:
[17:57:47][C][api:096]:   Address: 192.168.0.235:6053
[17:59:37][I][ota:046]: Boot seems successful, resetting boot loop counter.

I ran into this issue because I have the BME280 on a 1.5M shielded cable.

Even with short cables, it’s very important to have a pull up resistor on the SDL and SCL to VCC of the sensor (+3.3v in my case). I though the internal pull up would be used, but it was clearly not or not enough.

I ended up reading on the attenuation and capacitance that can affect the way the I2C protocol works depending on cable length and shielding. Basically, and anyone more knowledgeable correct me please, I came to conclusion that 4.7K to 10K pull up resistor was needed. The longer the wire, the closer I got to 4.7K for the pull value.

Also, I made the mistake of connecting the shield to earth ground and introducing enough noise that I2C buss failed to work.

Thank you for your quick reply. The module that I got is " GY-BME280-5V Sensor SPI Humidity Temperature Barometric Pressure Sensor Module". The Vcc range is 1.8-5.0V but I used 3.3V to connect from Mini D1.


I can try two things:

  1. I can raise the voltage to 5V
  2. I can connect pull up resistors as you mentioned.

Let me try. Thanks again.

I just bought that same unit and I’m running it at 3.3v without problem.

Are you using pull up resistors on this new BME280 board?

I don’t use any on my nodemcu with BME280… (I do use the 5V USB to power nodemcu)

I am using Mini D1 and using 4 wire, ~4 inches long flat unshielded cable to connect on pin D2 and D1 with Vcc of 3.3V from Mini D1 board. Not sure about the need for pull up as mentioned by Jesse and any associated interference.

I just inserted two 10K pull up resistors and BME280 sensor started responding with below message. It looks Wemos Mini D1 requires pullup resistors across pin D1 and D2 and node MCU doesn’t:

INFO Reading configuration /config/esphome/office_smart_led.yaml...
INFO Starting log output from 192.168.0.235 using esphome API
INFO Connecting to 192.168.0.235:6053 (192.168.0.235)
INFO Successfully connected to 192.168.0.235
[14:55:25][I][app:100]: ESPHome version 1.14.5 compiled on Aug  3 2020, 17:56:54
[14:55:25][C][wifi:415]: WiFi:
[14:55:25][C][wifi:283]:   SSID: [redacted]
[14:55:25][C][wifi:284]:   IP Address: 192.168.0.235
[14:55:25][C][wifi:286]:   BSSID: [redacted]
[14:55:25][C][wifi:287]:   Hostname: 'office_smart_led'
[14:55:25][C][wifi:291]:   Signal strength: -61 dB ▂▄▆█
[14:55:25][C][wifi:295]:   Channel: 1
[14:55:25][C][wifi:296]:   Subnet: 255.255.255.0
[14:55:25][C][wifi:297]:   Gateway: 192.168.0.1
[14:55:25][C][wifi:298]:   DNS1: (IP unset)
[14:55:25][C][wifi:299]:   DNS2: (IP unset)
[14:55:25][C][i2c:028]: I2C Bus:
[14:55:25][C][i2c:029]:   SDA Pin: GPIO4
[14:55:25][C][i2c:030]:   SCL Pin: GPIO5
[14:55:25][C][i2c:031]:   Frequency: 50000 Hz
[14:55:25][I][i2c:033]: Scanning i2c bus for active devices...
[14:55:25][I][i2c:040]: Found i2c device at address 0x76
[14:55:25][C][fastled:019]: FastLED light:
[14:55:25][C][fastled:020]:   Num LEDs: 50
[14:55:25][C][fastled:021]:   Max refresh rate: 400
[14:55:25][C][logger:175]: Logger:
[14:55:25][C][logger:176]:   Level: DEBUG
[14:55:25][C][logger:177]:   Log Baud Rate: 115200
[14:55:25][C][logger:178]:   Hardware UART: UART0
[14:55:25][C][light:177]: Light 'Office SmartLED'
[14:55:25][C][light:179]:   Default Transition Length: 1.0s
[14:55:25][C][light:180]:   Gamma Correct: 2.80
[14:55:25][C][bme280.sensor:142]: BME280:
[14:55:25][C][bme280.sensor:143]:   Address: 0x76
[14:55:25][C][bme280.sensor:155]:   IIR Filter: OFF
[14:55:25][C][bme280.sensor:156]:   Update Interval: 60.0s
[14:55:25][C][bme280.sensor:158]:   Temperature 'BME280 Temperature'
[14:55:25][C][bme280.sensor:158]:     Unit of Measurement: '°C'
[14:55:25][C][bme280.sensor:158]:     Accuracy Decimals: 1
[14:55:25][C][bme280.sensor:158]:     Icon: 'mdi:thermometer'
[14:55:25][C][bme280.sensor:159]:     Oversampling: 16x
[14:55:25][C][bme280.sensor:160]:   Pressure 'BME280 Pressure'
[14:55:25][C][bme280.sensor:160]:     Unit of Measurement: 'hPa'
[14:55:25][C][bme280.sensor:160]:     Accuracy Decimals: 1
[14:55:26][C][bme280.sensor:160]:     Icon: 'mdi:gauge'
[14:55:26](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[14:55:26](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[14:55:26][C][bme280.sensor:162]:     Unit of Measurement: '%'
[14:55:26][C][bme280.sensor:162]:     Accuracy Decimals: 1
[14:55:26][C][bme280.sensor:162]:     Icon: 'mdi:water-percent'
[14:55:26](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[14:55:26][C][api:095]: API Server:
[14:55:26][C][api:096]:   Address: 192.168.0.235:6053
[14:55:32][D][bme280.sensor:197]: Got temperature=23.1°C pressure=976.6hPa humidity=49.8%
[14:55:32][D][sensor:092]: 'BME280 Temperature': Sending state 23.08000 °C with 1 decimals of accuracy
[14:55:32][D][sensor:092]: 'BME280 Pressure': Sending state 976.59705 hPa with 1 decimals of accuracy
[14:55:32][D][sensor:092]: 'BME280 Humidity': Sending state 49.76660 % with 1 decimals of accuracy
[14:55:43][I][ota:046]: Boot seems successful, resetting boot loop counter.
[14:56:32][D][bme280.sensor:197]: Got temperature=22.4°C pressure=976.6hPa humidity=51.8%
[14:56:32][D][sensor:092]: 'BME280 Temperature': Sending state 22.41000 °C with 1 decimals of accuracy
[14:56:32][D][sensor:092]: 'BME280 Pressure': Sending state 976.62250 hPa with 1 decimals of accuracy
[14:56:32][D][sensor:092]: 'BME280 Humidity': Sending state 51.75781 % with 1 decimals of accuracy

Hey y’all!!

If you’ve still got this problem, please make sure you check the type of sensor you have. I had placed an order for a BME280 and turns out I received the BMP280 instead. The only visual identification is the box that is marked on the PCB itself, a photo of which is below. Mine has a visible mark next to the “P”. in this case, I had to update the code found at https://esphome.io/cookbook/bme280_environment.html to the one Ive indicated below. Spent a whole day trying to figure this out. Apparently there’s multiple ways of checking the variant of chip you’ve got, a few of which are found here: https://goughlui.com/2018/08/05/note-bosch-sensortec-bmp280-vs-bme280-sensor-confusion/

Hope this helped you! Feel free to reply with any query, I’ll try my best to help you out!

I’ve commented the sections from the BME280-Environment code that are irrelevant for the BMP280.

i2c:
  sda: D2
  scl: D1
  scan: True
  id: bus_a
  
sensor:
  - platform: bmp280
    i2c_id: bus_a
    temperature:
      name: "BMP280 Temperature"
      id: bmp280_temperature
    pressure:
      name: "BMP280 Pressure"
      id: bmp280_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(bmp280_temperature).state + 273.15) / 0.0065) *
        (powf((STANDARD_SEA_LEVEL_PRESSURE / id(bmp280_pressure).state), 0.190234) - 1); // in meter
    update_interval: 15s
    icon: 'mdi:signal'
    unit_of_measurement: 'm'
#  - 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
#    accuracy_decimals: 2
#    update_interval: 15s
#    icon: 'mdi:water'
#    unit_of_measurement: 'g/m³'
#  - platform: template
#    name: "Dew Point"
#    lambda: return (243.5*(log(id(bme280_humidity).state/100)+((17.67*id(bme280_temperature).state)/(243.5+id(bme280_temperature).state)))/(17.67-log(id(bme280_humidity).state/100)-((17.67*id(bme280_temperature).state)/(243.5+id(bme280_temperature).state))));
#    unit_of_measurement: °C
#    icon: 'mdi:thermometer-alert'
  

PS: This is my first post in the community. Looking forward to be of some help around here.

I am not sure what is the issue again, setup worked for sometime with two 10k pullup resisitors on pin D1 and D2. The problem came back again and I removed all connection, re-establish fresh connection with new wire, same configuration between Mini D1 and BME280. I have been trying to debug hard all hardware related issue but unable to find the problem.

[12:55:17][I][i2c:033]: Scanning i2c bus for active devices...
[12:55:17][I][i2c:049]: Found no i2c devices!

[12:55:18][E][bme280.sensor:146]: Communication with BME280 failed!

Any further suggestion?

Finally I fixed the issue by removing all connections on Mini D1 and BME sensor and re-establishing all like fresh again. Either some wire or soldering was loose that was causing issue, it is working well now. I utilized dollar store TicTac mouthfreshner plastic container as housing for Mini D1.

1 Like

This fixed it for me Thanks heaps!!

Issue was fixed for me changing address from 0x77 to 0x76 . Pins I used were D1 and D2

1 Like

Can i use a bme280 sensor on a esp32cam?