RP2040 vs. ESP32: How to Choose the Right Microcontrollers

Published:January 25, 2024

Prof. David Reynolds stands as a luminary in the field of electrical engineering, renowned for his expertise in integrated circuits. Holding a distinguished position as a Professor of Electrical Engineering, Prof. Reynolds earned his acclaim through decades of research, teaching, and industry collaboration.

A microcontroller is a programmable integrated circuit designed to execute tasks autonomously. RP2040 and ESP32 stand out as widely used microcontrollers in the embedded systems sector. These compact, energy-efficient microcontrollers feature 32-bit dual-core CPUs and are employed for overseeing electronics projects. While both present appealing functionalities at reasonable costs, they do have noteworthy distinctions that individuals should take into account when choosing a microcontroller for their upcoming projects. In this article, we will dive into the differences between the RP2040 and ESP32 to help you choose the right microcontroller for your project.

 

Overview of RP2040

The RP2040 is a microcontroller crafted and manufactured by the Raspberry Pi Foundation, representing the company's inaugural entry into the microcontroller realm. It marks Raspberry Pi's entry into the microcontroller domain, embodying the core values of exceptional performance, cost-effectiveness, and user-friendly design.

 

Featuring a substantial on-chip memory, a symmetrical dual-core processor complex, a deterministic bus fabric, and a diverse peripheral set complemented by a distinctive Programmable I/O (PIO) subsystem, it furnishes professional users with unparalleled power and flexibility. Meticulous documentation, a refined MicroPython implementation, and a UF2 bootloader embedded in ROM collectively ensure the most accessible entry point for both beginners and hobbyists.

RP2040 operates as a stateless device, supporting cached execute-in-place functionality from external QSPI memory. This intentional design choice empowers users to select the optimal density of non-volatile storage for their applications while taking advantage of the cost-effectiveness of readily available flash components.

Manufactured using a contemporary 40nm process node, RP2040 delivers stellar performance, minimal dynamic power consumption, and negligible leakage. Various low-power modes are integrated to facilitate prolonged operation on battery power, aligning with the demands of extended-duration use scenarios.

 

Overview of ESP32

The ESP32, a cost-effective and energy-efficient system on a chip (SoC) series with Wi-Fi and dual-mode Bluetooth features, was developed by Espressif Systems. The ESP32 family encompasses chips like ESP32-D0WD Q6, ESP32-D0WD, ESP32-D2WD, ESP32-S0WD, and the System in Package (SiP) ESP32-PICO-D4.

 

At its core, the ESP32 employs a dual-core or single-core Tensilica Xtensa LX6 microprocessor with a clock rate reaching up to 240 MHz. The chip integrates antenna switches, RF baluns, power amplifiers, low-noise receive amplifiers, filters, and power management modules.

Designed for applications in mobile devices, wearable electronics, and the Internet of Things (IoT), the ESP32 incorporates power-saving technologies. These include fine-resolution clock gating, multiple power modes, and dynamic power scaling, collectively contributing to achieving ultra-low power consumption.

 

RP2040 vs. ESP32: Features&Specifications

 

RP2040 Features&Specifications

  • Dual-core ARM Cortex-M0+ processor clocked at up to 133 MHz
  • 264kB on-chip SRAM distributed across six independent banks
  • Support for up to 16MB of off-chip Flash memory through a dedicated QSPI bus
  • 30 GPIO pins, incorporating 4 analog inputs
  • Fully-connected AHB crossbar
  • Interpolator and integer divider peripherals
  • Dedicated hardware for essential peripherals like I2C, SPI, and UART
  • Programmable input/output (PIO) subsystem featuring 4 state machines for customized logic and peripheral emulation
  • 2 x UART, 2 x SPI controllers, and 2 x I2C controllers
  • 8 x Programmable I/O (PIO) blocks
  • DMA controller: USB 1.1 Host/Device controller with a dedicated DMA channel
  • 12-bit, 500 ksps Analog-to-Digital Converter (ADC) supporting up to 4 input channels
  • 16 x PWM channels
  • On-chip programmable LDO for core voltage generation
  • 2 on-chip PLLs for USB and core clock generation
  • Real-Time Counter (RTC)
  • Low-power sleep and dormant modes
  • On-chip crystal oscillator with external clock input
  • Operating voltage range: 1.8V to 5.5V
  • Peripherals include various features to enhance the overall capabilities of RP2040.

 

