ESP32 vs. ESP8266: How to Choose the Right Microcontrollers

Published:January 29, 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.

The Internet of Things (IoT) has emerged as a prominent subject in both academic and industrial domains. ESP32 and ESP8266 stand out as cost-effective microcontrollers equipped with Wi-Fi modules, making them ideal for do-it-yourself projects in the Internet of Things (IoT) and Home Automation sectors.

Both microcontrollers boast a 32-bit processor and feature GPIOs supporting various protocols such as SPI, I2C, UART, ADC, DAC, and PWM. What sets them apart is the built-in wireless networking capability, distinguishing them from other microcontrollers like the Arduino. This implies that, at a remarkably low cost, you can effortlessly manage and monitor devices remotely through Wi-Fi or Bluetooth (in the case of ESP32). Alternatively, if wireless capabilities are not needed, you can utilize the ESP32/ESP8266 for input and output control, similar to the Arduino. However, it's crucial to note that while the Arduino operates on 5V logic, the ESP32 and ESP8266 operate at 3.3V.

What’s the difference between ESP32 and ESP8266? Which one should you choose for your projects? In this article, we’ll compare the two popular microcontrollers to help you choose the right one for your project.

 

Overview of ESP32

 

ESP32 stands out as a range of economically efficient system-on-a-chip microcontrollers. Positioned as an enhanced iteration of the ESP8266 series, the ESP32 offers Wi-Fi and, in certain models, Bluetooth connectivity specifically tailored for embedded devices, commonly referred to as IoT devices. Espressif Systems is the creative force behind the development of the ESP32 series, designed to address the security limitations found in the ESP8266.

While technically the term "ESP32" denotes the chip itself, manufacturers often use it interchangeably to refer to both the modules and development boards that incorporate this chip.

The initial ESP32 chip featured a single-core Tensilica Xtensa LX6 microprocessor with a clock rate exceeding 240 MHz, ensuring a commendable data processing speed.

Subsequent models, such as the ESP32-C and -S series, introduced both single and dual-core variations, utilizing a Risc-V CPU model in place of Xtensa. Risc-V, akin to the widely supported and recognized ARM architecture, distinguishes itself with its open-source nature and user-friendly characteristics. Notably, Risc-V and ARM enjoy robust support from GNU compilers, whereas Xtensa requires additional support and development efforts to integrate with compilers.

Various chip models are available within the ESP32 series, including:

  • ESP32-D0WDQ6 (and ESP32D0WD)
  • ESP32-D2WD
  • ESP32-S0WD
  • System in Package (SiP) – ESP32-PICO-D4
  • ESP32 S series
  • ESP32-C series
  • ESP32-H series

 

Overview of ESP8266

 

The ESP8266 stands as a comprehensive System-on-a-Chip (SOC) circuit, functioning as a self-contained Wifi module equipped with an IP/TCP protocol stack. Through your Wifi connection, the ESP8266 facilitates access for any microcontroller.

The primary role of the ESP8266 is to either host applications or offload all Wifi networking functions. Its remarkable durability allows it to consistently operate even in challenging industrial environments, owing to its wide operating temperature range. Additionally, it incorporates an energy-efficient architecture and a 32-bit Tensilica processor.

Operating on the 2.4 GHz Wi-Fi band with IEEE 802.11 bgn, the ESP8266 module enables microcontrollers to establish a connection. This can be achieved by using ESP-AT firmware to provide Wi-Fi connectivity to external host MCUs, or by operating as a self-sufficient MCU through an RTOS-based SDK. With a full TCP/IP stack, the module facilitates data processing and allows for the reading and control of GPIOs.

 

ESP32 vs. STM32: Specifications

The ESP32 serves as the successor to the ESP8266, introducing an additional CPU core, faster Wi-Fi, expanded GPIOs, and support for Bluetooth 4.2 and Bluetooth Low Energy. Notably, the ESP32 incorporates touch-sensitive pins for waking up from deep sleep, an integrated hall effect sensor, and, in earlier versions, a built-in temperature sensor (though recent versions omit this feature).

