Many people who aren’t familiar with electronics often struggle to differentiate between ESP8266 and ESP32. People have many doubts regarding which board to use and what is the difference between these, so from this blog, you will be clear about the difference between esp32 and esp8266.
In this blog, we will compare two commonly used IoT products found in the maker world and see which one we will be choosing.
Both ESP32 and ESP8266 are cheap WiFi-based SOC (Systems on Chip) perfectly suited for DIY projects in the Internet of Things. Both have 32-bit processors, ESP32 is dual-core 80Mhz to 240MHz CPU and ESP8266 is an 80MHz single-core processor. These modules come with GPIOs that support various protocols like SPI, I2C, UART, ADC, DAC, and PWM. The ESP32 and ESP8266 work at 3.3V.
ESP8266
The ESP-12E module on the development board contains an ESP8266 chip with a Tensilica Xtensa 32-bit LX106 RISC microprocessor that supports RTOS and operates at 80 to 160 MHz adjustable clock frequency. The ESP8266 is a low-cost, user-friendly device for connecting your IoT projects to the internet. The nodemcu ESP8266 includes an 802.11b/g/n HT40 Wi-Fi transceiver, allowing it to connect to a WiFi network and interact with the Internet, the module can function as both an access point (creating a hotspot) and a station (connecting to Wi-Fi), it can simply retrieve data and post it to the internet, making the Internet of Things (IoT) as simple as feasible. This expands the capabilities of the ESP8266 NodeMCU.
This module has a powerful enough on-board processing and storage capability that allows it to be integrated with the sensors and other application-specific devices through its GPIOs with minimal development up-front and minimal loading during runtime. 128 KB RAM and 4MB of Flash memory (for application and data storage), which is more than enough to handle the huge strings that make up web pages, JSON/XML data, and everything else we throw at IoT devices these days.
ESP8266 NodeMCU Module is available in two variants where one is built with CP2102 USB to UART bridge and other with CH340 USB to UART bridge.
Power
The board has an LDO voltage regulator to maintain the voltage stable at 3.3V, while the ESP8266's operational voltage range is 3V to 3.6V. When the ESP8266 draws up to 80mA during RF transmissions, it can reliably supply up to 600mA, which should be more than enough. The regulator's output is also broken out to one of the board's sides and labeled as 3V3. Power can be supplied to external components via this pin. The onboard MicroB USB connector provides power to the ESP8266 NodeMCU. You can utilize the VIN pin to power the ESP8266 and its peripherals directly if providing power through 5V source.
For communication, the ESP8266 requires a 3.3V power supply and 3.3V logic levels. The GPIO pins do not have a 5V tolerance.
PINOUT
The ESP8266 wifi module has a total of 17 GPIO pins available on both sides of the development board. These pins can be assigned to all sorts of peripheral duties.
- POWER PIN: The power pins consist of one VIN pin and three 3.3V pins. If you have a regulated 5V power source, you can utilize the VIN pin to directly supply the ESP8266 and its peripherals. The 3.3V pins are outputs from a voltage regulator built into the board. Power can be supplied to external components through these pins.
- I2C pins: These are used to connect all of your project's I2C sensors and peripherals. I2C Master and Slave are both supported.
- GPIO PINS: The ESP8266 NodeMCU includes 17 GPIO pins that may be programmatically assigned to different tasks like I2C, I2S, UART, PWM, IR Remote Control, LED Light, and Button. Each GPIO with digital capability can be tuned to internal pull-up or pull-down, or too high impedance.
- GROUND: It is a ground pin of the ESP8266 NodeMCU development board.
- ADC CHANNEL: The NodeMCU has a 10-bit precision SAR ADC built-in. Testing the power supply voltage of the VDD3P3 pin and testing the input voltage of the TOUT pin are two functions that can be implemented using ADC. They cannot be implemented at the same time.
- UART PINS: The ESP8266 NodeMCU features two UART ports, UART0 and UART1, which can interact at up to 4.5 Mbps and allow asynchronous communication (RS232 and RS485). For communication, UART0 (TXD0, RXD0, RST0, and CTS0 pins) can be used. It supports fluid control. However, because UART1 (TXD1 pin) only transmits data, it is typically used to print logs.
- SPI PINS: The ESP8266 has two SPIs (SPI and HSPI) that can be used in slave and master modes.
- PWM PINS: There are four channels of Pulse Width Modulation on the PCB (PWM). The PWM output can be programmatically implemented and utilized to drive digital motors and LEDs. PWM frequency range is adjustable from 1000 μs to 10000 μs, i.e., between 100 Hz and 1 kHz.
- CONTROL PINS: are used to control the ESP8266 microcontroller. Chip's Enable pin (EN), Reset pin (RST), and WAKE pin is among these pins.
There are two buttons on the ESP8266 NodeMCU. The Reset button, labeled RST and placed in the upper left corner, is used to reset the ESP8266 chip. The FLASH button is located in the bottom left corner and is used to upgrade firmware. A user-programmable LED indicator is also included on the board, which is coupled to the D0 pin.
ESP 32
The development board equips with an ESP-WROOM-32 module containing Tensilica Xtensa Dual-Core 32-bit LX6 microprocessor. This processor is comparable to the ESP8266, except it includes two CPU cores (each of which can be operated separately), a clock frequency of 80 to 240 MHz, and a performance of up to 600 DMIPS (Dhrystone Million Instructions Per Second).
The ESP32 integrates an 802.11b/g/n HT40 Wi-Fi transceiver that allows to not only connect to a WiFi network to interact with the Internet but also to create its own network to which other devices can connect directly. WiFi Direct is also supported by the ESP32, which is a suitable alternative for peer-to-peer connections that don't require an access point. It is easier to set up WiFi Direct and has substantially faster data transmission speeds than Bluetooth. The chip also supports both Bluetooth 4.0 (BLE/Bluetooth Smart) and Bluetooth Classic (BT), making it even more versatile.
The nodemcu ESP32 is a series of low-cost, low-power microcontrollers with built-in ESP32 Wi-Fi and dual-mode Bluetooth. The ESP32 is designed for low-power Internet of Things applications. Its high processing power, combined with built-in Wi-Fi, Bluetooth, and Deep Sleep Operating features, 520 KB of SRAM, 448 KB of ROM, and 4MB of Flash memory (for software and data storage) makes it appropriate for most Portable IoT devices.
Power
The board has an LDO voltage regulator to maintain the voltage stable at 3.3V, while the ESP32's Arduino operating voltage range is 2.2V to 3.6V. When the ESP32 draws up to 250mA during RF transmissions, it can reliably supply up to 600mA, which should be more than enough. The regulator's output is also broken out to one of the board's sides and labeled as 3V3. Power can be supplied to external components via this pin. The onboard MicroB USB port provides power to the ESP32 development board. You can use the VIN pin to power the ESP32 and its peripherals directly via 5V external power supply.
For communication, the ESP32 requires a 3.3V power supply and 3.3V logic levels. The GPIO pins do not have a 5V tolerance.
PINOUT
The ESP-32 board has 48 general purpose input/output pins from which only 25 are available as pin headers on both sides of the ESP-32 board. These pins can be assigned to all sorts of peripheral duties.
- POWER PINS: The VIN pin and the 3.3V pin are the two power pins. If you have a controlled 5V power source, you can utilize the VIN pin to directly supply the ESP32 and its peripherals. An on-board voltage regulator's output is connected to the 3.3V pin. Power can be supplied to external components via this pin.
- ARDUINO PINS: the hardware I2C and SPI pins of the ESP32 that you may use to connect all kinds of sensors and peripherals to your project.
- GPIO PINS: The ESP32 development board features 25 GPIO pins that can be programmatically assigned to various functions. Each digitally-enabled GPIO can be set to high impedance or internal pull-up or pull-down. It can also be set to edge-trigger or level-trigger to generate CPU interruptions when configured as an input
- GROUND: Ground pin of the ESP32 development board.
- ADC CHANNELS: The board has 12-bit SAR ADCs and 15 channels of measurement (analog enabled pins). Some of these pins can be utilized to build a programmable gain amplifier for measuring small analog signals. The ESP32 is also capable of measuring voltages while it is in sleep mode.
- DAC CHANNELS: Two 8-bit DAC channels on the circuit transform digital signals into true analog voltages. This dual DAC can drive other circuits. TouchPads The board offers 9 capacitive sensing GPIOs which detect capacitive variations introduced by the GPIO’s direct contact or close proximity with a finger or other objects.
- UART PINS: The ESP32 development board contains two UART interfaces, UART0 and UART2, which provide asynchronous communication (RS232 and RS485) and IrDA at up to 5 Mbps. UART provides hardware management of the CTS and RTS signals and software flow control (XON and XOFF) as well.
- SPI PINS: SPI Pins ESP32 features three SPIs (SPI, HSPI, and VSPI) in slave and master modes. All SPIs can also be used to connect to the external Flash/SRAM and LCD.
- ~ PWM PINS: The board has 25 channels (Nearly All GPIO pins) of PWM pins controlled by the Pulse Width Modulation (PWM) controller. The PWM output can be used for driving digital motors and LEDs. The controller consists of PWM timers and the PWM operator. Each timer provides timing in synchronous or independent form, and each PWM operator generates the waveform for one PWM channel.
EN PIN: It is used to enable ESP32. The chip is enabled when pulled HIGH. When pulled LOW the chip works at minimum power.
Which one is better, ESP8266 VS ESP32 ?
ESP8266 is a very popular, accessible platform for the implementation of energy-efficient IoT apps that operate based on a Wi-Fi connection.
In turn, the Espressif ESP32 is a relatively new and more advanced solution where creators boosted the speed of the Wi-Fi, added Bluetooth 4.2 and Bluetooth Low Energy support, and increased the number of inputs/outputs.
The ESP32 has more GPIOs than the ESP8266, and you may specify which pins are used for UART, I2C, and SPI in the code. This is feasible because of the multiplexing capability of the ESP32 chip, which allows you to assign numerous functions to a single pin. PWM signals can be set in any GPIO with the code's configurable frequencies and duty cycles. The analog pins are static, but the ESP32 supports measurements on 18 channels (analog-enabled pins), whereas the ESP8266 Arduino only has one 10-bit ADC pin. Two 8-bit DAC channels are also supported by the ESP32. Moreover, the ESP32 contains 10 capacitive sensing GPIOs, that detect touch and can be used to trigger events or wake up the ESP32 from a deep sleep. The ESP32 supports Bluetooth communication protocol by default, while the ESP8266 doesn’t
Wireless Communication
A notable difference with the ESP32 is its Bluetooth capability that allows the ESP32 to not only be limited to Wi-Fi communication, allowing it to be integrated into more projects. It supports both classic Bluetooth and Bluetooth Low Energy. While the ESP8266 does not support Bluetooth.
Processing
The ESP8266 has a built-in processor, but because of the multitasking involved in updating the Wi-Fi stack, most applications use a separate microcontroller for interfacing with the sensors, digital I/O and processing data. While using the ESP32, you may not need to use an additional micro-controller as the ESP32 has dual 32-bit microprocessors and will run on breakout boards and modules from 160 MHz up to 240MHz. This provides enough speed for any application that requires a microcontroller with connectivity.
- The ESP32 is faster than the ESP8266;
- The ESP32 comes with more GPIOs with multiple functions;
- The ESP32 supports analog measurements on 18 channels (analog-enabled pins) versus just one 10-bit ADC pin on the ESP8266;
- The ESP32 supports Bluetooth while the ESP8266 doesn’t;
- The ESP32 is dual-core, and the ESP8266 is single core;
- The ESP8266 is cheaper than the ESP32;
- The ESP8266 has a wider community (although we don’t think that at this point, the difference is that big);
- For many IoT and Wi-Fi projects, the ESP8266 can do the job for a lower price;
- Both boards can be programmed using Arduino IDE or other supported IDEs.
- Both boards support MicroPython firmware.
Here’s a comparison table for the technical specifications of the ESP8266 and ESP32:
SPECIFICATION |
ESP8266 |
ESP32 |
MCU |
Xtensa Single-core 32-bit L106 |
Xtensa Dual-Core 32-bit LX6 with 600 DMIPS |
802.11 b/g/n Wi-Fi |
YES,HT20 |
YES,HT40 |
ADC |
10-bit |
12-bit |
Hardware/Software PWM |
None / 8 Channels |
1/16 channel |
Typical Frequency |
80MHz |
160MHz |
SRAM |
160kBytes |
512kBytes |
GPIO |
17 |
36 |
Touch Sensor |
NONE |
YES |
Bluetooth |
none |
Bluetooth 4.2 |
SPI/I2C/I2S/UART |
2/1/2/2 |
4/2/2/3 |
ADC |
10-bit |
12-bit |
CAN |
NONE |
1 |
ROM |
No Programmable |
448kB of ROM for booting and core functions |
Working Temperature |
-40°C to 125°C |
-40°C to 125°C |
Conclusion
Summarizing our brief overview, we can say that the ESP8266 is an excellent budget Wi-Fi-based microcontroller but if you need something more energy-efficient and compatible with Bluetooth, consider its successor – the ESP32 module. Both the ESP8266 and ESP32 SoC microcontrollers provide hobbyists with an Internet communication device, but the ESP32 is a slightly better option. In any case, both devices are good representatives of their niches.
The ESP32 and ESP8266 are low-cost Wi-Fi modules that are ideal for Internet of Things (IoT) and Home Automation projects.