You are on page 1of 10

diyi0t.

com /esp32-tutorial-what-do-you-have-to-know-about-the-esp32-microcontroller/

ESP32 tutorial: What do you have to know about the ESP32


microcontroller?
by cdaviddav ⋮ ⋮ 7/14/2019

There is a follow-up model of the ESP8266, a very powerful microcontroller with a low purchasing price:

The ESP32 also produced by Espressif Systems.

In this tutorial you learn :

Technical specifications of the ESP32


Pinout of the ESP32
Power supply of the ESP32, also including powering with a battery
Power modes and power consumption of the ESP32
Configure the ESP32 board in the Arduino IDE

1/10
Table of Contents

What is the ESP32?


The ESP32 is a powerful 32 bit microcontroller with integrated Wi-Fi, full TCP/IP stack for internet
connection and Bluetooth 4.2. Due to the low cost combined with great power and the opportunity to
connect the ESP32 to many other electronic devices, the microcontroller is well suited for IoT projects.

Technical specifications of the ESP32


TTensilica Xtensa 32-bit LX6 microprocessor with 2 cores
Power supply: 2.3V – 3.6V
Current consumption: 20µA – 240mA. In DeepSleep-Mode only 5µA

2/10
Operating temperature range: -40°C – 125°C
External flash memory: up to 16 MB is supported
Interfaces
UART/SDIO/SPI/I2C/I2S/IR Remote Control
36 programmable I/O pins max 20mA
2 analog input 0V to 1V with 12 bit resolution
all inputs tolerate maximum 3.6V
Network
WiFi
WiFi 802.11 b/g/n 2.4 GHz with WPA/WPA2 PSK
ipv4 and ipv6 from Arduino Core 2.5.0
UDP and TCP with 5 simultaneous connections as maximum
Bandwidth: 150 to 300 kByte/s
Latency: < 10ms
Bluetooth: v4.2 BR/EDR and Bluetooth Low Energy (BLE)

If you want a full comparison of the technical specifications of the ESP32 against the ESP8266 boards
and different Arduino boards, you will find this comparison in this article.

Pinout of the ESP32 NodeMCU

NodeMCU
Touch PWM Name Description
label
3.3V Power supply 3.3V, 400mA
EN ENABLE Low = Power Down, High = Enabled, has 12kΩ pull-up
SVP x Digital Input pin with PWM
SVN x

3/10
NodeMCU
Touch PWM Name Description
label
P34 x
P35 x
P32 TOUCH9 x Digital I/O pin with touch sensor and PWM
P33 TOUCH8 x
P25 x Digital-to-Analog Converter (DAC_1)
P26 x Digital-to-Analog Converter (DAC_2)
P27 TOUCH7 x Digital I/O pin with touch and PWM
P14 TOUCH6 x
P12 TOUCH5 x
GND Ground
P13 TOUCH4 x Digital I/O pin with touch and PWM
SD2 x Digital I/O pin with PWM
SD3 x
CMD x
5V x Power supply 5V-9V, 400mA
CLK x Digital I/O pin with PWM
SD0 x
SD1 x
P15 TOUCH3 x Digital I/O pin with touch and PWM
P2 TOUCH2 x
P0 TOUCH1 x
P4 TOUCH0 x
P16 x Digital I/O pin with PWM
P17 x
Digital I/O pin with SS (Slave Select) for SPI
P5 x SS
communication
Digital I/O pin and SCK (Serial Clock) for SPI
P18 x SCK
communication
Digital I/O pin and MISO (Master In Slave Out) for SPI
P19 x MISO
communication
GND Ground
P21 x Digital I/O pin with PWM
RX x Serial input of the ESP connected to the USB-UART
TX x Serial output of the ESP connected to the USB-UART
P22 x Digital I/O pin with PWM
Digital I/O pin and MOSI (Master Out Slave In) for SPI
P23 x MOSI
communication
GND Ground

Power supply of the ESP32 NodeMCU


When we want to know what possibilities we have to supply power to the ESP32, we have to understand
what are the different voltage levels on the PCB, starting from the supply pins and ending at the
microprocessor itself.

4/10
The following picture shows a schematic picture of the voltage levels on the ESP32 NodeMCU. The
additional tables show the voltage related specifications of the microprocessor and the voltage regulator.

Microcontroller Minimum Voltage Typical Voltage Maximum Voltage


ESP32 2.3V 3.3V 3.6V
Voltage Regulator Output Voltage Maximum Input Voltage Maximum Output Current
AMS1117 3.3V 15V 1A

The first and also the easiest possibility for a power supply is the 5V USB cable. But because the ESP32
runs on 3.3V, there is a built-in voltage regulator to transform the 5V of the USB connection to the desired
3.3V. The 3.3V pin of the NodeMCU PCB is also powered from this connection.

The second possibility is to use the VIN pin of the NodeMCU as input for the power supply. The AMS1117
voltage regulator has a maximum input voltage of 15V but in this case the regulator produces a lot of heat
because the regulator has no heat sink or cooling fan for heat dissipation. Therefore a voltage between
7V and 12V is recommended when the ESP32 is powered by the VIN pin.