While both boards are cost-effective, the ESP32 is slightly pricier. The ESP32 typically ranges from $6 to $12, while the ESP8266 can be found in the $4 to $6 range (actual costs may vary based on the source and specific model).

The following table shows the specification differences between the ESP32 and the ESP8266 chips:

 

Specifications ESP32 ESP8266
MCU Xtensa Dual-Core 32-bit LX6 with 600 DMIPS Xtensa Single-core 32-bit L106
802.11 b/g/n Wi-Fi HT40 HT20
Bluetooth Bluetooth 4.2 and BLE X
Typical Frequency 160 MHz 80 MHz
SRAM X
Flash X
GPIO 34 17
Hardware /Software PWM None / 16 channels None / 8 channels
SPI/I2C/I2S/UART 4/2/2/2 2/1/2/2
ADC 12-bit 10-bit
CAN X
Ethernet MAC Interface X
Touch Sensor X
Temperature Sensor (old versions) X
Hall effect sensor X
Working Temperature -40ºC to 125ºC -40ºC to 125ºC

 

For practical testing and prototyping, using bare ESP32 or ESP8266 chips can be challenging. Development boards designed for these chips are more convenient, providing essential circuitry for powering the chip, seamless connection to computers, easy code uploading, peripheral connection pins, built-in power and control LEDs, and other beneficial features.

Commonly used development boards include the ESP32 DEVKIT DOIT Development board and the ESP8266 ESP-12E NodeMCU Kit. These are particularly recommended for beginners.

 

ESP32 vs. STM32: GPIOs

The ESP32 surpasses the ESP8266 in terms of GPIO count, affording you the flexibility to designate specific pins for UART, I2C, and SPI functionalities by configuring the code. This capability stems from the ESP32 chip's multiplexing feature, enabling the assignment of multiple functions to a single pin.

Failure to specify these functions in the code will result in default pin assignments, illustrated in the accompanying diagram. It's important to note that this example pertains to the ESP32 DEVKIT V1 DOIT board (36 GPIO version), and pin locations may vary based on the manufacturer.

 

ESP32 Pinout

 

 

As a reference point, consider the pin configuration diagram for the ESP8266 ESP-12E NodeMCU Kit.

 

ESP8266 Pinout

 

PWM, ADC, and More

You have the flexibility to configure PWM signals on any GPIO, allowing for customizable frequencies and duty cycles specified in the code.

Concerning analog pins, although they remain fixed, the ESP32 stands out by supporting measurements on 18 channels (analog-enabled pins), a significant advancement compared to the single 10-bit ADC pin found on the ESP8266. Additionally, the ESP32 boasts two 8-bit DAC channels.

Furthermore, the ESP32 incorporates 10 capacitive sensing GPIOs capable of detecting touch, facilitating event triggering, or waking up the ESP32 from a deep sleep, among other applications.

An added advantage of the ESP32 is its built-in support for the Bluetooth communication protocol, a feature absent in the ESP8266.

 

ESP32 vs. ESP8266: Arduino IDE

Let's conduct a comparison between the two modules using the Arduino IDE, a widely utilized platform for programming ESP32 and ESP8266 microcontrollers. Both boards are compatible with the Arduino IDE, offering convenience for users familiar with the platform. They share the same library and command set. However, it's essential to note that certain libraries may exclusively support either the ESP32 or ESP8266, requiring minor adjustments.

 

Programming ESP32 on Arduino IDE

 

  • In your Arduino IDE, navigate to File > Preferences.
  • Access the Boards Manager: Tools > Board > Boards Manager…
  • Search for ESP32 and click the install button for "ESP32 by Espressif Systems."
  • The installation should be complete in a few seconds.

 

Installing ESP8266 Add-on in Arduino IDE

 

  • In your Arduino IDE, go to File > Preferences.
  • Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into the "Additional Boards Manager URLs" field (as depicted in the figure) and click "OK."
  • Open the Boards Manager: Tools > Board > Boards Manager…
  • Look for ESP8266 and press the install button for "ESP8266 by ESP8266 Community."
  • The installation should be finalized within a few seconds.

 

ESP32 vs ESP8266: MicroPython Firwmare

 

