ESP32 vs ESP8266 which is better
As this custom Internet of Things (IoT) series is concerned with creating a custom IoT platform, we need to choose an IoT device that will interact with it. Therefore, in this article, we will compare two commonly used IoT products found in the maker world and see which one we will be choosing. Learn more about the ESP8266 vs. ESP32 system on a chip (SoC) microcontrollers!
Custom IoT Solutions Part 1 - Intro to the Internet of Things
Custom IoT Solutions Part 2 - ESP32 vs ESP8266
Custom IoT Solutions Part 3 - HTTP vs MQTT
Custom IoT Solutions Part 4 - Create an HTTP Post System
Custom IoT Part 5 - How to Make HTTP GET Requests
IoT Devices
Creating IoT projects requires the use of an Internet connection and therefore a device that is capable of establishing an Internet connection. Wi-Fi USB dongles allow for computers to connect to wireless networks, but some maker projects will not be able to connect to such USB devices. Therefore, a specialised maker-friendly device is needed that will allow us to connect to the Internet while being usable with commonly found hardware such as Arduinos, PIC microcontrollers, and CircuitPython. Luckily, you can find many such devices, and the two most common are the ESP8266 and the ESP32. But which is better, the ESP32 vs. ESP8266, and why?
What is the ESP8266?
Image credit: SparkFun Electronics, used with permission under the CC BY 2.0 license
The ESP8266 is a Wi-Fi SoC that integrates all the needed components to create a fully functional Wi-Fi device. Onboard the SoC is a custom 32-bit processor, the L106, which is clocked at 80MHz with 32KB of instruction space, 80KB user data, and 16 GPIO pins as well as a variety of different peripherals including a serial peripheral interface (SPI), inter-integrated circuit protocol (I2C), universal asynchronous receiver-transmitter (UART), and an analog-to-digital converter (ADC). The ESP8266 integrated circuit (IC) itself is in an unfriendly maker package, which is why most makers instead purchase the ESP-01 which integrates the ESP8266, onboard flash memory, and other various components.
While the ESP8266 can be programmed directly in the Arduino integrated development environment (IDE) as a stand-alone microcontroller, it can also be used with ATtention (AT) commands which are used to control modems, via the control of an external microcontroller. The usefulness of AT commands is that the ESP8266 is pre-programmed to run AT commands when sent out of the factory and can be connected straight to a microcontroller’s UART port. From there, a microcontroller can make requests to connect to Wi-Fi, connect to servers, and send or receive data. But AT commands can be complex to work with which is why it is often advised to use a pre-existing library on the microcontroller to handle these commands.
What is the ESP8266: A low-cost Wi-Fi enabled microchip that can add wireless connectivity to microcontrollers.
What is the ESP32?
Image credit: Brian Kent, used with permission under the CC BY-SA 4.0 license
The ESP32 is an upgraded version of the ESP8266, and works in a very similar way. The core of the ESP32 is a Xtensa dual-core 160MHz (or 240MHz depending on the model) 32-bit processor with an ultra-low power co-processor, 520KB SRAM, multiple input/output (I/O) connectors including digital-to-analog converters (DACs), ACDs, GPIO, I2C, SPI, inter-IC sound (I2S), UART, and controller area network (CAN). The ESP32, unlike the ESP8266, also features integrated Bluetooth v4.2 which increases its connectivity options and supports Bluetooth low-energy (BLE) mode. Also integrated into the ESP32 is hardware security in the form of cryptographic acceleration, flash encryption, and secure boot making the ESP32 a secure platform for IoT project prototyping.
Again, the ESP32 SoC itself is not maker-friendly and thus most makers will use a pre-made module that integrates all needed components to work with the ESP32 easily. While there are plenty of options to choose from such as the Adafruit Huzzah 32, nearly all operate in the same way whereby the ESP32 connects to a USB/UART bridge that allows a computer to see the ESP32 as a communication (COM) port. While the ESP32 does support AT commands for being controlled via an external microcontroller, it is often used as the primary microcontroller.
What is the ESP32: A low-cost SoC microcontroller outfitted with Wi-Fi and Bluetooth.
Which is Better, the ESP32 vs. ESP8266?
To compare the two different devices, it is best to tabulate the data to get a better idea of what each device can offer.
Category |
ESP8266 |
ESP32 |
Winner |
Processor |
80MHz 32-Bit RISC |
Up to dual-core 240MHz 32-Bit processor |
ESP32 |
Memory |
32KB Instruction 80KB User Data |
520KM SRAM |
ESP32 |
Peripherals |
16 GPIO, UART, I2C, I2S, ADC |
> 16 GPIO, UART, I2C, I2S, ADC, DAC, CAN |
ESP32 |
Wi-Fi |
Yes |
Yes |
Neither |
Bluetooth |
No |
Yes |
ESP32 |
Hardware Security |
No |
Yes |
ESP32 |
SSL Supported |
Yes – Not very well |
Yes |
ESP32 |
Price |
Low |
High |
ESP8266 |
Programmability |
Not Easy |
Easy |
ESP32 |
Maker Friendly |
No – 8 Pin Device Not Friendly |
Yes |
ESP32 |
Software Support |
Yes but getting old |
Yes – Still relevant |
ESP32 |
Winner – The ESP32
Both the ESP8266 and ESP32 SoC microcontrollers provide makers with an Internet communication device, but the ESP32 is the clear winner in this case. The ESP8266 can be directly programmed by the Arduino IDE, although it is often more complex to do so whereas the ESP32 is easily programmed. The faster processor and greater memory size of the ESP32 allow for considerably larger projects to be designed on a single SoC, and the strong security features of the ESP32 make it a more secure device. Moreover, the ESP32 is a reliable board, granted its firmware and connected peripherals may at times be unreliable. The larger memory capacity and greater processing power also make secure sockets layer (SSL) connections more viable which are essential requirements in a world where security is paramount.
ESP32 devices generally have more GPIO to work with which make them more useable in complex projects. Since many ESP32 development boards come with small cameras, this suggests that the ESP32 is a very capable board. The ESP8266 is better suited for situations where an application must use a microcontroller for historic reasons that require an Internet connection to help modernise it. The cost difference between the ESP8266 and ESP32 is small enough that paying extra for the ESP32 is worth it when considering that the pinout of such development boards is breadboard-friendly (which the ESP-01 is not), the increased processing power allows for better security, and the larger RAM allows for projects that the ESP8266 would never be able to run.
Conclusion - What's the Difference in the ESP8266 vs. ESP32
Thus, from this day on all our of custom IoT platform projects will be used with the ESP32 which will be programmed in the Arduino IDE. The Arduino IDE will give us the option to use pre-made libraries which will make writing Internet-related code easier as well as simplify what is normally a very complex task. A few lines of code in C++ for the ESP32 can get us connected to a Wi-Fi network and Internet server so that we can begin our journey of creating a custom IoT platform! While all ESP32 devices work in nearly identical ways, the specific device that will be used in the series to come will be the Adafruit Huzzah32.
Leave your feedback...