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).
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.
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.
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 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
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.
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!
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.