The RP2040 is compatible with several programming languages, such as C, C++, MicroPython, and CircuitPython. Additionally, it can be programmed using various development tools, including the official Raspberry Pi Pico SDK and third-party options like Arduino and PlatformIO.

 

ESP32 Features&Specifications

Microprocessor: Tensilica Xtensa dual-core 32-bit LX6 microprocessor, capable of running up to 240 MHz

 

Memory:

  • 520 KB SRAM
  • 448 KB ROM
  • 4 MB flash memory for program and data storage

 

Wireless Connectivity:

  • Wi-Fi: 802.11 b/g/n, supporting WPA/WPA2/WPA3 authentication
  • Bluetooth: v4.2 BR/EDR and BLE specification

 

Peripherals:

  • 34 programmable GPIO pins
  • 3 UART interfaces
  • 3 SPI interfaces
  • 2 I2C interfaces
  • 18 analog-to-digital converter (ADC) channels
  • 2 digital-to-analog converter (DAC) channels
  • 2 I2S interfaces
  • 2 led interfaces for PWM
  • 10 capacitive touch sensors
  • Ethernet MAC interface with dedicated DMA and IEEE 1588 support

 

Power Management:

  • 5 µA deep sleep current
  • Built-in RTC

 

Other Features:

  • CAN 2.0 support
  • SD/SDIO/MMC host controller
  • Secure boot
  • AES and SHA hardware encryption support
  • Built-in temperature sensor

 

RP2040 vs. ESP32: Pinout

 

RP2040 Pinout

 

ESP32 Pinout

 

 

RP2040 vs. ESP32: Block Diagram

 

RP2040 Block Diagram

 

ESP32 Block Diagram

 

 

RP2040 vs. ESP32: Datasheet

 

RP2040 Datasheet

ESP32 Datasheet

 

RP2040 vs. ESP32: Advantages and Disadvantages

 

RP2040 Advantages and Disadvantages

 

 

RP2040 Advantages

  • High performance: RP2040 is equipped with a dual-core ARM Cortex-M0+ processor, delivering excellent performance with low power consumption.
  • Low cost: RP2040 is a cost-effective microcontroller, making it a compelling choice for hobbyists and makers.
  • Ample memory: With 264KB of on-chip RAM, RP2040 offers sufficient memory for a diverse range of applications.
  • Programmable input/output (PIO) subsystem: RP2040 features a unique PIO subsystem, allowing for custom logic and peripheral emulation.
  • Easy to program: RP2040 supports various programming languages and development tools, ensuring ease of programming and seamless integration into projects.

 

RP2040 Disadvantages

  • Limited peripherals: RP2040 possesses fewer peripherals compared to certain other microcontrollers, potentially restricting its application in specific scenarios.
  • No built-in Wi-Fi or Bluetooth: RP2040 lacks built-in Wi-Fi or Bluetooth connectivity, potentially limiting its suitability for certain IoT applications.
  • Newer technology: Being a relatively recent microcontroller, RP2040 may not benefit from the same level of community support or available resources as more established microcontrollers.

 

ESP32 Advantages and Disadvantages

 