There are also multiple options to power the ESP32 with different kinds off batteries. This is particular
interesting when you want to build a project that independent of a normal power supply like an outdoor
weather station.

If the maximum voltage of the battery is higher than the maximum voltage of the ESP32 (3.6V), you have
to use a voltage regulator to reduce the voltage to 3.3V. The output of the voltage regulator is then
connected to the 3.3V pin of the ESP32 board.

My recommendation for a battery power supply is the LiFePO4 battery, because you do not need any
extra voltage regulator between the ESP32 and the battery and they are rechargeable. Also LiFePO4
batteries have a capacity up to 6,000mAh, similar to LiPo and Li-ion batteries that gives your project a
long lifetime in combination with a power mode that reduces the power consumption to a minimum.

5/10
Microcontroller Datasheet eBook

The 35 pages Microcontroller Datasheet Playbook contains the most useful information of 14 Arduino,
ESP8266 and ESP32 microcontroller boards.

Power modes and power consumption of the ESP32


When Wi-Fi is enabled, the chip switches between Active and Modem-sleep modes. Therefore, power
consumption changes accordingly.

Power
Power Mode Description
consumption
WiFi Tx packet 180mA ~ 240mA
Active (RF
WiFi/BT Tx packet 130 mA
working)
WiFi/BT Rx and listening 95mA ~ 100mA
Dual-core
30mA ~ 68mA
240 chip(s)
MHz Single-core
N/A
chip(s)
Dual-core
27mA ~ 44mA
160 chip(s)
Modem-sleep The CPU is powered on
MHz Single-core
27mA ~ 34mA
chip(s)
Dual-core
20mA ~ 31mA
80 chip(s)
MHz Single-core
20mA ~ 25mA
chip(s)
Light-sleep - 0.8mA
Deep-sleep The ULP co-processor is powered on 150µA

6/10
Power
Power Mode Description
consumption
100µA @1%
ULP sensor-monitored pattern
duty
RTC timer + RTC memory 10µA
Hibernation RTC timer only 5µA
CHIP_PU is set to low level, the chip is
Power off 0.1µA
powered off.

RTC = Real Time Clock


ULP co-processor = Ultra-Low-Power Co-processor

Active mode
The chip radio is powered on. The chip can receive, transmit, or listen.

Modem-sleep mode
The CPU is operational and the clock is configurable. The Wi-Fi/Bluetooth base-band and radio are
disabled. In Modem-sleep mode, the CPU frequency changes automatically. The frequency depends on
the CPU load and the peripherals used.

Light-sleep mode
The CPU is paused. The RTC memory and RTC peripherals, as well as the ULP co-processor are
running. Any wake-up events (MAC, host, RTC timer, or external interrupts) will wake up the chip.

Deep-sleep mode
Only the RTC memory and RTC peripherals are powered on. Wi-Fi and Bluetooth connection data are
stored in the RTC memory. The ULP co-processor is functional.

Hibernation mode
The internal 8 MHz oscillator and ULP co-processor are disabled. The RTC recovery memory is powered
down. Only one RTC timer on the slow clock and certain RTC GPIOs are active. The RTC timer or the
RTC GPIOs can wake up the chip from the Hibernation mode.

Select the ESP32 board in the Arduino IDE


1. Make sure you have the latest version of the Arduino IDE installed. You can download the last
version of the official website.
2. The Arduino IDE supports a whole range of different Arduino boards after installation. Since we do
not want to program an Arduino board but the NodeMCU board we have to introduce the
NodeMCU board to the IDE. This is quite easy. Just klick on File → Preferences. Insert the
following URL for the Additional Board Manager URLs.

https://dl.espressif.com/dl/package_esp32_index.json

7/10
8/10
If you already have the ESP8266 boards URL, you can separate the URLs with a comma as follows:
https://dl.espressif.com/dl/package_esp32_index.json,
http://arduino.esp8266.com/stable/package_esp8266com_index.json

3. Now we have to install the ESP32 drivers. Open the boards manager and go to Tools > Board >
Boards Manager. Search for ESP32 and press install button for the “ESP32 by Espressif Systems“

9/10
Conclusion

In my opinion the ESP32 is a powerful microcontroller compared with an intuitive handling if you are
familiar with the ESP8266. The only downside in my opinion is the width of the board because like the
NodeMCU V3 it does not fit on the standard breadboard. Do you tried the ESP32 and what do you think
about it? Leave a comment below.

Recent Posts

MH-Z14A CO2 Meter Tutorial with Arduino, ESP8266 or ESP32


Control a DC Motor with Arduino, ESP8266 or ESP32 without IC
ESP8266 WeMos D1 Mini Tutorial
ESP8266 NodeMCU Tutorial
TCRT5000 Line Tracking Module for Arduino, ESP8266 and ESP32

10/10

You might also like