Artigo Esp32
Artigo Esp32
Artigo Esp32
Abstract—This paper discusses the Espressif Systems latest µC are already on the market and widely used for the design
product ESP32 designed for Internet of Things and embedded and development of IoT devices. These are Xbee, WhizFi,
system related projects. The ESP32 is a low-cost, low-power certain Arduino boards, etc. However, most of currently
system on a chip series of microcontrollers with Wi-Fi and offered devices are either quite expensive or large in terms of
Bluetooth capabilities and a highly integrated structure powered weight and size. Moreover, very few modules are open source
by a dual-core Tensilica Xtensa LX6 microprocessor. This paper devices and have no restriction in the operation purpose. A
provides a comparative analysis of the ESP32 with some other new device QFN48 called ESP32 will be released in the
market competitors and introduces the microcontroller market by Espressif Systems in September 2016 to replace the
specification, features and programming details. A portable,
previous µC ESP8266. ESP32 device is a powerful
wireless oscilloscope based on the ESP-WROOM-32 and a mobile
microcontroller with build in Wi-Fi and Bluetooth®, designed
application is described in detail as an example of successful
practical implementation of the device. to be a perfect solution for IoT devices [3].
This paper presents a detailed comparison of the ESP32 to
Keywords—ESP32, Internet of Things, Wi-Fi, oscilloscope its competitors including competitive analysis of its technical
features and functions. The paper also describes how to
I. INTRODUCTION program ESP32 and discusses an example application
The Internet of Things (IoT) market has rapidly expanded demonstrating a practical implementation of the
over the last few years following the increased demand in microcontroller.
communication and control for various devices and gadgets.
The main requirement applied for modern IoT devices is to II. COMPARATIVE ANALYSIS OF ESP32
provide an effective connectivity to ensure reliable remote Along with the release of ESP32, Espressif Systems also
communication and data transfer in a wireless environment. offers a corresponding module ESP-WROOM-32. Despite the
This concept for IoT devices is called 6A (Anything, Anytime, small size (25.5 x 18.0 x 2.8mm) it is very easy to use the
Anyone, Anyplace, Any service, and Any network) [1].
The IoT technology significantly impacts on behaviour
and lifestyle of people in both working and domestic
environments. The advanced communication capabilities
dramatically reshape properties and operation of industrial
automation and manufacturing, business and process
management, intelligent transportation and logistics, etc. In
terms of domestic applications, IoT enhances home
automation and introduces new, communication based
technologies such as domotics, assisted living, e-health and e-
learning, etc. [2].
In order to develop the IoT further and expand the area of
its applications, a powerful, low-cost and low-power solutions
for the IoT devices are required. Another requirement for an
IoT device is to have a small form-factor; the smaller size and
weight of the device the wider the area of its applications.
Each IoT based unit comprises of a microcontroller (µC) and a
wireless commutation module (usually WiFi), or a
combination of both in one. A large variety of modules and Fig. 1. ESP32 system structure.
143
TABLE I. MICROCONTROLLES FOR THE IOT DESIGN [4]-[7]
Size 25.5 x 18.0 x 2.8 mm 24.0 x 16.0 x 3.0 mm 20.5 x 17.5 x 2.5 mm 24.0 x 22.0 x 3.0 mm
Prize £8 £5 £16 £23
module due to integrated components such as antenna, III. ESP32 TECHNICAL DETAILS AND FUNCTIONS
oscillator and flash. Similar modules for other
microcontrollers are often used for tests and prototypes or by A. System and Memory
hobbyists. Table I compares some of those in detail [4]-[7]. ESP32 is a dual-core system with two Harvard
The table shows the details of 4 modules and µC used for Architecture Xtensa LX6 CPUs. All embedded memory,
the design of IoT devices. Actually, the variety of modules external memory and peripherals are located on the data bus
and microcontrollers for IoT are much bigger but most of and/or the instruction bus of these CPUs. The microcontroller
them have the same problems related to size, performance and has two cores – PRO_CPU for protocol and APP_CPU for
price. For example, the boards like RTLDuino are open source application, however, the purposes of those are not fixed. The
and can handle complex tasks on their own unlike the Xbee, address space for both data and instruction bus is 4GB and the
but they are quite large in terms of size. On the other hand, peripheral address space is 512KB. Moreover, the embedded
ESP32 QFN48, compared to other microcontrollers, is a very memories are 448KB ROM, 520KB SRAM and two 8KB
small component having a size of just 5mm x 5mm. Due to the RTC memory. The external memory supports up to four times
published circuit of the module ESP-WROOM-32 it is easy to 16MB Flash [4].
integrate ESP32 onto a custom PCB and design a space saving
device. The board ESP32-DevKitC is a bread-board friendly, B. Clock and Timer
ready to use solution for testing and educational purposes. ESP32 can use either he internal Phase Lock Loop (PLL)
ESP8266, ESP32 predecessor, was extremely popular for the of 320MHz or an external crystal. It is also possible to use an
design in many IoT related projects, however, ESP32 is a oscillating circuit as a clock source at 2-40MHz to generate
better solution which can be implemented in more complex the master clock CPU_CLK for both CPU cores. This clock
projects. can be as high as 160MHz for high performance or lower to
144
reduce the power consumption. All other clocks, like the operate as a station and be connected to the internet or server
APB_CLK for peripherals are driven by the master clock. In and access point in order to provide a user interface to, for
addition, there are several low power clocks like the internal example, smartphone running a mobile application [8].
RTC_CLK with a default frequency of 150kHz and the option
to adjust it for deep sleep modes. There are four 64-bit timers The microcontroller supports v4.2 BR/EDR and BLE
for generic purposes with 16-bit prescalers with a range from Bluetooth which fits the current standard and is capable to
2 to 65536. Each timer uses the APB clock, usually at 80MHz. operate at a speed up to 4 Mbps. ESP32 can operate under
Those timers can count either up or down, be frozen and various power modes – active mode (the chip radio is
trigger events. Besides 4 generic timers there are also timers to working) and modem-sleep mode (CPU is fully operational
drive the PWM controller. There are 8 high speed and 8 low but Wi-Fi and Bluetooth is powered off). Furthermore, there
are light and deep-sleep modes, where either both or only one
speed PWM channels, each driven by four timers [4].
CPU are operating at a lower performance. The GPIOs include
two 12-bit ADCs with 18 channels in sum. Those can be
C. Block Diagram and Functions configured for 9-bit, 10-bit and 12-bit resolutions with an
ESP32 microcontroller structure is designed to operate attenuation of −0dB, −6dB or −11dB for different input
under the following protocols – TCP/IP, full 802.11 b/g/n/e/i ranges. One ADC channel is connected to the integrated hall
WLAN MAC, and Wi-Fi Direct specification. The sensor in order to detect magnetic fields, whereas another to
microcontroller can provide Basic Service Set (BSS) STA and the temperature sensor with the range from −40°C to 125°C to
SoftAP operations under the Distributed Control Function monitor the chip temperature. Besides the ADCs there are also
(DCF) protocol. It is also support P2P group operation two 8-bit DACs to convert the digital signals into analogue
compliant with the latest Wi-Fi P2P protocol. Thus, it can voltage signal outputs. Ten of the GPIOs are capable to sense
capacitive variations and can be used for touch sensors. Since
those are high sensitive relatively small pads can be used.
Moreover, ESP32 provides a number of interfaces: an
Ethernet MAC Interface, one SD/SDIO/MMC Host
Controller, three UART interfaces up to 5Mbps, two I2C bus
interfaces with standard and fast mode, two I2C interfaces
with a frequency of 10kHz up to 10MHz, an 8-channel
infrared remote controller and an 8-channel pulse counter. The
PWM controller can be used to drive digital motors or
generate digital waveforms. Three SPIs can be used in slave or
master mode with a clock up to 80MHz. [8].
145
It is also possible to flash ESP32 out of Eclipse without
terminal opening anymore.
The common language for programming ESP32 is C, thus
most API libraries are also provided in C. However, the
microcontroller can be also easily programmed in C++. Some
Arduino libraries can be used under C++ programming option,
although some changes might be required. Neil Kolban, an
engineer from Texas provides plenty of C++ libraries in his
GitHub repository for the ESP32 APIs. Since this chip is open
source everyone can develop an “operating system” for the
ESP32, thus there are also solutions on the Internet to program
it in LUA, JavaScript, etc.
146
Fig. 7. ESP32 receive task listing.
Fig. 6. ESP32 main task listing.
147
The application output is illustrated in Fig. 8. This app has ESP32 performs much better than its predecessor ESP8266
been developed in Visual Studio using the Cordova widely used in a large variety of IoT applications. The
framework in order to develop it for multiple OS. Cordova is a excellent performance of the microcontroller is achieved due
common open source framework for hybrid cross-platform to dual core structure and a significant extension of the
applications. operational features. The microcontroller operating system
FreeRTOS is open source software providing a great support
The PCB designed and manufactured for this project for real time applications. Thus, it is expected that ESP32 will
contains ESP-WROOM-32, a 3.3V and −3.3V power supply play a major role in design of future IoT systems and
and an USB-UART-Bridge for programming. Moreover, two
embedded projects.
input channels include relays for the AC/DC/GND setting and
to set different scaling factors controlled by a MCP23017 I/O-
Expander along with a LM538 for each channel for scaling REFERENCES
and offset purposes. [1] S. Li, L.D. Xu, and S. Zhao, “The Internet of things: A survey,”
Information Systems Frontiers, vol. 17, no. 2, pp. 243–259, April 2015.
[2] L. Atzori, A. Iera, and G. Morabito, “The Internet of things: A survey,”
V. CONCLUSION Computer Networks, vol. 54, no. 15, pp. 2787–2805, Oct. 2010.
This paper discusses a new ESP32 system on a chip series [3] K.J. Singh, and D.S. Kapoor, “Create your own Internet of Things: A
with Wi-Fi and Bluetooth. A detailed comparison of several survey of IoT platforms,” IEEE Consumer Electronics Magazine, vol. 6,
IoT related modules has been provided to highlight the ESP32 no. 2, pp. 56-68, April 2017.
microcontroller technical parameters and functions. An [4] Espressif Systems. (2017, May 4). espressif.com [Online]. Available:
https://espressif.com/sites/default/files/documentation/
example of the microcontroller application has been presented esp32_technical_reference_manual_en.pdf. [Accessed 10 May 2017].
and discussed in order to demonstrate practical
[5] AI-Thinker Team. (2015). mintbox.in [Online]. Available: https://
implementation of this new component. mintbox.in/media/esp-12e.pdf
It has been shown that ESP32 is the excellent option for [6] Texas Instruments. (2017, March). ti.com [Online]. Available: http://
www.ti.com/lit/ds/symlink/cc3220mod.pdf
IoT devices due to the performance properties and price. The
microcontroller is available in various form-factors. The bread [7] Digi International Inc. (2015). digi.com [Online]. Available: https://
www.digi.com/pdf/ds_xbeewifis6b.pdf
board friendly version ESP32-DevKitC is a perfect solution
[8] Espressif Systems. (2017, April 11) espressif.com [Online]. Available:
for hobbyist and educational purposes, the ESP-WROOM-32 https://espressif.com/sites/default/files/documentation/
module provides a small solder friendly footage whereas the esp32_datasheet_en.pdf
ESP32 QFN48 is the option for industrial manufactures and [9] N. Kolban, Kolban’s Book on ESP32, USA: Leanpub, 2017.
small sized solutions.
148