How to Choose a Microcontroller: STM32 vs ESP32 vs AVR vs PIC
By All Chip Supply · Published
Picking a microcontroller early in a design affects everything that follows: the firmware tools your team uses, the board layout, the power budget and how easy the part is to buy for years to come. STM32, ESP32, AVR and PIC are four of the most common families. Each has a sensible place, and the right choice depends on what the product needs to do.
This guide compares the families in plain terms, using example parts and figures from the manufacturers' datasheets, and ends with a checklist for your next design.
The four families at a glance
STM32 (STMicroelectronics). 32-bit Arm Cortex-M microcontrollers, from small Cortex-M0+ parts up to Cortex-M7 devices running at several hundred MHz. A very wide range of packages, memory sizes and peripherals.
ESP32 (Espressif). 32-bit chips and modules with built-in Wi-Fi and Bluetooth. Older ESP32 and ESP32-S3 parts use Xtensa cores, while the C-series parts use RISC-V. Often bought as pre-certified modules.
AVR (Microchip, originally Atmel). 8-bit microcontrollers known from the Arduino Uno and Mega boards, plus newer AVR DA/DB families. Simple, well documented and easy to start with.
PIC (Microchip). 8-bit, 16-bit and 32-bit families with a very long history in industrial and consumer products. Microchip's 32-bit PIC32 parts use MIPS cores.
Example parts and key figures
- STM32F411CEU6: Cortex-M4 with FPU, up to 100 MHz, 512KB flash, 128KB SRAM
- STM32F407VGT6: Cortex-M4 with FPU, up to 168 MHz, 1MB flash, 192KB SRAM, Ethernet MAC and USB OTG
- STM32H743ZIT6: Cortex-M7, up to 480 MHz, 2MB flash, 1MB RAM
- ESP32-WROOM-32E-N4: dual-core Xtensa LX6 up to 240 MHz, Wi-Fi and Bluetooth, 4MB flash in the module
- ESP32-S3-WROOM-1-N16R8: dual-core Xtensa LX7 up to 240 MHz, Wi-Fi and Bluetooth LE, 16MB flash and 8MB PSRAM
- ESP32-C6-WROOM-1-N8: RISC-V, Wi-Fi 6, Bluetooth LE and IEEE 802.15.4 (Thread and Zigbee)
- ATmega328P-AU: 8-bit AVR, up to 20 MHz, 32KB flash, 2KB SRAM, 1KB EEPROM
- AVR128DA48: 8-bit AVR, up to 24 MHz, 128KB flash, 16KB SRAM
- PIC16F877A-I/P: 8-bit PIC, up to 20 MHz, 14KB flash, 368 bytes RAM, 40-pin DIP
- PIC32MZ2048EFH144: 32-bit MIPS core with FPU, up to 200 MHz, 2MB flash, 512KB RAM
Check the datasheet for your exact part number, since temperature grade, package and memory options change the figures.
Start with what the product must do
Does it need wireless? If the product must join Wi-Fi or talk to a phone over Bluetooth, an ESP32 module is usually the simplest route because the radio, antenna and much of the certification work come in one part. STM32 also has wireless families, and any microcontroller can be paired with a separate radio module, but that adds parts and design work.
How much processing? Simple control tasks, such as reading buttons, driving relays or running a small display, fit easily on an 8-bit AVR or PIC. Motor control, digital signal processing, audio, graphics or heavy communication stacks point towards a 32-bit Cortex-M4 or M7 STM32, or an ESP32-S3.
Which peripherals? List the interfaces you need: UART, SPI, I2C, CAN, USB, Ethernet, ADC channels and resolution, timers, PWM outputs and DACs. Then filter parts by that list. STM32 families are strong on peripheral variety. Newer AVR and PIC parts include useful analog blocks and configurable logic.
Power budget. For battery products, look at sleep current, wake-up time and the current drawn while the radio is active. Wi-Fi is power-hungry, so an always-connected ESP32 design needs a careful power plan. Low-power STM32 and 8-bit parts can run for long periods on small batteries when designed well.
Tools and firmware
- STM32: STM32CubeIDE and STM32CubeMX, HAL and low-level libraries, plus wide support in Zephyr, FreeRTOS, Arduino and other toolchains.
- ESP32: Espressif's ESP-IDF framework (based on FreeRTOS), with Arduino and MicroPython widely used for prototypes.
- AVR: Microchip Studio or MPLAB X with the XC8 compiler, avr-gcc, and the Arduino environment.
- PIC: MPLAB X with XC8, XC16 or XC32 compilers and MPLAB Code Configurator.
Your team's experience counts. Moving to an unfamiliar family costs time in learning tools, debuggers and libraries, so weigh that against any savings on part cost.
Package and board design
Through-hole packages such as the 40-pin DIP PIC16F877A suit hand assembly, repairs and teaching. Most production designs use surface-mount packages such as LQFP, QFN or BGA. Smaller packages save space but are harder to inspect and rework. Pre-made modules, like the ESP32 WROOM parts, simplify the radio layout but take more board area than a bare chip.
Sourcing over the product's life
A microcontroller that cannot be bought in two years can force a redesign. Before you commit:
- Check the manufacturer's lifecycle status and any longevity program for the family.
- Prefer parts with pin-compatible alternatives in the same family, so you can move up or down in memory if needed.
- Note the exact orderable part number, including package, temperature grade and packaging (tray, tube, tape and reel).
- Ask suppliers for date codes and lead times on larger orders.
A quick decision checklist
- Wireless needed out of the box: ESP32 module
- High performance, rich peripherals, Arm ecosystem: STM32
- Simple control, low cost, easy learning curve: AVR
- Long-running industrial designs or an existing PIC code base: PIC
Next steps
Browse current listings in our microcontrollers category, or send your part numbers and quantities through a chip request. If you are still choosing, include your interface list, power target and production volume, and we will reply with options and pricing.