logo elektroda
logo elektroda
X
logo elektroda

Enabling BMP280 driver in openESP8266/openESP32 custom binary build

gandi69 204 14
ADVERTISEMENT
  • #1 21884315
    gandi69
    Level 2  
    Hi Im trying to enable BMP280 driver into - openESP8266 and possible openESP32 - can anyone shed any light on what i need to do here or even provide with those added?
    I believe i need to compile my own binary somehow but am struggling with the compile on github
  • ADVERTISEMENT
  • #2 21884334
    insmod
    Level 31  
    There was some problem with BMP280 driver on ESPs, if i remember it correctly.
    Try BMPI2C driver, it supports BMP280 as well. And it's already enabled on OpenESP32.
  • #3 21884337
    gandi69
    Level 2  
    ive got an ESP32 here ill try it on that - so I just need to use SoftSCL/SDA on the necessary pins and it should work?
  • #4 21884346
    insmod
    Level 31  
    No, pins need to be specified in startdriver command. You can specify either index or just pin name (like IO1).
    // startDriver BMPI2C 8 14 1 2 3 0
    // startDriver BMPI2C [CLK] [DATA] [ChannelForTemp] [ChannelForPressure] [ChannelForHumidity] [Addr]
    // Adr8bit 0 for 0x77, 1 for 0x76
  • ADVERTISEMENT
  • #5 21884351
    gandi69
    Level 2  
    >>21884346

    Tried that just on an ESP32-C3-Mini - starting driver like you outlined below makes the ESP crash/restart.

    startDriver BMPI2C 8 14 1 2 3 0

    Added after 2 [minutes]:

    >>21884351

    Reboot reason: 5 - ESP_RST_INT_WDT
  • #6 21884363
    insmod
    Level 31  
    That was just an example. IO14 on C3 - one of flash pins, so crash is expected.
    If you use other pins (like 1 2), you would get
    Info:MAIN:Starting BMPI2C.
    Warn:SENSOR:No sensor detected on selected address!
    Warn:SENSOR:No sensor detected on alternative address, check wiring!
    Error:SENSOR:BMPI2C failed!
    Info:MAIN:Started BMPI2C.
    Info:CMD:[WebApp Cmd 'startDriver BMPI2C 1 2 1 2 3 0' Result] OK
    
  • ADVERTISEMENT
  • #7 21884364
    gandi69
    Level 2  
    I have just tried this on another ESP32 (a 4mb version) and as soon as you type StartDriver BMPI2C in console
    it restarts/crashes.

    I will continue to try this and have a mess around with it though

    and see what pins I can get worked. Long shot here - is there any support for the Gravity AS3935 lightning sensor?
  • #8 21884367
    insmod
    Level 31  
    If used without arguments, pins defaults to 8 and 14. And like i said earlier, IO14 can't be used on C3.
    AS3935 is not supported. And i doubt it would ever be.
  • #9 21884374
    gandi69
    Level 2  
    ok ill have to look for another way to use one of those then,

    I have my BMP280 on pins 21 (SDA) and 22 (SCL) so what would my start up command be? its a 4 pin sensor (just power and ground and sda/scl)

    startDriver BMPI2C 21 22 1 2 3 0 ?
  • ADVERTISEMENT
  • #10 21884388
    insmod
    Level 31  
    SCL goes first, then SDA.
    So it would be startDriver BMPI2C 22 21 1 2 3 0
  • #11 21884391
    gandi69
    Level 2  
    Ok ive tried that command and get this:

    Info:MAIN:Starting BMPI2C.
    Warn:SENSOR:No sensor detected on selected address!
    Warn:SENSOR:Detected sensor on alt address, id: 0x58, edit conf!

    so it can see something but even I change the end zero to 1 i get the same message?

    Ok i think im getting somewhere now!

    StartDriver BMPI2C 22 21 0 2 3 1

    now to see if I can make this work on the C3 mini so I can put the as3935 back on this bigger esp32. Is DHT11 supported on ESP8266 do you know? thats my next step.
  • #12 21884397
    insmod
    Level 31  
    Well, DHT driver is disabled. But i remember that it worked.
  • #13 21884398
    gandi69
    Level 2  
    insmod wrote:
    r is disabled. But i remember that it worked.

    >>21884397

    Do i need a custom binary to enable it?
  • #14 21884401
    insmod
    Level 31  
    >>21884398
    In your PR (https://github.com/openshwprojects/OpenBK7231T_App/pull/2090)
    Just replace ENABLE_DRIVER_BMP280 with ENABLE_DRIVER_BMPI2C
    And you've already enabled DHT.
  • #15 21884402
    gandi69
    Level 2  
    excellent thanks, I really appreciate the help. This will enable me to swap out my tasmota based 8266 sensors to open8266 as Home Assistant has decided it doesnt like writing tasmota sensor data to influxdb anymore!

    Added after 2 [hours] 31 [minutes]:

    >>21884401

    I cant seem to get DHT11 working on ESP8266 just will not detect the sensor. At least I can make them work on ESP32 so ill replace all the 8266 I have with esp32 now

    Added after 6 [hours] 13 [minutes]:

    Added after 35 [seconds]:


    Managed to get two esp32s working with openESP32 and their bmp280 sensors however they dont present the sensor info to home assistant now i've added them to homeassistant via mqtt. All i see is chip temps and wifi name/signal values via MQTT. Any ideas what I need to change to get the temp sensor info into HA?

Topic summary

✨ Discussion about enabling the BMP280 sensor driver in custom openESP8266/openESP32 builds. The suggested workaround was to use the BMPI2C driver, which also supports BMP280 and is already enabled on OpenESP32. Usage requires specifying I2C pins in the startDriver command, with SCL first and SDA second; default pins are 8 and 14, but these can cause crashes on ESP32-C3 because IO14 is a flash pin. Example commands were provided for different pin mappings, and sensor detection messages indicated alternate I2C address handling (0x77/0x76). It was also noted that AS3935 is not supported, DHT support is disabled in the build but can be enabled by replacing ENABLE_DRIVER_BMP280 with ENABLE_DRIVER_BMPI2C in the PR, and DHT was reported as already enabled in that context. Later testing confirmed BMP280 operation on ESP32, while DHT11 detection on ESP8266 failed and MQTT/Home Assistant integration only exposed chip and Wi‑Fi data, not the BMP280 sensor readings.
Generated by the language model.

FAQ

TL;DR: If you have a 4-pin BMP280 and want it working fast, use BMPI2C, not the BMP280 driver. One expert reply said, "SCL goes first, then SDA." For openESP32 users, this solves custom-build confusion, pin-order mistakes, and address-selection issues when bringing BMP280 data online over MQTT. [#21884401]

Why it matters: This thread shows that most BMP280 setup failures came from using the wrong driver, the wrong pin order, or the wrong I2C address.

Option Status in thread Best use Main risk
BMP280 driver Reported as problematic on ESP devices Only if you specifically rebuild for it Driver issues on ESPs
BMPI2C Already enabled on openESP32 BMP280 over I2C Wrong pins or wrong address
AS3935 Not supported Use another method No planned support

Key insight: The thread’s main fix was simple: replace ENABLE_DRIVER_BMP280 with ENABLE_DRIVER_BMPI2C, then start BMPI2C with the correct SCL-first pin order and the matching 0x76/0x77 address setting. [#21884401]

Quick Facts

  • BMPI2C is already enabled on openESP32, while the BMP280 driver was described as having problems on ESP devices. [#21884334]
  • The BMPI2C startup syntax shown in the thread is startDriver BMPI2C [CLK] [DATA] [TempChannel] [PressureChannel] [HumidityChannel] [Addr]. [#21884346]
  • The address flag is binary: 0 means 0x77, and 1 means 0x76 for the BMP280-compatible BMPI2C setup. [#21884346]
  • A 4-pin BMP280 wired on GPIO21 SDA and GPIO22 SCL should be started with SCL first, so the tested command order became 22 21, not 21 22. [#21884388]
  • On ESP32-C3, using default or example pins such as IO14 can trigger a reboot because that pin is tied to flash use in this context. [#21884363]

How do I enable BMP280 support in an openESP8266 or openESP32 custom binary build?

Enable BMPI2C instead of the BMP280 driver in your build config. The thread’s fix was to replace ENABLE_DRIVER_BMP280 with ENABLE_DRIVER_BMPI2C in the PR, because BMPI2C supports BMP280 and was the working path discussed for openESP32. That means you do not keep chasing the older BMP280 driver if your goal is simply to read a BMP280 sensor. [#21884401]

Why is the BMP280 driver problematic on ESP devices, and when should I use the BMPI2C driver instead?

Use BMPI2C when you want BMP280 support on these ESP builds. One reply states there was “some problem with BMP280 driver on ESPs,” and immediately recommends BMPI2C because it also supports BMP280 and is already enabled on openESP32. In this thread, BMPI2C was the practical workaround, not the standalone BMP280 driver. [#21884334]

What is the BMPI2C driver in openESP32, and how does it support BMP280 sensors?

“BMPI2C” is an I2C sensor driver that starts from a console command, maps readings to channels, and can handle BMP280 sensors through selectable I2C addresses. In this thread, it was presented as the supported alternative to the problematic BMP280 driver and was already enabled on openESP32. [#21884346]

How exactly do I use the startDriver BMPI2C command with SCL, SDA, channel numbers, and address settings?

Use startDriver BMPI2C [CLK] [DATA] [Temp] [Pressure] [Humidity] [Addr]. 1. Put SCL first and SDA second. 2. Assign channel numbers for temperature, pressure, and humidity. 3. Set the last value to 0 for 0x77 or 1 for 0x76. The example shown was startDriver BMPI2C 8 14 1 2 3 0. [#21884346]

Why does startDriver BMPI2C make an ESP32-C3-Mini crash or reboot with ESP_RST_INT_WDT?

It crashed because the example used IO14 on an ESP32-C3, and that pin was identified as one of the flash pins. The reply said the crash was expected in that case, so the reset was tied to invalid pin choice, not proof that BMPI2C itself was unusable on ESP32-C3 hardware. [#21884363]

Which GPIO pins should I avoid for BMPI2C on an ESP32-C3, especially when IO14 is tied to flash?

Avoid IO14 on the ESP32-C3 in this setup. The thread explicitly says IO14 is one of the flash pins, and using the default or example 8 14 pair on a C3 caused the reboot behavior the user saw. Use other pins instead of copying the example blindly. [#21884363]

What is ESP_RST_INT_WDT, and what does that reboot reason usually mean on an ESP32?

In this thread, ESP_RST_INT_WDT was the reboot reason shown immediately after a bad BMPI2C pin setup on an ESP32-C3-Mini. Practically, it marked a watchdog-triggered reset during startup, and the discussion tied it to using IO14, which was said to be a flash pin on that board. [#21884351]

How should I wire a 4-pin BMP280 to an ESP32 on pins 21 and 22, and what is the correct BMPI2C startup command?

Wire the 4-pin BMP280 with SDA on 21 and SCL on 22, then enter SCL first in the command. The correct order is therefore startDriver BMPI2C 22 21 1 2 3 0 if you are testing address flag 0. The thread corrected 21 22 to 22 21 explicitly. [#21884388]

Why does openESP32 report 'No sensor detected on selected address' but then detect a BMP280 on the alternative address with id 0x58?

That message means the driver did not find the sensor at the first address choice, then found it at the alternate I2C address. In the thread, the user saw Detected sensor on alt address, id: 0x58, edit conf!, and switching the final address parameter from 0 to 1 was the next step that moved the setup forward. [#21884391]

How do I choose the last BMPI2C address parameter for a BMP280 using 0x76 versus 0x77?

Choose the last parameter by the sensor’s I2C address: use 0 for 0x77 and 1 for 0x76. That mapping was stated directly in the command example, so address selection is not guessed from the pinout alone. You change only the last value when testing the alternate address. [#21884346]

What do the BMPI2C channel parameters mean, and how should I map temperature, pressure, and humidity channels for a BMP280?

They assign where each reading is published: one channel for temperature, one for pressure, and one for humidity. The thread’s working examples used 1 2 3, so temperature went to channel 1, pressure to channel 2, and humidity to channel 3. For a BMP280, that still follows the driver’s command format even though the sensor focus is temperature and pressure. [#21884346]

BMPI2C vs BMP280 driver in openESP32 — which is better to use for BMP280 sensors and why?

BMPI2C was the better choice in this thread. It already existed in openESP32, it supports BMP280, and it was recommended specifically because the standalone BMP280 driver had known issues on ESP devices. For this exact build path, BMPI2C was the working recommendation, not a theoretical alternative. [#21884334]

How do I modify my GitHub PR or build config to replace ENABLE_DRIVER_BMP280 with ENABLE_DRIVER_BMPI2C and enable DHT at the same time?

Edit the PR so it uses ENABLE_DRIVER_BMPI2C instead of ENABLE_DRIVER_BMP280. The reply also says DHT had already been enabled in that same PR, so the requested change was only the driver-name swap. That keeps BMP280 support on the BMPI2C path while leaving DHT enabled. [#21884401]

What support or alternatives are available for the Gravity AS3935 lightning sensor in openESP32 or openESP8266?

There is no support for the Gravity AS3935 in this thread’s openESP32 or openESP8266 context. The answer was direct: “AS3935 is not supported,” followed by doubt that it would ever be supported. If you need that lightning sensor, the thread points you toward another method or platform. [#21884367]

How do I get BMP280 temperature and pressure readings from openESP32 to appear in Home Assistant over MQTT instead of only chip temperature and Wi-Fi stats?

This thread does not provide a confirmed fix for Home Assistant MQTT discovery. The user reported two ESP32 units working with BMP280 sensors, but Home Assistant only showed chip temperature and Wi‑Fi name or signal values, and no reply in the provided posts explained what to change next. The unresolved state is the key fact here. [#21884402]
Generated by the language model.
ADVERTISEMENT