ESP32 Advantages

  • Affordability: The ESP32 is budget-friendly, with a starting price as low as $6, making it easily accessible to the general public.
  • Low Power Consumption: In comparison to other microcontrollers, the ESP32 demonstrates exceptionally low power consumption and supports energy-saving modes like deep sleep.
  • Wi-Fi Capabilities: The ESP32 effortlessly connects to Wi-Fi networks, enabling internet connectivity in station mode or the creation of its own Wi-Fi network in access point mode. This feature is particularly beneficial for IoT and essential for home automation projects, allowing multiple devices to communicate with each other through Wi-Fi.
  • Bluetooth Support: The ESP32 supports both Bluetooth Classic and Bluetooth Low Energy (BLE), making it suitable for a variety of IoT applications.
  • Dual Core Processing: Most ESP32 variants feature dual-core architecture, housing two Xtensa 32-bit LX6 microprocessors: Core 0 and Core 1.
  • Abundant Peripheral Interfaces: The ESP32 provides a rich array of input and output interfaces, including support for capacitive touch, ADC, DAC, UART, SPI, I2C, and other peripherals for both data input and output. It also supports pulse width modulation, among other features.
  • Arduino Compatibility: The ESP32 seamlessly integrates with the Arduino "Programming Language," ensuring ease of operation with Arduino boards.
  • MicroPython Compatibility: Programmers can use MicroPython firmware to program the ESP32, leveraging a reimplementation of Python 3 specifically designed for microcontrollers and embedded systems.

 

ESP32 Disadvantages

The ESP32 exhibits a comparatively elevated power consumption, posing a potential drawback for IoT applications reliant on battery operation. It becomes essential to take into account the influence of peripheral elements, including voltage regulators, on overall power consumption. Additionally, despite the efficient execution and response times offered by languages like C/C++, TinyGo, and Rust, it's worth noting that MicroPython programs may experience a comparatively slower performance.

 

RP2040 vs. ESP32: What's the Difference?

 

 

Price: Which Board Offers the Most Value?

Typically, the Raspberry Pi Pico RP2040 doesn't encounter the supply constraints affecting other Raspberry Pis. It's usually available in stock through authorized resellers at official prices, so the recent Raspberry Pi RP2040 shortage doesn't significantly impact its availability.

When purchasing from various sources, both boards generally come with a comparable price tag. However, considering the connectivity features packed into the ESP32, it offers better value for the same price. There's also the Pico W option, but it comes at a slightly higher cost, at least two dollars more than the standard version.

 

Processing Power

The ESP32 boasts a marginally more potent processor, clocking in at a maximum speed of 240 MHz, in contrast to the Raspberry Pi Pico's top clock speed of 133 MHz. The ESP32 also exhibits a swifter instruction rate compared to the RP2040 chip embedded in the Pico.

Both microcontroller boards feature dual-core CPUs, enabling them to handle multiple processes simultaneously. However, assuming all other factors are equal, tasks executed on the ESP32 are anticipated to conclude more swiftly than those on the Raspberry Pi Pico.

 

Networking and Connectivity

The ESP32 boasts dual connectivity features, incorporating both Bluetooth and Wi-Fi—a feature absent in the Raspberry Pi Pico.

If your objective involves establishing wireless connections between devices, the ESP32 proves to be the superior option, facilitating seamless communication with other wireless devices.

Alternatively, consider the Raspberry Pi Pico W, introduced in June 2022. While it comes with built-in Wi-Fi, it comes with an additional $2 cost and notably lacks Bluetooth functionality.

 

Power Consumption

Both boards incorporate advanced power-saving technologies to minimize power consumption. However, distinctions arise as the ESP32 boasts a faster processor and greater flash memory, resulting in increased power draw.

As per the datasheet, the RP2040 exhibits a power consumption of approximately 91mA during the popcorn test (VGA video, SD card, and I2S audio) with power-saving disabled. Additionally, the RP2040 offers flexibility in power supply selection, featuring two low-power modes—dormant mode and sleep mode. While dormant mode consumes even less power, it necessitates an external trigger for activation.

On the other hand, the ESP32 introduces six power modes: active, modem-sleep, light-sleep, deep sleep, hibernation, and power-off. The active mode activates all features simultaneously and can draw up to 240mA of current. Notably, the hibernation mode demonstrates minimal consumption, as low as 5 µA. The ESP32's onboard RTC timer enables waking up from any state.