An alternative and widely embraced approach to programming the ESP32 and ESP8266 boards involves the utilization of MicroPython firmware.

MicroPython stands as a reinterpretation of Python 3 tailored specifically for microcontrollers and embedded systems. It closely resembles conventional Python, implying that if you possess proficiency in Python programming, you inherently possess the skills to program in MicroPython.

Notably, in MicroPython, the majority of Python scripts exhibit compatibility with both boards, in contrast to the Arduino IDE. This implies that, more often than not, the same script can be applied interchangeably for both ESP32 and ESP8266.

Embarking on MicroPython firmware for the ESP32 and ESP8266 is a straightforward process, and our complimentary guides provide comprehensive assistance:

 

ESP32 vs ESP8266: Advantages and Disadvantages

 

ESP32 Advantages and Disadvantages

 

Advantages

  • The ESP32 provides dual-core processing ranging from 160MHz to 240MHz.
  • It enables cost-effective device control and monitoring through Wi-Fi or Bluetooth.
  • The ESP32 features an increased number of GPIOs.
  • With a high-speed capability of 150Mbps, the ESP32 ensures efficient performance

 

Disadvantages

  • The ESP32 comes with a higher price tag compared to the ESP8266.

 

ESP8266 Advantages and Disadvantages

 

Advantages

  • The ESP8266 Module boasts robust onboard processing and storage capabilities, facilitating seamless integration with sensors and various applications.
  • It demonstrates a high level of on-chip integration, minimizing the need for external reference circuitry.
  • For Bluetooth and VoIP applications coexistence interfaces, the ESP8266 employs APSD. Additionally, it incorporates a self-calibrated radio frequency (RF), ensuring compatibility with various operating conditions without the need for additional RF components.

Disadvantages

  • Unlike the ESP32, the ESP8266 lacks Bluetooth connectivity.
  • The GPIO count in the ESP8266 is notably lower compared to the ESP32.

 

ESP32 vs. ESP8266: Which one is Better?

 

The choice between the two boards depends on your specific needs, as each offers distinct advantages and drawbacks.

The ESP8266, being more budget-friendly than the ESP32, serves well for straightforward DIY IoT projects despite having fewer features. Its "older" status results in better software support, making it easier to find assistance. Nevertheless, limitations in GPIO mapping and potential pin insufficiency may prompt the use of the ESP32 for more complex tasks.

The ESP32, boasting greater power, an expanded array of GPIOs with multifunction capabilities, faster Wi-Fi, and Bluetooth support, stands as a more advanced option. Although some find it more complex, especially compared to the ESP8266, programming the ESP32 can be straightforward, especially when utilizing the Arduino language or MicroPython.

However, the ESP32 comes at a higher cost, making the ESP8266 more economical for simpler IoT projects. Additionally, as a newer model, the ESP32 may face challenges due to incomplete software optimization, resulting in fewer support resources and potential bugs. Nevertheless, over time, these issues are expected to be addressed, allowing both boards to excel in their respective applications.

 

ESP32 vs. ESP8266 Comparison Table

 

Comparison ESP32 ESP8266
Microcontroller Architecture Dual-core Tensilica Xtensa LX6 Single-core Tensilica Xtensa LX106
Clock Speed Up to 240MHz Up to 160MHz
RAM 520KB SRAM 160KB SRAM
Flash 4MB Flash 4MB Flash
GPIO Pins Up to 34 Up to 17
Digital-to-Analog Converters (DAC) 2 1
Analog-to-Digital Converters (ADC) 18 (12-bit) 10 (10-bit)
Communication Interfaces UART, I2C, SPI, I2S, CAN, Ethernet, Wi-Fi, Bluetooth UART, I2C, SPI, GPIO, Wi-Fi
Wireless Connectivity Wi-Fi, Bluetooth Wi-Fi
Operating Voltage 3.3V 3.3V
Built-in USB Yes (with USB 2.0 support) No
Low Power Modes Yes Yes
Power consumption Higher Lower
Cost Higher Lower
Community Support Large and mature community support Large community support, but not as extensive as ESP32

 

 

 

Why is ESP32 Special?

