logoalt Hacker News

ESP32-C6 Power Consumption: Arduino vs. Zephyr vs. ESP-IDF Comparison

38 pointsby hasheddanlast Saturday at 6:27 PM9 commentsview on HN

Comments

gsliepentoday at 9:06 AM

> execute instructions faster (via -O3)

One problem with -O3 is that it disregards any effects of the cache (and yes, ESP32s have a bit of cache memory). I recommend using -Os as the default optimization level, as it often has the same or almost the same performance benefits as -O3. Less cache pressure is beneficial, especially for bigger applications, and the smaller code size is of course nice on embedded systems that have limited amounts of flash storage. If you know some specific functions or source files are performance sensitive, you can use pragmas to change optimization for those:

    #pragma GCC optimize("O3")
See https://gcc.gnu.org/onlinedocs/gcc/Function-Specific-Option-.... Clang has a similar pragma, see https://clang.llvm.org/docs/LanguageExtensions.html#extensio....
maufltoday at 11:06 AM

I did something similar, but less scientific, comparing ESP-IDF and esp-hal (Rust). Unfortunately I learned that the optimizations that are already in ESP-IDF (most of all automatic light sleep between BLE advertisments) are hard to replicate in Rust/esp-hal/embassy and so for battery powered devices you might want to stick to C++/ESP-IDF

dlcarrierlast Sunday at 4:16 AM

    It highlights that an idle loop in Arduino is energetically detrimental.
That's not particularly uncommon. Many compilers or OSes default to wait loops when there's nothing to do, and they can be pretty power hungry.
show 2 replies
retSavatoday at 10:28 AM

As an off-topic remark, I've used the qoitech arc power analyzer quite a bit and it's quite nice and easy to use, when your DUT is <5V and low amps. There's also the Nordic PPK2 kit, which is cheaper but I haven't tried it. Both are aiming at the crowd that prefers a simple, handles-most-use-cases, little USB-connected box that runs the client on your computer, rather than a separate bulky thing with screen and whatnot. Trade-offs of course though.

nottorptoday at 11:06 AM

... but then if you really need to save power you don't use a dev board, or at least disable the parts you don't need on boot and desolder some leds?

SuperMousetoday at 10:05 AM

ESP32 never was good for any powersaving applications.

snvzztoday at 9:05 AM

As of the recent launch of the ESP32-S31, all the ESP32 product lines have been migrated to RISC-V.

Unsurprisingly, the old, non-standard, encumbered architecture is not missed.