Due to its lower power consumption in active modes, the RP2040 proves more suitable for straightforward, low-power projects powered by a battery pack.

 

Performance and Benchmarks

In terms of processing power, the ESP32 has a clear advantage with its faster 240 MHz clock speed compared to 133 MHz on the RP2040. However, both are capable 32-bit MCUs with more than enough power for most embedded and IoT applications. The RP2040 uses a simpler but more power-efficient processor design based on Arm Cortex M0+, while the ESP32 employs the more advanced Xtensa cores.

Regarding memory, the 520KB SRAM on the ESP32 is much larger than the 264KB available on the RP2040. Both have enough memory for typical tasks, but the extra capacity on the ESP32 provides more flexibility for complex data processing algorithms or buffering data streams.

Various benchmarks have shown the ESP32 performing 1.5x to 2x faster than the RP2040 on typical tasks. However, the RP2040 consumes less power and can operate efficiently down to 1.8V, while the ESP32 needs 3.3V. Therefore, for low-power applications, especially when running from batteries or energy harvesting sources, the RP2040 has the advantage.

 

 

Supported Programming Languages

Various development environments are accessible for both microcontroller boards, offering options such as MicroPython, C, and C++. Irrespective of your preferred language, it's probable to find an interpreter for Pico or ESP32 that accommodates it. Notably, a JavaScript interpreter tailored for the ESP32 exists.

When working on small projects with the ESP32, you have the flexibility to use either MicroPython or C++. However, for substantial and intricate projects, it is advisable to leverage the ESP-IDF (Espressif IoT Development Framework) via the Visual Code extension or Eclipse plugin. Programming the RP2040 is a straightforward process, akin to drag-and-drop, as the device appears as mass storage when connected to a PC via USB.

There's no rivalry in this aspect, as both boards offer extensive language support. With a willingness to explore a bit, you can accomplish virtually anything using either board.

 

Programmable I/O

The abbreviation PIO, which stands for programmable I/O, provides the capability to integrate additional communication interfaces and generate novel interfaces. This functionality is entirely lacking in the ESP32, posing a potential challenge, particularly for advanced hardware enthusiasts requiring connectivity to legacy hardware. Programmable I/O proves to be an immensely potent feature, making the RP2040 a preferable choice for projects where this capability is essential.

 

RAM and Clock Frequency

The ESP32 C3 is equipped with 400KB SRAM for its RAM flash memory, surpassing the Raspberry Pi Pico, which has 264 KB. Notably, these microcontrollers diverge in their clock frequencies—the ESP32 C3 operates at a clock speed of 160 MHz, while the Raspberry Pi Pico runs at a slightly lower clock frequency of 133 MHz.

 

Wireless Connectivity

The ESP32 C3 offers support for Wi-Fi MAC and Wi-Fi Baseband connections. In contrast, the Raspberry Pi Pico lacks Wi-Fi connectivity, and this absence might be a determining factor in your decision-making process for selecting a microcontroller.

In terms of long-range Bluetooth capabilities, the ESP32 C3 is equipped with Bluetooth 5 LE, providing secure connectivity to the Internet of Things applications. However, Bluetooth connectivity is not an option for the Raspberry Pi Pico.

 

Supported Interface

Both microcontrollers support various interfaces, with the ESP32 C3 being compatible with I2C, GPIO, ADC, PWM, and UART interfaces. On the other hand, the Raspberry Pi Pico supports additional interfaces, including 2 × I2C, 2 × SPI, 16 × PWM channels, and 2 × UART.

 

Flash Memory

The Raspberry Pi Pico is equipped with a 2 MB flash memory. In contrast, the ESP32 C3 boasts a maximum flash memory capacity of 16 MB. The justification for the higher flash memory in the ESP32 C3 becomes apparent in situations where there is a greater demand for memory, especially in areas with connectivity requirements.