The ESP8266 and ESP32 system-on-chip (SoC) microcontrollers serve as Internet communication devices for builders, yet the ESP32 stands out. While the Arduino IDE is capable of directly programming the ESP8266, it often presents more challenges compared to the straightforward programming of the ESP32. The ESP32's faster processor and increased memory capacity enable the development of significantly larger projects on a single SoC. Additionally, the ESP32 boasts robust security features, enhancing its overall device security.

Moreover, the ESP32 proves to be a reliable board, despite occasional flakiness in its firmware and connected peripherals. The growing viability of secure socket layer (SSL) connections is tied to the expanding memory and processing power, crucial factors in a society prioritizing security.

In a broader context, ESP32 devices offer more GPIO options, enhancing their utility in complex applications. The inclusion of small cameras in many ESP32 development boards further positions the ESP32 as a highly capable device.

 

 

 

Applications ESP8266 IoT Module

The ESP8266 module possesses the capability to process data, read inputs, and manage GPIOs. It features a 2.4GHz Wi-Fi in the 802.11 BGN variant and incorporates WPA2 encryption support. Various applications of this module include:

  • Efficiently utilizing its data processing feature to interpret both digital and analog signals from sensors. It is also employed for intricate calculations such as adders or multipliers in diverse driver algorithms.
  • The module serves the purpose of connecting to any available network and can be utilized to establish a personalized P2P network.
  • Leveraging the Wi-Fi functionality optimally enables wireless data transmission to a nearby router.
  • In scenarios where a P2P network or a smartphone is unavailable, a direct connection between two ESPs can still be established.

 

Where to Use IoT Module?

 

Grasping the application scope of the IoT module enables us to identify the domains where its full potential can be realized. Key areas where the module proves essential include:

  • Employing WiFi for location triangulation.
  • Implementing automated outlets in diverse retail stores and workshops.
  • Enhancing industrial security measures in residential and commercial sectors.
  • Enabling wireless monitoring of CCTV cameras and sensors that contribute data.
  • Application in the field of robotics, catering to both academic and professional pursuits.

 

How to Run ESP8266 IoT Module?

Upon gaining insights into its applications, some of you may be eager to engage with this remarkable module. To integrate the ESP8266 module with Arduino, adhere to the steps outlined below:

  • Step 1: Establish the connection of the designated module to your PC.
  • Step 2: Initiate the Arduino IDE.
  • Step 3: Navigate to the "File" menu and subsequently select "Preferences."
  • Step 4: Incorporate the provided link into the Additional Board Manager.
  • Step 5: Access "Tools" and then proceed to the Board Manager.
  • Step 6: Identify the ESP8266 module and activate it by clicking on it.

 

ESP32 vs. STM32 vs. ESP8266 vs. RP2040

The following table compare ESP32, STM32, ESP8266, and RP2040 in terms of various aspects:

  ESP32 STM32 ESP8266 RP2040
Microcontroller Manufacturer Espressif Systems STMicroelectronics Espressif Systems Raspberry Pi
Architecture Xtensa LX6 ARM Cortex-M series Xtensa LX106 Dual-core ARM Cortex-M0+
Wireless Connectivity Wi-Fi and Bluetooth Typically, external modules are used for wireless connectivity Wi-Fi No built-in wireless connectivity
Peripheral Integration Rich set of peripherals including ADC, DAC, SPI, I2C, I2S, UART, PWM, etc. Extensive range of peripherals, varies by model, includes ADC, DAC, SPI, I2C, USART, PWM, etc. Limited compared to ESP32, includes GPIO, ADC, SPI, I2C, PWM, etc. Moderate set of peripherals, includes GPIO, ADC, SPI, I2C, UART, PWM, etc.
Memory Typically comes with more Flash and RAM compared to others. Flash and RAM vary among models. Has less memory compared to ESP32. Moderate Flash and RAM.
Processing Power Dual-core processor running at higher clock speeds. Processing power varies widely among models. Single-core processor, slower compared to ESP32. Dual-core ARM Cortex-M0+ with a moderate clock speed.
Community and Documentation Large community, well-documented. Large community, extensive documentation. Established community, good documentation. Growing community, documentation improving.
Development Environment PlatformIO, Arduino IDE STM32CubeIDE, Keil, Arduino IDE PlatformIO, Arduino IDE Thonny, MicroPython, C/C++ with the Raspberry Pi Pico SDK
Use Cases Internet of Things (IoT) devices, home automation, industrial applications. Embedded systems, industrial automation, robotics. IoT devices, Wi-Fi modules. Microcontroller projects, education, robotics.
Cost Generally cost-effective Cost varies based on model and features Economical Raspberry Pi Pico, featuring RP2040, is cost-effective

 

