ESP32 running on high temperature (BME680 & Airthings BLE)

Dear community,

I have build a little sensor with ESPHome and a ESP32 board.
The ESP32 pulls data via Bluetooth from an old Airthings Wave Plus Sensor, it has its own BME680 and there are some calculations in the yaml.

The sensor is constantly running on +80°C.

I have another ESP32 doing the same thing - not having a BME680 connected to it. This one is running at <45°C.

Is there something in my code causing the high temperature in my first ESP32?

# sources:
  # https://esphome.io/components/sensor/airthings_ble
  # https://esphome.io/components/sensor/bme68x_bsec2.html



# Variablen
substitutions:
  device_name: "esphome-wohnzimmer2"
  friendly_name: "Wohnzimmer2"
  node_name: "esphome_wohnzimmer2"
  device_description: "Sensor liest den Airthings Wave Plus Sensor im Keller via Bluetooth aus und liefert Daten über den BME680"




# ESPHome Core Configuration
esphome:
  name: '${device_name}'
  friendly_name: '${friendly_name}'
  comment: '${device_description}'





esp32:
  board: esp32dev
  framework:
    type: esp-idf



# Enable logging
logger:
  level: DEBUG


# Airthings Wave Plus finden
esp32_ble_tracker:
# airthings_ble:



# Enable Home Assistant API
api:
  encryption:
    key: "jUtVnnbFyUy/m0="

ota:
  - platform: esphome
    password: "e760e7e15d1c"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  min_auth_mode: WPA2
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.30.26
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.30.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0
    dns1: 192.168.0.5
    dns2: 192.168.30.1
  use_address: ${device_name}.internal
  domain: .internal




  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: '${device_name}'
    password: !secret ap_password
    ap_timeout: 5min  # AP schaltet sich nach 5 Minuten ab

captive_portal:



# Zeit von HomeAssistant abfragen -> für Last Boot nötig
time:
  - platform: homeassistant
    id: homeassistant_time
    on_time_sync:
      then:
        - lambda: |-
            auto now = id(homeassistant_time).now();
            auto uptime = (int) id(${node_name}_uptime_seconds).state;

            ESP_LOGD("last_boot", "Zeit synchronisiert. Aktuelle Zeit: %d, Uptime: %d", now.timestamp, uptime);

            if (!now.is_valid()) {
              ESP_LOGE("last_boot", "Fehler: Zeit ist ungültig.");
              return;
            }

            if (uptime <= 0) {
              ESP_LOGW("last_boot", "Warnung: Uptime ist noch 0 Sekunden.");
              return;
            }

            id(${node_name}_last_boot_time).publish_state(now.timestamp - uptime);
            ESP_LOGI("last_boot", "Last Boot wurde erfolgreich gesetzt.");



switch:
  - platform: restart
    name: "ESPHome '${friendly_name}' neu starten"




# Airthings Wave Plus einbinden
ble_client:
  - mac_address: A4:DA:32:B9:5A:A5
    id: awp_Keller


# i2c-config für BME680-Sensor
i2c:
  sda: GPIO21
  scl: GPIO22
  scan: false
  id: bus_a


# external_components:
#  - source: github://pr#7728
#    components: [ bme68x_bsec2 ]


bme68x_bsec2_i2c:
  address: 0x77
  model: bme680
  operating_age: 28d
  sample_rate: ULP
  supply_voltage: 3.3V
  temperature_offset: 1.1    # dieser Wert wird abgezogen
  state_save_interval: 6h



sensor:

  # Airthings Wave Plus Keller
  - platform: airthings_wave_plus
    ble_client_id: awp_Keller
    update_interval: 5min # default
    battery_update_interval: 24h # default
    temperature:
      name: "Keller Temperatur"
      id: awp_Keller_temp
      accuracy_decimals: 1
    radon:
      name: "Keller Radon"
      id: awp_Keller_Radon
    radon_long_term:
      name: "Keller Radon Long Term"
      id: awp_Keller_Radon_long
    pressure:
      name: "Keller Luftdruck"
      id: awp_Keller_pressure
    humidity:
      name: "Keller Feuchtigkeit"
      id: awp_Keller_humidity
    co2:
      name: "Keller CO2"
      id: awp_Keller_co2
    tvoc:
      name: "Keller VOC"
      id: awp_Keller_voc
    illuminance:
      name: "Keller ambient light"
      id: awp_Keller_light
    battery_voltage:
      name: "Keller Batterie Spannung"
      id: awp_Keller_volt



  # Airthings Wave Plus Keller: Batterieanzeige in %
  - platform: copy
    source_id: awp_Keller_volt
    name: 'Keller Battery Level'
    id: awp_Keller_battery
    unit_of_measurement: "%"
    device_class: battery
    accuracy_decimals: 0
    filters:
      - calibrate_linear:
        - 2.2 -> 0
        - 3.1 -> 100



# Airthings Wave Plus Keller: Taupunkt berechnen 
  - platform: template
    name: "Keller Taupunkt"
    lambda: |-
      return (243.5*(log(id(awp_Keller_humidity).state/100)+((17.67*id(awp_Keller_temp).state)/
      (243.5+id(awp_Keller_temp).state)))/(17.67-log(id(awp_Keller_humidity).state/100)-
      ((17.67*id(awp_Keller_temp).state)/(243.5+id(awp_Keller_temp).state))));
    device_class: temperature
    state_class: measurement
    unit_of_measurement: °C
    update_interval: 5min
    icon: 'mdi:thermometer-water'



  # Konfiguration für BME680 Sensor
  - platform: bme68x_bsec2
    temperature:
      name: "BME680 Temperature"
      id: bme680_temp