Conversely, the Raspberry Pi Pico, lacking Bluetooth and Wi-Fi connectivity, finds its 2 MB flash memory to be adequate. In the context of this microcontroller, the allocated flash memory proves sufficient for its functionalities.

 

RP2040 vs. ESP32: What are the Similarities?

  1. Dual-core processors: Both the RP2040 and ESP32 feature dual-core processors, delivering a combination of high performance and low power consumption.
  2. Programmable input/output (PIO) subsystem: Both the RP2040 and ESP32 are equipped with programmable input/output (PIO) subsystems, enabling the implementation of custom logic and peripheral emulation.
  3. Communication interfaces: Both microcontrollers, the RP2040 and ESP32, offer a variety of communication interfaces, including UART, SPI, and I2C. These interfaces facilitate seamless interfacing with a diverse range of devices.
  4. Support for popular programming languages: Both the RP2040 and ESP32 support popular programming languages such as C, C++, MicroPython, and Arduino, providing flexibility in programming options.

 

RP2040 vs. ESP32 Comparison Table

 

Feature Raspberry Pi Pico RP2040 ESP32
Processor Arm Cortex-M0+ dual-core Tensilica Xtensa LX6 32 bit dual-core
RAM 264KB 520KB
Clock Speed 133MHz 80/160/240MHz
Operating Voltage 1.8-5.5V DC 2.2-3.6V
Operating Temperature -20 °C to +85 °C –40 °C to +125 °C
Flash 2MB 4MB
External Flash Support 16MB 16MB
RTC Memory Not specified 16KB
I2S 1 2
Wi-Fi No 802.11b/g/n
Bluetooth No Bluetooth 4.2, BLE
Ethernet No 10/100 Mbps
Other Interfaces 2 × UART, 2 × I2C, 2 × SPI, 16 × PWM channels 2 × I2S, 2 × I2C, 3 × UART, 4 × SPI, 16 × PWM channels
Sensors Temperature Touch, Temperature, Hall Effect
GPIO 26, plus 3 analogue pins 34 programmable pins
PIO 8 No
Native USB Support USB 1.1 (Device or Host) No
ADC  x4 12-bit 12 bit SAR ADC up to 18 channels
Deep sleep consumption 18 µA (Dormant) 39 µA (Sleep) 10 µA, Yes
Secure flash - 1024-bit OTP secure boot
Cryptography support - AES, SHA-2, RSA, ECC, RNG
Dimensions 7mm x 7mm 6mm x 6mm

 

RP2040 vs. ESP32: Which Microcontroller is Better?

It's not accurate to definitively state that the ESP32 is superior to the RP2040 or vice versa, as each microcontroller possesses its own set of strengths and weaknesses. The choice between them relies on the specific requirements of the project. However, here are a few reasons why someone might opt for the ESP32 over the RP2040:

  • Built-in Wi-Fi and Bluetooth: One significant advantage of the ESP32 is its integrated Wi-Fi and Bluetooth connectivity. This proves beneficial for projects demanding wireless communication, providing a notable edge over the RP2040, which lacks built-in wireless capabilities.
  • More peripherals and interfaces: The ESP32 offers a broader array of peripherals and interfaces compared to the RP2040. This includes support for Ethernet, SD/SDIO/MMC, and CAN 2.0, making it a preferable choice for projects requiring these specific interfaces.
  • Greater availability: The ESP32 enjoys more widespread use and is a more established microcontroller than the RP2040. Consequently, it may be easier to access documentation, tutorials, and support for the ESP32.

 

 

 

ESP32 vs. STM32 vs. RP2040

The ESP32 is suitable for straightforward networking tasks, offering capabilities in BLE and Wi-Fi. At the same time, the STM32 finds applications in a broader range of uses, often combined with other chipsets for communication and sensing in various products(we have provided a comprehensive comparison guide for ESP32 and STM32 in the previous article). Notably, the RP2040 outshines the STM32 in flash memory, boasting 2MB compared to the STM32's 64KB. The operating temperature of the STM32 surpasses that of the RP2040, with a range of -40 °C to +85°C for the former and -20 °C to +85°C for the latter.