RP2040 vs ESP32: The Raspberry Pi Pico serves as a user-friendly microcontroller board, employing MicroPython to introduce beginners to the realms of the Internet of Things and microcontrollers. The RP2040, a well-engineered microprocessor, finds utility in a broad spectrum of IoT projects, offering ample processing power for efficient task execution. With a dual-core processor featuring an ARM M0+ CPU type, it provides these capabilities at an attractive price point of approximately $4. This makes it an excellent choice for students engaging in tasks that don't necessitate internet access. On the flip side, the ESP32, characterized by its compact design, affordability, low power consumption, and diminutive size, stands out as a proficient microcontroller suitable for various IoT applications.

ESP32 vs STM32: ESP32 distinguishes itself in IoT applications, boasting affordability, impressive performance, an active open-source community, and suitability for rapid development. In contrast, STM32 dominates the industrial sector and is renowned for its robust stability, catering to complex systems and scenarios demanding high reliability. The choice between ESP32 and STM32 depends on factors such as the developer's technical proficiency, project requirements, and specific application needs. ESP32 is an optimal choice for beginners and IoT projects, while STM32 caters to experienced engineers and applications in industrial control.

 

Conclusion

It is apparent that both the ESP32 and ESP8266 serve as remarkable toolkits. Preferences may sway towards one or the other based on specific considerations. The ESP8266 exhibits lower current consumption in comparison to its counterpart, while the latter boasts a higher number of digital pins. If energy efficiency and Bluetooth compatibility are paramount, opting for the ESP32 module is advisable. Therefore, the choice should align with your specific requirements. Nevertheless, both devices stand as commendable representatives within their respective niches.

 

Read More

Get Instant Online Quote

FAQ

  • Is ESP32 better than ESP8266?

    Yes, ESP8266 offers a swift processor and ample memory size, enabling the design of significantly larger projects on a single SOC. It is cost-effective, compact, and compatible with embedded devices.

  • Can I replace ESP8266 with ESP32?

    The older Gateways contain the ESP8266 chip, but there's an option to upgrade your ESP8266 Gateway to the more powerful ESP32.

  • How long can ESP8266 run continuously?

    One and a half days.

  • How long does it take for ESP8266 to wake up during light sleep?

    The waking process takes less than 3 milliseconds.

  • How long can ESP32 stay on?

    Approximately 12.5 hours.

  • Which is better ESP32 or Raspberry Pi?

    The Raspberry Pi is known for its greater power and popularity. Refer to this article for more information about Raspberry Pis RP2040 vs. ESP32.

  • Why use ESP32 instead of Arduino?

    ESP32 is more well-suited for advanced projects that demand enhanced processing capabilities and connectivity.

  • Which is better Arduino or ESP8266?

    Both Arduino and ESP8266 possess distinct advantages and drawbacks in comparison to each other. However, the ESP8266 chip-based microcontroller development board stands out for its cost-effectiveness when compared to Arduino.

  • Can ESP32 connect to 5 GHz Wi-Fi?

    The ESP32 Ethernet, Wi-Fi, and BLE PLC controller series incorporate an integrated 5 GHz Wi-Fi chip known as ISM43340. The 5 GHz Wi-Fi band, an enhanced version of previous bands like the 2.4 GHz band, offers improved performance.

  • What is ESP32 used for?

    The ESP32 can operate independently as a standalone system or act as a subordinate device to a host MCU, thereby minimizing communication stack overhead on the primary application processor. It can connect with other systems to deliver Wi-Fi and Bluetooth functionality using either SPI/SDIO or I2C/UART interfaces.

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