Skip to content

ESP32 vs STM32

When to use one and when to use the other in an embedded project

If you’ve started venturing into the world of embedded systems and the IoT, sooner or later you’ll have faced this dilemma: ESP32 or STM32?

Both are powerful, widely used microcontrollers backed by active communities. They are very different, designed for different contexts. Choosing the wrong one doesn’t necessarily mean your project will fail, but it does mean twice the effort — and often you’ll only realise it too late.

In this article, we’ll guide you through the key differences, with practical criteria to help you make the right choice.

First of all: what are we talking about?

The ESP32 is a System-on-Chip (SoC) manufactured by Espressif Systems. It has connectivity built right into its DNA: Wi-Fi and Bluetooth are integrated on-chip, not added as afterthoughts. It is affordable, has a huge community, and is easy to programme using either the Arduino IDE or MicroPython. For many, it is the gateway to the world of IoT.

STM32, on the other hand, is a family of microcontrollers produced by STMicroelectronics — a European company, with headquarters in Italy. It is not a single chip but a whole range of variants (STM32F, STM32L, STM32H, STM32G…) covering a vast spectrum of performance, power consumption and peripherals. It is the benchmark in the industrial and professional embedded sector.

The key differences

Connectivity

The ESP32 is the clear winner. 802.11 b/g/n Wi-Fi and Bluetooth 4.2/5.0 are integrated into the chip. For an IoT node that needs to communicate wirelessly without additional hardware, it is unbeatable in terms of value for money.

The base STM32 has no wireless connectivity. It can be added via external modules (ES-WiFi, LoRa modules, GSM), but this increases the complexity of the project and the BOM (Bill of Materials). On the other hand, this separation is often an advantage in industrial contexts, where connectivity is managed by a dedicated layer.

Power consumption

Here, the tables are turned. STM32s, particularly the variants in the STM32L family (where the ‘L’ stands for Low Power), are designed to consume very little power. In Stop or Standby mode, power consumption easily drops below 10 µA. For a battery-powered device that needs to last for years, this makes a huge difference.

The ESP32 has deep sleep modes that consume around 10–150 µA depending on the configuration, but waking up and reconnecting to Wi-Fi cause significant current spikes (up to 250–500 mA). On a small battery, those spikes really take their toll.

Rule of thumb: if the device rarely wakes up and transmits infrequently (LoRa, environmental sensors), the STM32L is often the more efficient choice. If, on the other hand, it transmits frequently via Wi-Fi, the ESP32 manages the overall cycle better.

Computing power

The ESP32 features a dual-core Xtensa LX6 running at 240 MHz with an FPU (Floating Point Unit). It is powerful, handles parallel tasks and is capable of performing complex local processing — such as JPEG encoding, small neural networks using TensorFlow Lite, and audio streaming.

The STM32 range varies greatly: it spans from Cortex-M0+ cores running at a few MHz up to the Cortex-M7 at 480 MHz with a DSP and advanced FPU (the STM32H7 family). The power is there, but you need to choose the right variant for the task.

Real-time and determinism

This is where the STM32 has a clear advantage. ST’s Cortex-M processors are designed for hard real-time systems: precise timers, interrupts with guaranteed latency, and compatibility with RTOSes such as FreeRTOS or Zephyr in certified industrial environments.

Although the ESP32 supports FreeRTOS, it has a non-deterministic core due to the Wi-Fi stack running in the background, which can introduce jitter. For applications where timing is critical (motor control, high-frequency data acquisition, functional safety), this is a real limitation.

Ecosystem and ease of development

The ESP32 has an exceptionally accessible development ecosystem: Arduino IDE, PlatformIO, ESP-IDF, MicroPython, ESPHome. The learning curve is low and time-to-prototype is extremely fast.

STM32 requires a greater initial investment. The official IDE is STM32CubeIDE, code is generated using STM32CubeMX, and ST’s HAL (Hardware Abstraction Layer) has a steeper learning curve. The reward is much finer control over the hardware and industrial-grade scalability.

Price

The ESP32 costs less than €2 for medium-volume orders. It’s hard to beat.

The STM32 varies widely: from around €1 for entry-level Cortex-M0 models up to €10–15 for high-performance H7 variants. For industrial-scale orders, the price is negotiable with STMicro, but it generally remains higher than that of the ESP32.

When to choose the ESP32

  • Rapid prototyping of IoT nodes connected via Wi-Fi or Bluetooth
  • Consumer or semi-consumer devices requiring connectivity
  • Tight budget and time-to-market as a priority
  • Educational projects, maker projects, proof-of-concept projects
  • Lightweight edge computing (e.g. basic speech recognition, image processing)

    Practical example: an indoor environmental monitoring unit that sends data every 5 minutes to an MQTT broker via Wi-Fi. The ESP32 is perfect: affordable, connected, and easy to update via OTA.

When to choose STM32

  • Battery-powered devices with a battery life of several years
  • LoRa nodes or other radio protocols managed by an external module
  • LoRa nodes or other radio protocols managed by an external module
  • Industrial or medical products where certification is required
  • Applications where robustness and long-term reliability are priorities


Practical example: a temperature and humidity sensor powered by two AA batteries, with LoRa transmission every 15 minutes, installed in a remote field for 3 years without maintenance. STM32L is the natural choice.

What if you use them together?

This isn’t just a convenient answer: in many professional embedded projects, the ESP32 and STM32 coexist.

A common architecture is one in which the STM32 handles real-time sensor data acquisition and precise peripheral control, whilst the ESP32 handles Wi-Fi connectivity and the cloud interface. The two communicate via UART or SPI. Each does what it does best.

Tabella di sintesi

Standard

ESP32

STM32

Built-in Wi-Fi / Bluetooth

✅ Yes

❌ No (external module)

Extremely low power

⚠️ Decent

✅ Excellent (L series)

Real-time / determinism

⚠️ Restricted

✅ Excellent

Ease of development

✅ High

⚠️ Medium-high

Price

✅ Very low

⚠️ Variable

Industrial scalability

⚠️ Restricted

✅ High

Community maker

✅ Huge

✅ Expansive

Certifications (IEC, ISO)

❌ Uncommon

✅ Available

Conclusion

There is no one-size-fits-all answer, but there is the right answer for your specific project.

The ESP32 is the ideal choice for those who want to connect, prototype and launch quickly. The STM32 is the go-to option when the project scales up, when battery life is critical, when timing is key, or when the client is in the industrial sector.

At Omnetica, we use both, often in the same solution. Choosing the microcontroller is one of the first architectural decisions we make together with the client — because getting that wrong means having to redo everything else.

Do you have an embedded project in mind and don’t know where to start? Contact us: we’ll help you choose the right technology right from the very first step.