The Raspberry Pi Pico, designed with beginners in mind, utilizes MicroPython to introduce users to the realm of the Internet of Things and microcontrollers. On the other hand, the RP2040 stands out as a well-designed microprocessor versatile enough for nearly any Internet of Things project. Conversely, the ESP32, with its compact yet capable nature, offers a cost-effective, low-power, and compact microcontroller solution suitable for a variety of IoT applications.

 

 

Conclusion

In conclusion, both the RP2040 and ESP32 have become prominent choices in the embedded systems industry, showcasing power and versatility. While the RP2040 boasts advantages such as a higher clock speed, more on-chip RAM, and lower power consumption, the ESP32 distinguishes itself through built-in Wi-Fi and Bluetooth connectivity, a richer set of peripherals and interfaces, and wider availability.

When faced with the decision between these two microcontrollers, it is crucial to evaluate the project's specific requirements and prioritize the features and capabilities deemed most crucial. Both the RP2040 and ESP32 cater to a diverse array of applications, ranging from simple hobbyist projects to intricate IoT applications.

Ultimately, the selection between RP2040 and ESP32 hinges on the particular needs of the project, with each microcontroller presenting its unique strengths and weaknesses. By comprehending the commonalities and distinctions between these microcontrollers, developers can make informed choices, selecting the most suitable option for their specific application and fostering the creation of innovative and potent embedded systems.

 

Read More

Get Instant Online Quote

FAQ

  • How much power does a Pico vs ESP32 use?

    The Raspberry Pi Pico has a power consumption of 91mA. On the other hand, the ESP32 C3 offers three distinct options; when utilizing Wi-Fi, it exceeds 100mA in power consumption.

  • Does the ESP32 have an FPU?

    The ESP32 incorporates one or two low-power Xtensa® 32-bit LX6 microprocessor(s) with the following characteristics: • 7-stage pipeline to accommodate clock frequencies of up to 240 MHz (160 MHz for ESP32-S0WD) • 16/24-bit Instruction Set ensuring high code-density • Inclusion of a Floating Point Unit • Integration of DSP instructions, including a 32-bit multiplier, a 32-bit divider, and a 40-bit MAC • Support for 32 interrupt vectors derived from approximately 70 interrupt sources.

  • Why ESP32 is better than RP2040?

    The CPU speed of the RP2040 is 133 MHz, whereas the ESP32 operates at 240 MHz.

  • What is the difference between Raspberry Pi Pico and RP2040?

    The Arduino RP2040 Connect marks Arduino's debut with a development board based on the RP2040. Sharing the same microcontroller unit (MCU) as the Raspberry Pi Pico, it boasts similar specifications. However, the Pico, being marginally larger, provides additional usable GPIO pins.

  • Is Raspberry Pi Pico faster than Arduino?

    The RP2040 in the Raspberry Pi Pico is notably more sophisticated, featuring a 32-bit Arm Cortex-M0+ processor capable of variable frequencies up to 133 MHz.

  • How fast is ESP32 compared to Arduino?

    Regarding connectivity, many Arduino boards, such as the Arduino Zero, lack integrated Wi-Fi or Bluetooth capabilities. To enable these features, an additional Ethernet shield must be acquired separately. In contrast, the Esp32 is equipped with built-in Wi-Fi, making it better suited for IoT projects.

  • Is ESP32 better than ESP8266?

    Overall, the ESP32 exhibits superior performance, but it comes at a higher cost compared to the ESP8266.

  • What can replace ESP32?

    Raspberry Pi Pico, STM32 Series, Arduino Nano, Teensy, nRF5xxxx and Other ESP versions.

Still, need help? Contact Us: [email protected]

You need to log in to reply. Sign In | Sign Up

Please enter your content

Subscribe to our communication service and stay in real-time sync with the latest updates on our website