#      filters:
#        - offset: -0.9
    pressure:
      name: "BME680 Pressure"
      accuracy_decimals: 0
    humidity:
      name: "BME680 Humidity"
      id: bme680_humidity
      accuracy_decimals: 0
      filters:
        - offset: -5
    iaq:
      name: "BME680 IAQ"
      id: iaq
    co2_equivalent:
      name: "BME680 CO2 Equivalent"
      accuracy_decimals: 0
    breath_voc_equivalent:
      name: "BME680 Breath VOC Equivalent original"
      id: voc_source
      internal: false



  - platform: template
    name: "BME680 Breath VOC Equivalent"
    id: BME680_voc_calc
    lambda: |-
      return ( (id(voc_source).state) * 1000) ;
    device_class: volatile_organic_compounds_parts
    state_class: measurement
    unit_of_measurement: ppb
    accuracy_decimals: 0
    update_interval: 5min
    icon: 'mdi:molecule'


# BME680 Wohnzimmer: Taupunkt berechnen 
  - platform: template
    name: "BME680 Taupunkt"
    lambda: |-
      return (243.5*(log(id(bme680_humidity).state/100)+((17.67*id(bme680_temp).state)/
      (243.5+id(bme680_temp).state)))/(17.67-log(id(bme680_humidity).state/100)-
      ((17.67*id(bme680_temp).state)/(243.5+id(bme680_temp).state))));
    device_class: temperature
    state_class: measurement
    unit_of_measurement: °C
    update_interval: 5min
    icon: 'mdi:thermometer-water'




  # Last Boot Sensor definieren (Berechnung findet einmalig beim Boot statt)
  - platform: uptime
    id: ${node_name}_uptime_seconds
    name: "Uptime Sekunden"
    internal: true

  - platform: template
    name: "Last Boot"
    id: ${node_name}_last_boot_time
    device_class: timestamp
    entity_category: diagnostic
    accuracy_decimals: 0
    update_interval: never # Kein regelmäßiges Update nötig


  - platform: internal_temperature
    name: "interne Temperatur"




text_sensor:
  - platform: bme68x_bsec2
    iaq_accuracy:
      name: "BME680 IAQ Accuracy"
  
  
  # Air Quality-Angaben
  - platform: template
    name: "BME680 IAQ Classification"
    update_interval: 5min
    lambda: |-
      if ( int(id(iaq).state) <= 50) {
        return {"extrem gut"};
      }
      else if (int(id(iaq).state) >= 51 && int(id(iaq).state) <= 100) {
        return {"sehr gut"};
      }
      else if (int(id(iaq).state) >= 101 && int(id(iaq).state) <= 150) {
        return {"gut"};
      }
      else if (int(id(iaq).state) >= 151 && int(id(iaq).state) <= 200) {
        return {"mittelmässig"};
      }
      else if (int(id(iaq).state) >= 201 && int(id(iaq).state) <= 250) {
        return {"schlecht"};
      }
      else if (int(id(iaq).state) >= 251 && int(id(iaq).state) <= 350) {
        return {"sehr schlecht"};
      }
      else if (int(id(iaq).state) >= 351) {
        return {"extrem schlecht"};
      }
      else {
        return {"Fehler"};
      }



  # Send IP Address of ESP-device
  - platform: wifi_info
    ip_address:
      name: IP Address

Any help is very much appreciated!

Comment out the BME component to see what effect it has.
Also, those temp sensors are not calibrated, neither linear, so the real temps can be different. Thermal dissipation of your boards might be different, poor wireless connection can raise temp and so on…

@Karosm

Thank you for your input. Wireless signal is at -65DB on the hot board, the other one is at -40DB. This might have an effect.

I have done two things:

esp32_ble_tracker:
  scan_parameters:
    # interval: 1100ms
    # window: 300ms
    active: false

I have changed the BLE-scanning to passive mode. This should reduce communication and reduce temperature? I did not yet change interval and window, as I am not sure, if this is really necessary?

I have changed the timing of the Airthings sensors to 330s. Until now, it was all on 300s. Perhaps this helps to distribute computation power needed…

I will keep an eye on the temperature development and report back in a couple of days.

I doubt it, if the radio is not doing BLE, it’s doing wifi…
Setting logger to warn level might have effect also.

My new settings did have no effect. The temperature is still the same.

I will reduce the log level, but have not much hope that it will change something.

So, I keep it as is and hope, the ESP does not burn down our house… :fire: :fire_extinguisher:

Did you check the actual temperature on the board, using a infrared thermometer or similar or can you feel the heat when getting close with your hand? Don’t touch if it is really >80°C :slight_smile:
Just in case the internal sensor does not work correctly or reports values in °F…

Hi @armin-gh,
thank you for the input. The board feels warm and when I designed the casing for it, I had to do 3 versions, because the heat from the board did impact measurement from the BME680…

The other ESP32 does not feel that warm, but there is no other sensor connected. It is only used as a bluetooth bridge.

I do have an infrared thermometer and I have measured both my ESP32: both boards have temperature between 20°-40°C, depending on which part of the board I take measurement. So much for “feeling the difference”… :see_no_evil:

Well, I don’t know, where on the board the internal temperature sensor is located. From what I can see, both ESP32 are radiating heat, but are not that different from each other. If the temperature is really 80°C somewhere, I can’t measure it on the surface of the board. :+1:

@Karosm is probably right: those sensors are not helpfull and probably only usefull to find sudden changes in temperature. Absolut values are missleading.

Sensor is measuring die temperature inside the chip, not any surface temp.
As long as the chip can dissipate heat out through PCB and directly from it’s surface, I’m pretty sure it doesn’t cause issues.