Esp 32
Esp 32
Esp 32
• What is ESP32?
• Difference between ESP32 and ESP8266
• ESP32 Functional Blocks and Features
• ESP32 Architectural Block diagram
• Wireless Connectivity:
• Core
• Memory
• Encryption hardware accelerators
• Peripheral Features
• ESP32 Pinout diagram and Pins:
• Digital pins
• ADC (Analog to digital
converters)
• DAC (Digital to Analog • Infrared remote controller
Converters) • PWM
• Capacitive Touch GPIOs • How to select an ESP32
• RTC development board?
• SD / SDIO / MMC driver • Other ESP32 Development
• UART Boards and Specialty
• I2C Projects
• SPI • Conclusion about the ESP32
chip
What is ESP32?
ESP32 is created by Espressif Systems with a series of SoC (System
on a Chip) and modules which are low cost with low power
consumption.
esp32 architectural block diagram lets learn all the individual blocks in detail below.
Wireless Connectivity:
The ESP32 SoC chip has WiFi connectivity, being compatible with 802.11 b / g / n in the
2.4GHz band, reaching speeds of up to 150 Mbits/s. It also includes Bluetooth
communication compatible with Bluetooth v4.2 and Bluetooth Low Energy (BLE).
The radio block is closely tied to the wireless communication modules .
In fact, this is the one that actually transmits and receives the information.
That is, it takes the digital data from the WiFi and Bluetooth modules and
converts them into electromagnetic signals that travel through the air to
communicate with your mobile phone or your router .
It also performs the reverse operation: translate the electromagnetic waves
generated by other devices into digital data that the WiFi and Bluetooth
modules are capable of interpreting.
Core
As we have already mentioned that the ESP32 has dual core low-power Tensilica
Xtensa 32-bit LX6 microprocessors.
As you can observe from the above core block image,
it has an ultra-low-power co-processor that is used to perform analog-digital
conversions and other operations while the device is operating in deep sleep low-
power mode. In this way, a very low consumption by the SoC is achieved.
It is important to note that these processors offer great typical advantages of a
digital signal processor :
•Operating frequency : 240 MHz (executes instructions 15 times faster than an
Arduino UNO board)
•It allows to perform operations with real numbers (numbers with commas) very
efficiently.
•Allows you to multiply large numbers instantly.
The internal memories are those that are already included in the SoC, and the external are
those that can be added to expand the capacity of the system .
Many ESP32- based development boards add external memory for a better performing
system.
ESP32 Internal memories and their functions:
•ROM memory (448 KiB) : this memory is write-only, that is, you cannot
reprogram it. This is where the codes that handle the Bluetooth stack , the Wi-
Fi physical layer control, some general-purpose routines, and the bootloader to
start the code from external memory are stored .
•Internal SRAM memory (520 KiB) : this memory is used by the processor to
store both data and instructions. Its advantage is that it is much easier for the
processor to access than the external SRAM.
•RTC SRAM (16 KiB) : this memory is used by the co-processor when the device
operates in deep sleep mode .
•Efuse (1 Kilobit) : 256 bits of this memory are used by the system itself and
the remaining 768 bits are reserved for other applications.
•Flash embedded ( Embedded flash ) : This memory is where our application
code is stored. The amount of memory varies depending on the chip used:
• 0 MB (chips ESP32-D0WDQ6, ESP32-D0WD, ESP32-S0WD)
• 2 MB (chip ESP32-D2WD)
• 4 MB (Chip ESP32-PICO-D4)
For ESP32s that do not have embedded memory or simply when memory is
insufficient for your application, it is possible to add more memory externally :
•Up to 16 MB of external flash memory can be added . This way you can develop
more complex applications.
•It also supports up to 8 MB of external SRAM memory .
Therefore, it is difficult for you to find yourself limited in memory when
implementing an application using this platform.
Encryption hardware accelerators
As you can see from the above image of ESP32 WROOM module pinout diagram, all the different types of pins are
mentioned in different colors which we are going to explain in detail below .
Digital pins
The ESP32 has a total of 34 digital pins . These pins are similar to Arduino digital
pins which allows you to add LED display, OLED display, sensors, buttons, buzzers,
etc. to our projects.
Most of these pins support the use of internal pull-up, pull-down, and high
impedance status as well. This makes them ideal for connecting buttons and
matrix keyboards, as well as for applying LED control techniques such as the well-
known Charlieplexing.
ESP32 WROOM module has 25 GPIO pins out of which there are only input pins,
pins with input pull up and pins without internal pullup.
Maximum current drawn per a single GPIO is 40mA according to the
“Recommended Operating Conditions” section in the ESP32 datasheet.
Input only pins: Pins with pull up Pins without internal
INPUT_PULLUP pull up
GPIO 34
GPIO 35 GPIO14 GPIO13
GPIO 36 GPIO16 GPIO25
GPIO 39 GPIO17 GPIO26
GPIO18 GPIO27
GPIO19 GPIO32
GPIO21 GPIO33
GPIO22
GPIO23
ADC (Analog to digital converters)
Some of the pins listed in the pinout diagram can also be used to
interact with analog sensors, same as analog pins of an Arduino
board .
For this, the ESP32 has a 12-bit(0-4096 resolution which means
when voltage observed is 0 the value is 0 and when max voltage
like 3.3v is observed the value goes to 4096), 18-channel analog to
digital converter, which means you can take readings from up to
18 analog sensors.
This allows you to develop very compact connected applications,
even when using multiple analog sensors.
Analog input pins: ADC2_CH0 (GPIO 4)
ADC2_CH1 (GPIO 0)
ADC1_CH0 (GPIO 36) ADC2_CH2 (GPIO 2)
ADC1_CH1 (GPIO 37) ADC2_CH3 (GPIO 15)
ADC1_CH2 (GPIO 38) ADC2_CH4 (GPIO 13)
ADC1_CH3 (GPIO 39) ADC2_CH5 (GPIO 12)
ADC1_CH4 (GPIO 32) ADC2_CH6 (GPIO 14)
ADC1_CH5 (GPIO 33) ADC2_CH7 (GPIO 27)
ADC1_CH6 (GPIO 34) ADC2_CH8 (GPIO 25)
ADC1_CH7 (GPIO 35) ADC2_CH9 (GPIO 26)
DAC (Digital to Analog Converters)
PWM signals are used on most Arduino boards to generate analog
voltages . The ESP32 has two 8 bit digital to analog converters .
This allows two pure analog voltage signals to be generated. These
converters can be used to:
•Control an analog circuit
•Manipulate the intensity of an LED
•Can even add a small amp and speaker to your project to play a
song.
DAC Pins:
•DAC1 (GPIO25)
•DAC2 (GPIO26)
Capacitive Touch GPIOs
In case if you want to develop applications with no mechanical
buttons, You can use the touch sensitive pins on ESP32s to achieve
it.
These pins are capable of detecting the small variations produced
when approaching a finger to the pin. In this way, it is possible to
create all kinds of controls such as buttons or slide bars without the
need for mechanical components.
Capacitive Touch pins:
T5 (GPIO 12)
T0 (GPIO 4) T6 (GPIO 14)
T1 (GPIO 0) T7 (GPIO 27)
T2 (GPIO 2) T8 (GPIO 33)
T3 (GPIO 15) T9 (GPIO 32)
T4 (GPIO 13)
RTC
As we already learnt about the RTC GPIO support in the core
section. The GPIOs which are routed to the RTC low-power
management subsystem can be used when the ESP32 is in deep
sleep. These RTC GPIOs can be used to wake up the ESP32 from
deep sleep when the Ultra Low Power (ULP) co-processor is
running. The following GPIOs can be used as an external wake up
source.
RTC_GPIO0 (GPIO36) RTC_GPIO7 (GPIO26) RTC_GPIO12 (GPIO2)
RTC_GPIO3 (GPIO39)
RTC_GPIO8 (GPIO33) RTC_GPIO13 (GPIO15)
RTC_GPIO4 (GPIO34)
RTC_GPIO9 (GPIO32) RTC_GPIO14 (GPIO13)
RTC_GPIO5 (GPIO35)
RTC_GPIO6 (GPIO25) RTC_GPIO10 (GPIO4) RTC_GPIO15 (GPIO12)
RTC_GPIO17 (GPIO27)
SD / SDIO / MMC driver
This peripheral allows the ESP32 to interact with SD and
MMC cards directly. In fact, by combining this controller
with the analog digital converter it is possible to
improve our little audio player .
UART
Many microcontrollers have UART modules , which on Arduino are known as
Serial ports.
These allow asynchronous communications between two devices using only
two pins.
The ESP32 has three UART ports :
•UART0
•UART1
•UART2
•All of these are compatible with RS-232 , RS-485 and IrDA protocols .
I2C
The ESP32 have two interfaces I2C or TWI that support the
operating modes master and slave. Its features include:
GPIO 21 (SDA)
GPIO 22 (SCL)
SPI
The ESP32 also has SPI communication . It has three fully functional buses:
•Four transfer modes: this means that it is compatible with all or almost all SPI and
QSPI devices available on the market.
•All SPI ports are capable of high speeds (theoretically up to 80 MHz).
•64-byte buffer for transmission and reception.
By default, the pin mapping for SPI is:
PWM pins:
All the PWM pins are indicated with the below symbol in the ESP32
Pinout Diagram above.
How to select an ESP32 development board?
Before selecting an ESP32 development board, you need to take into account
certain aspects:
ESP32-CAM : it is a development board based on ESP32 that has a camera, microSD card
slot and several GPIOs.
TTGO T-Call ESP32 with SIM800L GSM / GPRS : development board that combines an
ESP32 modulewith one SIM800L GSM / GPRS.
M5Stack : it is a very economical development board that has a 2-inch color LCD display, a
nice housing, USB type C connector for programming and power, I2C connectivity and a
group of GIPOs pins to connect it to all kinds of devices. .
ESP-EYE : is a development board for image recognition and audio processing, which can
be used in various AioT applications. It has an ESP32 chip, a 2 megapixel camera and a
microphone. ESP-EYE offers a lot of storage, with 8 Mbyte of SRAM and 4 Mbyte of flash
memory. It also supports image transmission over Wi-Fi and debugging through a Micro-
USB port.
Conclusion about the ESP32 chip
• This is the article about the ESP32, we learnt what is ESP32, How ESP32 works, ESP32
functional Block diagram with explanation, ESP 32 pins and their functions, ESP32
Security etc.,
• It is a new generation of boards and microcontrollers for the world of IoT, home
automation and connected objects.
• You can check our Projects related to ESP32 here like ECG monitoring system, plant
watering system and more: Best ESP32 Projects
• And although as you have seen in this article its power makes it a robust and affordable
microcontroller, the ESP8266 will still continue for a few more years with all of us.