Two microcontroller families come up in almost every new product conversation we have: Espressif's ESP32 and ST's STM32. Both are mature, well supported and inexpensive. Both ship in millions of products. Choosing between them is rarely about which one is "better". It is about which one fits what your product actually does all day.
Start with connectivity
The single biggest difference is the radio. Most ESP32 variants include Wi-Fi and Bluetooth LE on the die, and newer parts add 802.15.4 for Thread and Zigbee. If your product must connect to a phone or a home network, an ESP32 gives you a certified radio path at a very low bill of materials cost.
Most STM32 parts have no radio. You add one as a separate module or chip, or you choose a wireless STM32 variant (the WB and WL lines cover BLE and sub-GHz LoRa). That adds a part, but it also lets you choose the radio independently of the processor, which matters when range, protocol or certification drives the design.
Real-time behavior and peripherals
STM32 is the stronger choice when timing matters. Motor control, precise PWM, high-resolution ADC sampling, multiple CAN or USB interfaces and deterministic interrupt latency are where the STM32 family excels. The range is enormous, from tiny Cortex-M0+ parts to Cortex-M7 and dual-core H7 devices, so you can size the processor to the job and stay in one toolchain as the product grows.
The ESP32 runs its radio stack alongside your application, usually on FreeRTOS. That is fine for most connected products, but it means you share the CPU with Wi-Fi. For hard real-time work, many designs pair an ESP32 for connectivity with a small STM32 for control.
Power
For battery products that sleep most of the time, STM32L and U series parts reach very low standby currents with fast wake-up. Wi-Fi is inherently power hungry, so an always-connected ESP32 product will usually be mains or USB powered. Bluetooth LE and deep-sleep modes narrow the gap, but measure your real duty cycle before you commit.
Supply chain and lifecycle
ST publishes longevity commitments for many STM32 lines, often ten years or more, and the family has broad distribution with pin-compatible alternates. Espressif parts are widely stocked and inexpensive, and their modules carry pre-certified radios, which can save significant time at FCC and CE. Whichever you pick, design for a second source where you can and check lifecycle status before layout, not after.
A simple rule of thumb
- Choose ESP32 when Wi-Fi or BLE connectivity is central, the product is mains or USB powered, and cost and time to certification matter most.
- Choose STM32 when timing, analog performance, motor control, low-power battery life or long lifecycle commitments drive the design.
- Use both when you need a connected product with hard real-time control. A small STM32 handles the control loop; an ESP32 handles the network.
This decision comes up constantly when we move products off a Raspberry Pi. A single-board computer usually hides the question of what the product actually needs. Once you answer it, the right microcontroller is usually obvious, and the custom board costs a fraction of the original.
Move Off a Raspberry Pi
When a prototype board becomes a liability.