[SOLVED] D1mini with BME280 i2c -> Communication with BME280 failed! (wasn't BME280, but BMP280)

Hi all

I’m trying to use a BME280 sensor with D1mini but I don’t get any values

The sensor is connected ti the D1mini this way:

BME280 —> D1mini
VCC -------> VCC
GND --------> G
SCL ---------> D5
SDA ---------> D6

And this is the ESPHome configuration:

esphome:
  name: d1mini-bm280
  platform: ESP8266
  board: d1_mini

# Enable logging
logger:
  level: DEBUG

# Enable Home Assistant API
api:

web_server:

switch:
  - platform: restart
    name: "D1 mini BM280 Restart"

ota:
  password: "password"

wifi:
  networks:
  - ssid: “ssid”
    password: “password”
  - ssid: "ssid"
    password: "password"


  reboot_timeout: 5min

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "D1Mini-Bm280 Fallback Hotspot"
    password: “password”

captive_portal:

i2c:


sensor:
  - platform: bme280_i2c
    address: 0x76
    temperature:
      name: "BME280 Temperature"
    pressure:
      name: "BME280 Pressure"
    humidity:
      name: "BME280 Humidity"
    update_interval: 60s

and is the starting log

INFO Upload took 5.13 seconds, waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.1.109 using esphome API
INFO Successfully connected to d1mini-bm280 @ 192.168.1.109 in 19.709s
INFO Successful handshake with d1mini-bm280 @ 192.168.1.109 in 0.033s
[09:55:43][I][app:102]: ESPHome version 2024.3.1 compiled on Mar 27 2024, 09:55:10
[09:55:43][C][wifi:580]: WiFi:
[09:55:43][C][wifi:408]:   Local MAC: [redacted]
[09:55:43][C][wifi:413]:   SSID: [redacted]
[09:55:43][C][wifi:416]:   IP Address: 192.168.1.109
[09:55:43][C][wifi:419]:   BSSID: [redacted]
[09:55:43][C][wifi:421]:   Hostname: 'd1mini-bm280'
[09:55:43][C][wifi:423]:   Signal strength: -38 dB ▂▄▆█
[09:55:43][C][wifi:427]:   Channel: 11
[09:55:43][C][wifi:428]:   Subnet: 255.255.255.0
[09:55:43][C][wifi:429]:   Gateway: 192.168.1.10
[09:55:43][C][wifi:430]:   DNS1: 192.168.1.120
[09:55:43][C][wifi:431]:   DNS2: 0.0.0.0
[09:55:43][C][logger:166]: Logger:
[09:55:43][C][logger:167]:   Level: DEBUG
[09:55:43][C][logger:169]:   Log Baud Rate: 115200
[09:55:43][C][logger:170]:   Hardware UART: UART0
[09:55:43][C][i2c.arduino:059]: I2C Bus:
[09:55:43][C][i2c.arduino:060]:   SDA Pin: GPIO4
[09:55:43][C][i2c.arduino:061]:   SCL Pin: GPIO5
[09:55:43][C][i2c.arduino:062]:   Frequency: 50000 Hz
[09:55:43][C][i2c.arduino:065]:   Recovery: bus successfully recovered
[09:55:43][I][i2c.arduino:075]: Results from i2c bus scan:
[09:55:43][I][i2c.arduino:077]: Found no i2c devices!
[09:55:43][C][restart:068]: Restart Switch 'D1 mini BM280 Restart'
[09:55:43][C][restart:070]:   Icon: 'mdi:restart'
[09:55:43][C][restart:090]:   Restore Mode: always OFF
[09:55:43][C][bme280_i2c.sensor:025]:   Address: 0x76
[09:55:43][C][bme280.sensor:182]: BME280:
[09:55:43][E][bme280.sensor:185]: Communication with BME280 failed!
[09:55:43][C][bme280.sensor:194]:   IIR Filter: OFF
[09:55:43][C][bme280.sensor:195]:   Update Interval: 60.0s
[09:55:43][C][bme280.sensor:197]:   Temperature 'BME280 Temperature'
[09:55:43][C][bme280.sensor:197]:     Device Class: 'temperature'
[09:55:43][C][bme280.sensor:197]:     State Class: 'measurement'
[09:55:43][C][bme280.sensor:197]:     Unit of Measurement: '°C'
[09:55:43][C][bme280.sensor:197]:     Accuracy Decimals: 1
[09:55:43][C][bme280.sensor:198]:     Oversampling: 16x
[09:55:43][C][bme280.sensor:199]:   Pressure 'BME280 Pressure'
[09:55:43][C][bme280.sensor:199]:     Device Class: 'pressure'
[09:55:43][C][bme280.sensor:199]:     State Class: 'measurement'
[09:55:43][C][bme280.sensor:199]:     Unit of Measurement: 'hPa'
[09:55:43][C][bme280.sensor:199]:     Accuracy Decimals: 1
[09:55:43][C][bme280.sensor:200]:     Oversampling: 16x
[09:55:43][C][bme280.sensor:201]:   Humidity 'BME280 Humidity'
[09:55:43][C][bme280.sensor:201]:     Device Class: 'humidity'
[09:55:43][C][bme280.sensor:201]:     State Class: 'measurement'
[09:55:43][C][bme280.sensor:201]:     Unit of Measurement: '%'
[09:55:43][C][bme280.sensor:201]:     Accuracy Decimals: 1
[09:55:43][C][bme280.sensor:202]:     Oversampling: 16x
[09:55:43][C][captive_portal:088]: Captive Portal:
[09:55:43][C][web_server:169]: Web Server:
[09:55:43][C][web_server:170]:   Address: d1mini-bm280.local:80
[09:55:43][C][mdns:115]: mDNS:
[09:55:43][C][mdns:116]:   Hostname: d1mini-bm280
[09:55:43][C][ota:096]: Over-The-Air Updates:
[09:55:43][C][ota:097]:   Address: d1mini-bm280.local:8266
[09:55:43][C][ota:100]:   Using Password.
[09:55:43][C][ota:103]:   OTA version: 2.
[09:55:43][C][api:139]: API Server:
[09:55:43][C][api:140]:   Address: d1mini-bm280.local:6053
[09:55:43][C][api:144]:   Using noise encryption: NO

I see a Found no i2c devices! and a little bit later Communication with BME280 failed!

I tried also to change the “hardware” using a different D1mini and a different BME280 sensor, but I get same error.

What can I check?

Thanks

Not all BMP280 are the same. Some tend to slip from Ic2 to SPI. The answer to that is to solder CBS to Vcc. Some BMP280 default to x77. You can change the yaml to x77 or solder SDO to GND.

Thanks @Spiro

It was working until the the platform was bme280 without _i2c

I’ve tried also with x77, but I get same error

So I have to solder CBS to VCC and SDO to GND on the BME280 sensor or just one of them?

You need to assign i2c pins.

i2c:
  - id: bus_a
    sda: GPIO4
    scl: GPIO5
    scan: true

CSB to VCC on the BME280 Module.


This is from the BME280 datasheet for the little sensor. Recently my BMP280 has been doing the same as your BME. It has been running well since I connected the CSB to VCC. Follow what @Arh suggested first. SDO to GND is only to get x76 address if you needed it to be that. Assuming a 6 pin bme module.

ok, so now the code is

i2c:
   sda: GPIO4   #now is connected to D2
   scl: GPIO5   # now is connected to D1
   scan: true

sensor:
  - platform: bme280_i2c
    address: 0x77
    temperature:
      name: "BME280 Temperature"
    pressure:
      name: "BME280 Pressure"
    humidity:
      name: "BME280 Humidity"
    update_interval: 60s

and this is the soldering between CSB and VCC

IMG_20240327_122225540

but the log is full of errors like this

12:18:03][C][logger:166]: Logger:
[12:18:03][C][logger:167]:   Level: DEBUG
[12:18:03][C][logger:169]:   Log Baud Rate: 115200
[12:18:03][C][logger:170]:   Hardware UART: UART0
[12:18:03][C][i2c.arduino:059]: I2C Bus:
[12:18:03][C][i2c.arduino:060]:   SDA Pin: GPIO4
[12:18:03][C][i2c.arduino:061]:   SCL Pin: GPIO5
[12:18:03][C][i2c.arduino:062]:   Frequency: 50000 Hz
[12:18:03][C][i2c.arduino:068]:   Recovery: failed, SCL is held low on the bus
[12:18:03][I][i2c.arduino:075]: Results from i2c bus scan:
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x08
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x09
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x0A
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x0B
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x0C
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x0D
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x0E
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x0F
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x10
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x11
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x12
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x13
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x14
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x15
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x16
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x17
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x18
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x19
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x1A
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x1B
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x1C
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x1D
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x1E
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x1F
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x20
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x21
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x22
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x23
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x24
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x25
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x26
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x27
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x28
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x29
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x2A
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x2B
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x2C
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x2D
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x2E
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x2F
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x30
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x31
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x32
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x33
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x34
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x35
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x36
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x37
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x38
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x39
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x3A
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x3B
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x3C
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x3D
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x3E
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x3F
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x40
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x41
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x42
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x43
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x44
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x45
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x46
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x47
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x48
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x49
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x4A
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x4B
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x4C
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x4D
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x4E
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x4F
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x50
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x51
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x52
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x53
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x54
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x55
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x56
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x57
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x58
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x59
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x5A
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x5B
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x5C
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x5D
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x5E
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x5F
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x60
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x61
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x62
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x63
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x64
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x65
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x66
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x67
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x68
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x69
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x6A
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x6B
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x6C
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x6D
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x6E
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x6F
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x70
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x71
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x72
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x73
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x74
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x75
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x76
[12:18:03][E][i2c.arduino:083]: Unknown error at address 0x77
[12:18:03][C][restart:068]: Restart Switch 'D1 mini BM280 Restart'
[12:18:03][C][restart:070]:   Icon: 'mdi:restart'
[12:18:03][C][restart:090]:   Restore Mode: always OFF
[12:18:03][C][bme280_i2c.sensor:025]:   Address: 0x77
[12:18:03][C][bme280.sensor:182]: BME280:
[12:18:03][E][bme280.sensor:185]: Communication with BME280 failed!
[12:18:03][C][bme280.sensor:194]:   IIR Filter: OFF
[12:18:03][C][bme280.sensor:195]:   Update Interval: 60.0s
[12:18:03][C][bme280.sensor:197]:   Temperature 'BME280 Temperature'
[12:18:03][C][bme280.sensor:197]:     Device Class: 'temperature'
[12:18:03][C][bme280.sensor:197]:     State Class: 'measurement'
[12:18:03][C][bme280.sensor:197]:     Unit of Measurement: '°C'
[12:18:03][C][bme280.sensor:197]:     Accuracy Decimals: 1
[12:18:03][C][bme280.sensor:198]:     Oversampling: 16x
[12:18:03][C][bme280.sensor:199]:   Pressure 'BME280 Pressure'
[12:18:03][C][bme280.sensor:199]:     Device Class: 'pressure'
[12:18:03][C][bme280.sensor:199]:     State Class: 'measurement'
[12:18:03][C][bme280.sensor:199]:     Unit of Measurement: 'hPa'
[12:18:03][C][bme280.sensor:199]:     Accuracy Decimals: 1
[12:18:03][C][bme280.sensor:200]:     Oversampling: 16x
[12:18:03][C][bme280.sensor:201]:   Humidity 'BME280 Humidity'
[12:18:03][C][bme280.sensor:201]:     Device Class: 'humidity'
[12:18:03][C][bme280.sensor:201]:     State Class: 'measurement'
[12:18:03][C][bme280.sensor:201]:     Unit of Measurement: '%'
[12:18:03][C][bme280.sensor:201]:     Accuracy Decimals: 1
[12:18:03][C][bme280.sensor:202]:     Oversampling: 16x
[12:18:03][C][captive_portal:088]: Captive Portal:
[12:18:03][C][web_server:169]: Web Server:
[12:18:03][C][web_server:170]:   Address: d1mini-bm280.local:80
[12:18:03][C][mdns:115]: mDNS:

