ESP devices keeps rebooting after a while

Hi everyone,
I have 2 ESP devices, hardware the same (ESP WROOM 32 with a BH1750 lux sensor), and configuration almost the same (one retrieves data from my MiScale) and I see that they keep rebooting from time to time and I am trying to understand if it is my fault (bad configuration probably or not use of the best/correct SDK) or it is something we should make peace with :slight_smile:
By the way, both work well, they do Bluetooth proxy (for this purpose I know there are better frameworks to use), they send lux data and one sends the scale data.


Here the code:

esphome:
  name: Two

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging VERY_VERBOSE
logger:
  #level: VERBOSE

# Enable Home Assistant API
api:
  encryption:
    key: ""

ota:
  password: ""

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: !secret hotspot2_ssid
    password: !secret hotspot_password

captive_portal:

# Example configuration entry for finding
esp32_ble_tracker:
  scan_parameters:
    duration: 2min
    interval: 1100ms
    window: 1100ms
    active: true

# Bluetooth Proxy
bluetooth_proxy:
  active: true

i2c:
  sda: 18
  scl: 5
  scan: true
  id: bus_a

sensor:
  - platform: bh1750
    name: "Esp2 Light Sensor"
    address: 0x23
    update_interval: 30s

  - platform: uptime
    name: Uptime Sensor Two

Thank you all in advance for any advice :slight_smile:
Michele

I’ve had stability issues using this alongside other sensors, like this issue.

So you could try disabling/comment out either the ble or other sensors and see if stability improves to help confirm if this is the cause.

I now run my ble scanners as dedicated devices and don’t load them up any more. My understanding is the ble library is resource intensive.

These settings also look unconventional too. Is there a reason you’re using them? Some people misunderstand how they work and the defaults should be fine for typical use cases.

I don’t use Bluetooth proxy so not sure about that.

1 Like

I think the solution would be to move from the arduino framework to the esp-idf as it is suggested in the man page of Bluetooth tracker, but I actually don’t know how to convert my Yaml file for the other framework.
The settings are very similar to those suggested in the documentation, so nothing special. I’ve tried to comment the esp32_ble_tracker part but leaving the bluetooth_proxy enable again the tracker, it is a requirement.
I’ll make some test disabling other services, but if anyone knows how to convert my yaml file for the esp-idf framework, I would really appreciate.
Best, M.

Take a look around here.

The documentation is missing, or I am looking in the wrong place, the part for high-level programming, like in yaml file, as I use and posted in my previous post. I translated a part of my yaml file using ChatGPT but I still miss some parts that seem to be written in other ways than the Arduino framework. :sweat_smile:

Not sure I exactly get what you mean.

But if you want to change framework type from Arduino to esp-idf, the only thing you typically need to do is change this bit, like what I linked to above. ESPHome handles the rest for you.

  framework:
    type: esp-idf

I started from there but errors came up because the two framework doesn’t support the same elements and syntax. Anyway, now I reduced to the minimum my configuration to try to use the other framework but in the end, it doesn’t work, it fails to compile with an error that is known and there is a bug open (ESP32-IDF framework fails to compile on ARMv7 · Issue #3076 · esphome/issues · GitHub), so now I don’t know what to do.
Following my actual configuration that fails:

esphome:
  name: esp-two

esp32:
  variant: ESP32
  board: esp32dev
  framework:
    type: esp-idf
    #type: arduino

# Enable logging VERY_VERBOSE
logger:
  #level: VERBOSE

# Enable Home Assistant API
api:
  encryption:
    key: "here is my key"

ota:
  password: "here is my passwd"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: !secret hotspot2_ssid
    password: !secret hotspot_password

I think it is the minimum configuration but maybe it isn’t the configuration that is the problem since there is that bug open. I am on a Raspberry Pi 3b+ and with the framework Arduino the compilation and installation work well. Any suggestions are welcome :slight_smile:

Now I’m trying with the specific version of the libraries, as suggested in the bug report:

esphome:
  name: esp-two
  platformio_options:
    platform_packages:
     - framework-espidf @ 3.40300.0

esp32:
  board: esp32dev
  framework:
    type: esp-idf
    #type: arduino
    platform_version: 3.4.0

It takes time, will see if it resolves the problem.

No, it doesn’t compile. I’ve tried to change the version of Esphome too (dev and beta) but nothing has changed. It is not possible to use the esp-idf framework, at least with my Rpi (3b+).

Anyone figure this out? I have a couple Expriessif devices that seem to keep rebooting every few minutes when on my IoT VLAN with MDNS. once I create a separate isolated vlan they are stable.