STM32 vs ESP32: Which Microcontroller Should You Choose?
Quick answer
Choose ESP32-C3 for a straightforward Wi-Fi IoT sensor, or ESP32-C6 when the project needs its newer wireless interfaces. Choose STM32L476 for a mostly sleeping battery sensor, but treat years on a coin cell as a system-level requirement, not a guaranteed MCU specification. For motor control or a drone's flight-control loop, start with STM32F407. For a compute-heavy controller or audio/DSP pipeline, consider STM32H743. For a configurable USB device with wireless connectivity, choose ESP32-S3. For a wired industrial CAN node, select an STM32 with the required CAN controller. For a beginner's first connected board, start with an ESP32 development board and then move to a module-based custom PCB.
Microcontrollers are used in applications such as wireless sensors, motor controllers, drones, and portable instruments. The requirements vary considerably between applications. A wireless sensor needs a way to transmit data, while a motor controller needs precise timing to control electrical signals and monitor current. Battery-powered instruments also need to minimize energy consumption during periods of inactivity.
Engineers often turn to STMicroelectronics' STM32 and Espressif Systems' ESP32 microcontroller families for such applications. STM32 devices offer options for wired control, low-power operation, and signal processing. Many ESP32 devices include Wi-Fi and Bluetooth, making them popular for connected products. Within each family, however, processor capabilities, memory, and available interfaces differ between models.
The following comparison examines specific STM32 and ESP32 variants to help engineers select a microcontroller based on the application and its hardware requirements.
Compare exact parts, not family names
STM32 and ESP32 are families, not individual chips. The comparison uses the following devices:
Espressif Systems (ESP32):
- ESP32-WROOM-32E-N4
- ESP32-S3-WROOM-1-N16R8
- ESP32-C3-MINI-1-H4X
- ESP32-C6-WROOM-1-N4
STMicroelectronics (STM32):
- STM32F103C8T6
- STM32F407VGT6
- STM32G071CBT6
- STM32L476RGT6
- STM32H743VIT6
The selected Espressif products are modules that include the microcontroller and supporting components, such as flash memory and radio-frequency (RF) circuitry. The STMicroelectronics products are bare microcontroller integrated circuits (ICs), which need additional external components to form a working circuit. Their prices and physical dimensions therefore cannot be compared directly without accounting for the supporting circuitry.
The term "Blue Pill" also refers to a common STM32 development-board design rather than a guaranteed microcontroller or bill of materials (BOM).
Comparison table: wireless sensor versus low-power sensor
Table 1. ESP32-C3-MINI-1-H4X vs STM32L476RGT6: specifications and design implications
| Feature | ESP32-C3-MINI-1-H4X | STM32L476RGT6 | Design implications |
|---|---|---|---|
| CPU | Single-core 32-bit RISC-V | Arm Cortex-M4 | Architecture changes the toolchain, but architecture alone does not determine application performance. |
| Maximum CPU clock | 160 MHz | 80 MHz | Clock frequency is not a cross-architecture benchmark. |
| Flash | 4 MB in the selected module | 1 MB embedded flash | Leave space for updates, credentials, and application growth. |
| SRAM | 400 KB, including 16 KB used for cache | 128 KB, split between SRAM1 and SRAM2 | Datasheet capacity differs from free application memory. |
| Integrated wireless | Wi-Fi 802.11b/g/n and Bluetooth 5 LE | No integrated radio | Include radio hardware, firmware, and energy consumption in the comparison. |
| USB role | USB Serial/JTAG for programming, debugging, and virtual serial communication | USB OTG full-speed device/host controller | A programming port is not interchangeable with a configurable application USB controller. |
| Supply | 3.0–3.6 V recommended | 1.71–3.6 V VDD with the internal LDO | Battery discharge range and regulator losses matter. |
| Physical implementation | RF module with an antenna region | LQFP64, 10 × 10 mm package | Compare the complete implementation, not just the silicon footprint. |
Flash memory stores firmware and other nonvolatile data. Static random-access memory (SRAM) holds temporary data during program execution, so available SRAM capacity can affect how much information an application can process at once.
Which ESP32 variant fits the application?
ESP32 variants differ in processor architecture, memory capacity, and wireless capabilities. The appropriate choice depends on the interfaces and processing resources required by the product.
Table 2. ESP32 module specifications and typical applications
| Variant | Processor | Memory | Application considerations |
|---|---|---|---|
| ESP32-WROOM-32E-N4 | Dual-core Xtensa LX6, 240 MHz | 4 MB flash; 520 KB on-chip SRAM | Original ESP32 supports Bluetooth Classic BR/EDR as well as LE. |
| ESP32-S3-WROOM-1-N16R8 | Dual-core Xtensa LX7, 240 MHz | 16 MB flash, 8 MB PSRAM; 512 KB on-chip SRAM | Wireless products needing larger buffers and USB OTG. |
| ESP32-C3-MINI-1-H4X | Single-core RISC-V, 160 MHz | 4 MB flash; 400 KB SRAM including cache | Straightforward Wi-Fi/BLE sensor or controller. |
| ESP32-C6-WROOM-1-N4 | Main RISC-V CPU up to 160 MHz | 4 MB flash; 512 KB HP SRAM and 16 KB LP SRAM | Wi-Fi 802.11b/g/n/ax, Bluetooth 5 LE, and IEEE 802.15.4. |
Pseudo-static RAM (PSRAM) provides additional working memory outside the processor's internal SRAM. However, applications that use PSRAM must account for access latency, buffer placement, and any restrictions on direct memory access (DMA), which allows peripherals to transfer data without continuous CPU involvement.
Which STM32 variant fits the application?
STM32 devices are available with different processing capabilities, memory configurations, and peripheral interfaces. For example, the STM32F407 includes a floating-point unit (FPU) for mathematical operations, while the STM32L476 offers low-power operating modes for battery-powered applications.
Table 3. STM32 microcontroller specifications and typical applications
| Variant | Processor | Flash / SRAM | Application considerations |
|---|---|---|---|
| STM32F103C8T6 | Cortex-M3, 72 MHz | 64 KB / 20 KB | Existing Blue Pill designs or small legacy controllers. |
| STM32F407VGT6 | Cortex-M4 with FPU, 168 MHz | 1 MB / 192 KB system SRAM, including CCM | Motor control, flight-control processing, or conventional digital signal processing (DSP). |
| STM32G071CBT6 | Cortex-M0+, 64 MHz | 128 KB / 36 KB without parity, or 32 KB with parity | A compact wired controller; verify required interfaces for the exact part. |
| STM32L476RGT6 | Cortex-M4, 80 MHz | 1 MB / 128 KB | Mostly sleeping sensors and battery instruments. |
| STM32H743VIT6 | Cortex-M7 with double-precision FPU, up to 480 MHz on revision V | 2 MB flash; up to 1 MB RAM across multiple regions | Compute-heavy audio/DSP or industrial systems. |
For STM32H743, verify the silicon revision, voltage scaling, temperature limits, and memory accessibility before designing around its maximum performance specifications.
Choose ESP32 if…
ESP32 is generally a practical choice when an application needs wireless communication or an integrated networking interface.
- An environmental sensor must connect directly to a Wi-Fi network. Start with ESP32-C3.
- A smart-home device needs the ESP32-C6 radio interfaces and corresponding software stack.
- A connected USB peripheral needs ESP32-S3's USB OTG rather than only a programming port.
- A wireless audio or display product benefits from the selected ESP32-S3 module's PSRAM.
- An existing product specifically requires the original ESP32's Bluetooth Classic support.
- A first custom connected board would benefit from an RF module rather than a bare-chip RF implementation.
Choose STM32 if…
STM32 is worth considering when local control, timing requirements, or low-power operation are primary design requirements.
- A motor controller needs synchronized PWM and current sampling. Start with STM32F407.
- A drone's local control loop must operate independently of networking activity.
- A battery instrument spends much of its time asleep. Consider STM32L476 and evaluate the complete power path.
- A wired industrial node needs CAN. Select the appropriate CAN controller and add a transceiver.
- An audio/DSP workload requires the STM32F407's FPU or the STM32H743's greater processing resources.
- A simple appliance controller needs neither a radio nor the networking software overhead. Consider STM32G071.
Design considerations that change the schematic or PCB
Beyond the processor specifications, the selected MCU determines several circuit requirements, including power delivery, communication interfaces, and PCB layout.
Power supply, decoupling, and battery life
Design the ESP32 power supply to accommodate the current required during startup and wireless transmissions. For STM32, include the analog supplies, voltage references, and any capacitors required to support the selected device's internal core-voltage regulator.
Battery life is another consideration, particularly for sensors that spend long periods in a low-power state. Sleep-current specifications provide a starting point, although the operating conditions used by each manufacturer must be considered.
The ESP32-C3 datasheet lists 5 µA typical deep-sleep current with the real-time clock (RTC) timer and RTC memory, measured at 3.3 V and 25 °C. The STM32L476 lists 1.64 µA typical in Stop 2 mode with the RTC clocked by its low-speed internal (LSI) oscillator and the LCD disabled, measured at 3 V and 25 °C.
The measurements describe different operating states and conditions, so the values cannot be used directly to compare battery lifetime.
For a product expected to operate for years on a coin cell, account for wakeups, sensor warmup, transmissions, leakage, self-discharge, temperature, and battery pulse capability. STM32L476 is a starting recommendation rather than a guarantee, and a wireless sensor must also include the radio's energy consumption in the power budget.
Real-time control and analog measurements
Motor controllers and flight controllers depend on predictable timing for switching signals and sensor measurements. Hardware timers can coordinate such operations without relying on software to execute at an exact moment.
The STM32F407's TIM1 and TIM8 timers provide complementary pulse-width modulation (PWM) outputs and programmable dead time, a short interval that prevents conflicting power transistors from conducting simultaneously. Its analog-to-digital converters (ADCs) can also be triggered by timers, allowing current measurements to be synchronized with switching events.
The combination of PWM timing and synchronized ADC measurements makes STM32F407 a sensible starting point for motor control. For a flight controller, networking latency should likewise be kept separate from time-sensitive sensor sampling and control calculations.
STM32F407 has three 12-bit ADCs. However, resolution alone does not establish measurement accuracy. Engineers must also consider error specifications, source impedance, sample timing, reference noise, calibration, and the board's interference environment. Noise and other sources of error can affect the measured voltage even when the ADC provides enough digital resolution.
CAN, USB, clocking, and debug
Controller Area Network (CAN) is a wired communication bus commonly used in automotive and industrial control systems. The required CAN version determines the controller and supporting circuitry needed on the PCB.
STM32F407 provides two classical CAN controllers, and STM32L476 provides one classical CAN interface. STM32H743 includes Flexible Data-Rate CAN (FDCAN) interfaces, which support CAN FD communication with larger message payloads and higher data-phase rates.
For an industrial node, specify classical CAN or CAN FD before selecting the transceiver, protection, termination, and any required isolation.
Pin assignments also affect interface availability. STM32F103's default CAN and USB signals share PA11 and PA12, so the interfaces cannot be assumed to operate independently without checking the selected pin configuration. STM32G071's USB Type-C Power Delivery (UCPD) feature manages Type-C power-related communication and does not establish the presence of an application USB data controller.
USB requirements also differ between devices that need a programming connection and products that operate as USB peripherals.
ESP32-C3's USB Serial/JTAG interface is primarily intended for programming, debugging, and virtual serial communication rather than general Human Interface Device (HID) or audio-class applications.
ESP32-S3 supports USB On-The-Go (OTG), but the OTG controller shares its integrated physical-layer transceiver (PHY) with USB Serial/JTAG. Engineers should therefore plan how debugging access will be maintained.
For STM32F407, high-speed USB requires an external PHY, although the integrated transceiver supports full-speed operation.
Select oscillators according to interface accuracy, startup, and sleep requirements. Crystal load capacitors depend on the selected components and PCB layout. The circuit should also preserve reset, boot recovery, and debug access.
RF layout, modules, and FCC/CE
ESP32 modules reduce RF design work but still require antenna keepouts and placement that accounts for the product enclosure.
For regulatory compliance, Espressif provides module documentation through its Certifications & Compliance portal. However, module certification does not automatically establish FCC or CE compliance for the finished product.
Engineers must review the selected module's integration conditions and the host product's compliance obligations. A bare-chip RF implementation also requires antenna matching, RF layout, and validation work.
Security and software ecosystem
Connected devices may need to protect stored credentials, restrict debugging access, and verify firmware updates. The ESP32 and STM32 families provide different hardware features for addressing such requirements.
ESP32-C3 supports secure boot, flash encryption, and cryptographic hardware acceleration. STM32L476 includes readout protection, write protection, proprietary-code protection, and a hardware firewall for restricting access to protected memory.
The security mechanisms operate differently and require device-specific configuration. Engineers should plan authenticated updates, key provisioning, debug restrictions, and recovery procedures rather than relying on the presence of security hardware alone.
For software development, use ESP-IDF, Espressif's official development framework, or Arduino-ESP32 for Arduino-style programming.
For STM32, STM32CubeIDE, CubeMX, and the HAL/LL driver libraries provide manufacturer-supported development tools. The Zephyr real-time operating system (RTOS) also supports boards from both families, although driver and peripheral support should be checked for the selected device and software release.
Cost, supply, and lifecycle
As of October 2026, DigiKey listed the following one-unit prices in USD. Prices are subject to change and exclude taxes, shipping, assembly, and supporting circuitry.
Table 4. Sample DigiKey prices for ESP32 and STM32 components, October 2026
| Part | One-unit price |
|---|---|
| ESP32-S3-WROOM-1-N16R8 | $6.56 |
| STM32L476RGT6 | $9.47 |
The listed ESP32-S3 is a wireless module, whereas the STM32L476 is a bare microcontroller. As a result, the prices do not establish a cost ranking between the two families.
At production volume, compare the complete BOM, programming and test labor, RF design effort, and approved suppliers.
Long-term availability is another consideration for production designs:
- Espressif's longevity policy specifies production commitments by product series and starting date.
- ST's STM32F407VG and STM32L476RG product pages list availability commitments through January 2036.
Keep in mind that a longevity commitment is not a guarantee of current inventory or lead time. Confirm the exact orderable variant and monitor manufacturer product-change notices before placing production orders.
Example: minimal reference circuits to build in Flux
The following circuits provide starting points for a Wi-Fi sensor based on ESP32-C3 and a battery-powered instrument based on STM32L476.
ESP32-C3 Wi-Fi sensor
- Select the module and power supply. Start with ESP32-C3-MINI-1-H4X and a regulated supply capable of supporting radio activity and startup.
- Add decoupling and reset circuitry. The reference circuit uses 10 µF and 100 nF supply capacitors and recommends a 10 kΩ resistor and 1 µF capacitor for the chip-enable (EN) reset delay.
- Connect the sensor. Add an I²C sensor using the appropriate GPIO pins. The required pull-up resistors depend on the selected sensor and bus configuration.
- Provide USB programming access. Connect USB D− to GPIO18 and D+ to GPIO19 when using the native USB Serial/JTAG interface.
- Check the module layout requirements. Follow the boot-strapping pin configuration and antenna keepout recommendations in the module documentation.
STM32L476 battery instrument
- Select the microcontroller and supply. Start with STM32L476RGT6, a suitable power source, and the required sensor and wakeup connections.
- Connect the supply pins and decoupling capacitors. ST specifies 100 nF per VDD pin plus 4.7 µF for the digital supply, along with 10 nF and 1 µF near VDDA/VSSA for the analog supply.
- Provide debugging access. Connect PA13/SWDIO, PA14/SWCLK, NRST, ground, and the target-voltage reference to the SWD header or test pads.
- Configure wakeup and timekeeping. Add the appropriate wakeup input and real-time clock circuitry according to the application's operating requirements.
- Add wireless hardware if needed. A wireless STM32L476 instrument requires a separate radio, which must also be included in the power budget.
The example circuits are reference starting points rather than completed or tested schematics. Verify component values, pin connections, and layout requirements against the manufacturer's documentation before manufacturing.
FAQ
The ESP32 variants compared here integrate wireless connectivity. The selected STM32 parts offer options for wired control, low-power operation, and processing requirements. The exact model determines the available peripherals and memory, so the comparison should be based on specific devices.
ESP32-C3 is a practical choice for a straightforward Wi-Fi sensor, and ESP32-C6 is worth considering when additional wireless interfaces are required. STM32 is appropriate when local control or energy consumption determines the architecture and a separate communications device is acceptable.
A sleep-current specification alone cannot establish battery lifetime. Engineers must account for the complete operating cycle, battery pulse capability, leakage, and communications energy before estimating a multi-year runtime.
ESP32 can operate in a larger control system, but time-critical switching and sensor sampling should not depend on networking activity. Among the parts compared, STM32F407 is a recommended starting point for synchronized motor-control applications.
Some variants support configurable USB applications, although their capabilities differ. ESP32-S3 and STM32L476 include USB OTG controllers for application functions. ESP32-C3 USB Serial/JTAG is primarily intended for programming, debugging, and virtual serial communication.
Arduino is a hardware and software development ecosystem rather than a directly comparable microcontroller family. For a first connected project, an ESP32 development board with Arduino-style software is a practical starting point. A supported STM32 development board is another option for learning timers and wired control.
Sources and revisions used
The following manufacturer datasheets and product pages provide the specifications used in the comparison.
- ESP32-WROOM-32E/32UE datasheet, version 2.1.
- ESP32-S3-WROOM-1/1U datasheet, version 1.8.
- ESP32-C3-MINI-1/1U datasheet, version 2.2.
- ESP32-C6-WROOM-1/1U datasheet, version 1.4.
- ESP32-C3 series datasheet, version 2.4, for security features.
- STM32F103C8 datasheet and reference-manual resources: DS5319 Rev 20.
- STM32F407VG datasheet and reference-manual resources: DS8626 Rev 12.
- STM32G071CB datasheet and reference-manual resources: DS12232 Rev 5.
- STM32L476RG datasheet and reference-manual resources: DS10198 Rev 11.
- STM32H743VI datasheet and reference-manual resources: DS12110 Rev 11.
- Espressif Certifications & Compliance: Module certification documents.
- Espressif Longevity Commitment: Published production commitments by product series.
Pricing, component availability, software support, and certification information are date-sensitive. Verify current manufacturer specifications and supplier information before final component selection.
More in Component & Platform Guides
Let’s start building.
Let’s build your idea together. All you need to do is describe what you want to make, or what problem you want to solve. Flux will work with you to make it a reality.