Arduino or esp-idf framework - Which to use if both work?

According to chatgpt:

:white_check_mark: ESP-IDF Framework (Espressif’s official SDK)

:heavy_check_mark: Pros:

  • More efficient: Smaller firmware binaries, better performance, and faster boot times.
  • Better OTA performance: Particularly on ESP32 devices.
  • Advanced features: Supports features like:
    • BLE (Bluetooth Low Energy)
    • PSRAM
    • Improved power management
  • Closer to the metal: Gives more precise control over hardware.

:x: Cons:

  • :exclamation: Limited compatibility: Not all ESPHome components support ESP-IDF yet.
  • :warning: More complex bugs: If something doesn’t work, debugging is often harder.
  • :test_tube: Less tested: Some sensors, displays, or integrations may not yet work with ESP-IDF.
  • :no_entry_sign: ESP8266 not supported: ESP-IDF is only for ESP32 and newer.

So if both work, is it better to always use esp-idf? Or is there some reason to prefer arduino framework?

You know that the “training” that AI has on esphome related stuff is limited and it appears to have the ability of a teenager to make stuff up that sounds convincing to someone that knows less about these things.

The esphome official documents says to use ESP-IDF for esp32 device variants especially the newer ones, but offered no explanation of WHY.

Over months I believe I have a better understanding of the why (support). Ultimately it depends on your needs. The latest edition of esphome includes a newer version of the Arduino core. This is proving challenging for some configurations. So many are saying use ESP-IDF.

Bottom line, unless you have a VERY good reason to do otherwise it is a good idea to follow the recommendations of the project you are using.

ESP-IDF framework¶
This is an alternative base framework for ESP32 chips; it is recommended for variants of the ESP32 like ESP32S2, ESP32S3, ESP32P4 and single-core ESP32 chips.

1 Like

I think the answer is pretty straight forward - there’s no dilema for 8266, but for ESP32 if you can use esp-idf. Use arduino only if some component you want to use doesn’t work in esp-idf (yet)

Particularly… :joy:

Thanks all for helpful guidance!
I was using ‘arduino’ out of habit and maybe that was coming back to bite me as I was having a lot of crashes with recent upgrades of esphome.

Hm… i don’t think arduino is the culprit for your crashes. I have quite some of my modules still on arduino and all work perfectly.

Well, switchin to esp-idf did help things – I think the issue was tight memory which apparently esp-idf does more efficiently – both flash and RAM

2 Likes

Hm… on the link above there’s no i2s audio in unsupported list, but it is… if i want to set esp-idf compiler says that i2s_audio is not supported in esp-idf…?

Here is the link to edit the page esphome-docs/content/guides/esp32_arduino_to_idf.md at bdf8489611d30dd5219faeb617b5e45532f7f5a2 · esphome/esphome-docs · GitHub

1 Like