Why is cs connected to vcc. It says to drag cs to low for spi, just remove that connection is my guess. I have one in use and never connected cs to anything.

My BM280 has
VCC
GND
SCL
SDA
CSB
SD0

I’ve followed @Spiro suggestion, and the extract from datasheet in his message.

This is my module

It says on the link you sent

Pin 5 of the module (CSB) must be connected to Vcc to select the I²C interface. This is already done by an on-board pull-up resistor, so pin 5 can be left disconnected when using the I²C interface.

It may be this link after all. Bypassing that pull resistor may be your issue.

Now I have taken a fresh new BM280 and I have NOT connected BSC and VCC

The error message now is

BME280 has wrong chip ID! Is it a BME280?

and another message is
Found i2c device at address 0x76

The log is this:

13:33:11][C][logger:166]: Logger:
[13:33:11][C][logger:167]:   Level: DEBUG
[13:33:11][C][logger:169]:   Log Baud Rate: 115200
[13:33:11][C][logger:170]:   Hardware UART: UART0
[13:33:11][C][i2c.arduino:059]: I2C Bus:
[13:33:11][C][i2c.arduino:060]:   SDA Pin: GPIO4
[13:33:11][C][i2c.arduino:061]:   SCL Pin: GPIO5
[13:33:11][C][i2c.arduino:062]:   Frequency: 50000 Hz
[13:33:11][C][i2c.arduino:065]:   Recovery: bus successfully recovered
[13:33:11][I][i2c.arduino:075]: Results from i2c bus scan:
[13:33:11][I][i2c.arduino:081]: Found i2c device at address 0x76
[13:33:11][C][restart:068]: Restart Switch 'D1 mini BM280 Restart'
[13:33:11][C][restart:070]:   Icon: 'mdi:restart'
[13:33:11][C][restart:090]:   Restore Mode: always OFF
[13:33:11][C][bme280_i2c.sensor:025]:   Address: 0x76
[13:33:11][C][bme280.sensor:182]: BME280:
[13:33:11][E][bme280.sensor:188]: BME280 has wrong chip ID! Is it a BME280?
[13:33:11][C][bme280.sensor:194]:   IIR Filter: OFF
[13:33:11][C][bme280.sensor:195]:   Update Interval: 60.0s
[13:33:11][C][bme280.sensor:197]:   Temperature 'BME280 Temperature'
[13:33:11][C][bme280.sensor:197]:     Device Class: 'temperature'
[13:33:11][C][bme280.sensor:197]:     State Class: 'measurement'
[13:33:11][C][bme280.sensor:197]:     Unit of Measurement: '°C'
[13:33:11][C][bme280.sensor:197]:     Accuracy Decimals: 1
[13:33:11][C][bme280.sensor:198]:     Oversampling: 16x
[13:33:11][C][bme280.sensor:199]:   Pressure 'BME280 Pressure'
[13:33:11][C][bme280.sensor:199]:     Device Class: 'pressure'
[13:33:11][C][bme280.sensor:199]:     State Class: 'measurement'
[13:33:11][C][bme280.sensor:199]:     Unit of Measurement: 'hPa'
[13:33:11][C][bme280.sensor:199]:     Accuracy Decimals: 1
[13:33:11][C][bme280.sensor:200]:     Oversampling: 16x
[13:33:11][C][bme280.sensor:201]:   Humidity 'BME280 Humidity'
[13:33:11][C][bme280.sensor:201]:     Device Class: 'humidity'
[13:33:11][C][bme280.sensor:201]:     State Class: 'measurement'
[13:33:11][C][bme280.sensor:201]:     Unit of Measurement: '%'
[13:33:11][C][bme280.sensor:201]:     Accuracy Decimals: 1
[13:33:11][C][bme280.sensor:202]:     Oversampling: 16x
[13:33:11][C][captive_portal:088]: Captive Portal:
[13:33:11][C][web_server:169]: Web Server:
[13:33:11][C][web_server:170]:   Address: d1minibm280.local:80

I have changed in the code the address to 0x76 since in the first log, it found an i2c device at same address

In any case, leaving 0x77 or changing to 0x76 still no data from bme280

Screenshot 2024-03-27 alle 13.38.23

This last message gave me some doubt about the card.
Is it a BME280?
It seems it is not, it’s a BMP280, so only temp and pressure, no humidity

I changed the code and now it’s working.

sensor:
  - platform: bmp280
    address: 0x76
    temperature:
      name: "BMP280 Temperature"
    pressure:
      name: "BMP280 Pressure"
    update_interval: 60s

I’m sure that with some ESPHome version ago it was working with platform: bm280 (without i2c). And now I understand why humidity value was always at 99.9%

The card is without the CSB-VCC soldering.

Thanks all for your precious suggestions!

1 Like

I have found that on some BMP280s that pullup hasn’t been strong enough. Not all BMPs are the same quality.

Glad you found the answer yourself. I bought what I thought were BMEs a few years ago that turned out to be BMPs as well.