D1 mini and BME280 help

I am new user of ESPHome in home assistant. My first project is a temp, humidity, and pressure sensor with BME280 and a demos D1 mini.

I have connected it like this
G-GND
D1-SCL
D2-SDA
3V3-VCC

This is the config:

esphome:
  name: temperatur-fuktighet

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "35e5ee6c011fd9dae685d4ba3bsdawbdf34a"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Temperatur-Fuktighet"
    password: "qVtPg4udwewfSg6jWFP"

captive_portal:
 
i2c:
#  sda: 21
#  scl: 22
  scan: true
  id: bus_a
   
sensor:
  - platform: bme280
    temperature:
      name: "Temperature"
      oversampling: 16x
    pressure:
      name: "Pressure"
    humidity:
      name: "Humidity"
    update_interval: 60s
    i2c_id: bus_a
    address: 0x76
    

I recived this error when i install det sensor:

[I][i2c.arduino:054]: Results from i2c bus scan:
[I][i2c.arduino:056]: Found no i2c devices!
[C][bme280.sensor:143]: BME280:
[C][bme280.sensor:144]:   Address: 0x76
[E][bme280.sensor:147]: Communication with BME280 failed!

Can anyone help to find a solution

Try

i2c:
    sda: D1
    scl: D2
    scan: true

Sorry, next to impossible to type this on phone. Looks like you have commented out sda and scl.
Also don’t think you need the line
i2c_id: bus_a in the sensor section.

I think Spiro is right, except that scl and sda should be reversed. scl: D1, sda: D2

1 Like

Yes I think I changed them round on my wemos. Can’t remember why I did that.:thinking:

I am getting the same error in log. Now i am trying this:

 
i2c:
    sda: D1
    scl: D2
    scan: true
   
sensor:
  - platform: bme280
    temperature:
      name: "BME280 Temperature"
      oversampling: 16x
    pressure:
      name: "BME280 Pressure"
    humidity:
      name: "BME280 Humidity"
    address: 0x77
    update_interval: 60s  ```
1 Like

Try “address: 0x76”! Some of my BME280 have “0x76”, others “0x77”…

3 Likes

Have you kept sda as D1 or D2 as @DelfuegoNL pointed out I had them the wrong way around?

Hello ,

Have you been able to resolve it?
I am facing the same thing since a while…

Thanks!

Hopefully, this will help you. One way that I test my BMP280 is that I keep it simple, at the start, and only test the temperature section. I also like to use relays in order to test some output pins. You can easily come back and add the pressure sensor. I learned many years ago to keep my variable’s to a minimum… and that was “before” computer programming variables came along. :wink:

esphome:
  name: wemos-test

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "test"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "wemos-test"
    password: "test"

captive_portal:

i2c:
  sda: D2  # GPIO4 - Pin numbers aren't always required but I use them.
  scl: D1  # GPIO5
  scan: False  # Removing another variable. The scan feature.

sensor:
  - platform: bmp280
    temperature:
      name: "Heat-Sensor"
    address: 0x76  # possibly 0x77. I don't depend on scan.

#  Test the above code first and then add this lower section if you want to test some output pins.

switch:
  - platform: gpio
    pin: D6
    name: "RelayD6"
    id: RelayD6
    
  - platform: gpio
    pin: D7
    name: "RelayD7"
    id: RelayD7
    
  - platform: template
    name: "Heat Mode"
    id: Heat_Mode
    turn_on_action:
      - then:
        - switch.turn_on: RelayD6
        - switch.turn_on: RelayD7
        - switch.template.publish:
            id: Heat_Mode
            state: ON
    turn_off_action:
      - then:
        - switch.turn_off: RelayD6
        - switch.turn_off: RelayD7
        - switch.template.publish:
            id: Heat_Mode
            state: OFF

Here is some more useful information for anyone starting out with the BMP280 and D1 Mini.

And here is a link showing how you can change the address on the sensor board, if needed.

https://startingelectronics.org/pinout/GY-BMP280-pressure-sensor-module/

Good luck!

1 Like

Using the pin numbers and not the “Dx” number works for me.

# sda, pin GPIO4, D2
# scl, pin GPIO5, D1
i2c:
  sda: 4
  scl: 5
  scan: true
  id: bus_a

Sush! Dont disturb the dead.

You all wouldn’t need to figure out and or share a “working solution” if you all just read the documentation first because, thats the exact same thing configuration as the example in the documentation… You all would make it much easier for yourselves.

1 Like