Chapter 1 Introduction To ESP32 WROOM32 MicroController
Chapter 1 Introduction To ESP32 WROOM32 MicroController
S1 2024
Chapter 1
Introductionto ESP32 WROOM 32
Microcontroller
www.vut.ac.za
1
Table of Contents
2
Introduction to ESP32
• Why are they so popular? Mainly because of the following features:
• Low-cost: you can get an ESP32 starting at $6, which makes it easily accessible to the general
public;
• Low-power: the ESP32 consumes very little power compared with other microcontrollers,
and it supports low-power mode states like deep sleep to save power
• Wi-Fi capabilities: the ESP32 can easily connect to a Wi-Fi network to connect to the internet
(station mode), or create its own Wi-Fi wireless network (access point mode) so other
devices can connect to it—this is essential for IoT and Home Automation projects—you can
have multiple devices communicating with each other using their Wi-Fi capabilities;
.
3
• Bluetooth: the ESP32 supports Bluetooth classic and Bluetooth Low Energy (BLE)—which is
useful for a wide variety of IoT applications;
• Dual-core: most ESP32 are dual-core— they come with 2 Xtensa 32-bit LX6
microprocessors: core 0 and core 1.
• Rich peripheral input/output interface—the ESP32 supports a wide variety of input (read
data from the outside world) and output (to send commands/signals to the outside world)
peripherals like capacitive touch, ADCs, DACs, UART, SPI, I2C, PWM, and much more
• Compatible with the Arduino “programming language”: those that are already familiar
with programming the Arduino board, you’ll be happy to know that they can program the
ESP32 in the Arduino style.
• Compatible with MicroPython: you can program the ESP32 with MicroPython firmware,
which is a re-implementation of Python 3 targeted for microcontrollers and embedded
systems.
4
ESP32 Specifications
Wireless connectivity WiFi: 150.0 Mbps data rate with HT40
Bluetooth: BLE (Bluetooth Low Energy) and Bluetooth Classic
Processor: Tensilica Xtensa Dual-Core 32-bit LX6 microprocessor, running at 160 or 240 MHz
Memory:
ROM: 448 KB (for booting and core functions)
SRAM: 520 KB (for data and instructions)
RTC fast SRAM: 8 KB (for data storage and main CPU during RTC Boot from the deep-sleep mode) Real
time clock
RTC slow SRAM: 8KB (for co-processor accessing during deep-sleep mode)
eFuse: 1 Kbit (of which 256 bits are used for the system (MAC address and chip configuration) and the
remaining 768 bits are reserved for customer applications, including Flash-Encryption and Chip-ID)
Embedded flash: flash connected internally via IO16, IO17, SD_CMD, SD_CLK, SD_DATA_0 and
SD_DATA_1 on ESP32-D2WD and ESP32-PICO-D4.
0 MiB (ESP32-D0WDQ6, ESP32-D0WD, and ESP32-S0WD chips)
2 MiB (ESP32-D2WD chip)
4 MiB (ESP32-PICO-D4 SiP module)
Low Power: ensures that you can still use ADC conversions, for example, during deep sleep.
5
Peripheral Input/Output:
• ESP32 refers to the bare ESP32 chip. However, the “ESP32” term is also used to refer
to ESP32 development boards. Using ESP32 bare chips is not easy or practical,
especially when learning, testing, and prototyping. Most of the time, you’ll want to
use an ESP32 development board.
• These development boards come with all the needed circuitry to power and program
the chip, connect it to your computer, pins to connect peripherals, built-in power and
control LEDs, an antenna for wi-fi signal, and other useful features. Others even come
with extra hardware like specific sensors or modules, displays, or a camera in the
case of the ESP32-CAM.
7
How to Choose an ESP32 Development Board?
Once you start searching for ESP32 boards online, you’ll find there is a wide variety of boards from different
vendors. While they all work in a similar way, some boards may be more suitable for some projects than
others. When looking for an ESP32 development board there are several aspects you need to take into
account:
• USB-to-UART interface and voltage regulator circuit. Most full-featured development boards have these
two features. This is important to easily connect the ESP32 to your computer to upload code and apply
power.
• BOOT and RESET/EN buttons to put the board in flashing mode or reset (restart) the board. Some boards
don’t have the BOOT button. Usually, these boards go into flashing mode automatically.
• Pin configuration and the number of pins. To properly use the ESP32 in your projects, you need to have
access to the board pinout (like a map that shows which pin corresponds to which GPIO and its features).
So make sure you have access to the pinout of the board you’re getting. Otherwise, you may end up using
the ESP32 incorrectly.
• Antenna connector. Most boards come with an onboard antenna for Wi-Fi signal. Some boards come with
an antenna connector to optionally connect an external antenna. Adding an external antenna increases
your Wi-Fi range.
• Battery connector. If you want to power your ESP32 using batteries, there are development boards that
come with connectors for LiPo batteries—this can be handier. You can also power a “regular” ESP32 with
batteries through the power pins.
9
Universal Asynchronous Receiver/Transmitter
What is the best ESP32 development board for beginners?
For beginners, we recommend an ESP32 board with a vast selection of available GPIOs,
and without any extra hardware features. It’s also important that it comes with
voltage regular and USB input for power and upload code.
In most of our ESP32 projects, we use the ESP32 DEVKIT DOIT board, and that’s the
one we recommend for beginners. There are different versions of this board with a
different number of available pins (30, 36, and 38)—all boards work in a similar way.
10
10
11
ESP32 GPIOs Pinout Guide
The ESP32 chip comes with 48 pins with multiple functions. Not all pins are exposed in
all ESP32 development boards, and some pins should not be used. The ESP32 DEVKIT V1
DOIT board usually comes with 36 exposed GPIOs that you can use to connect
peripherals.
Power Pins
Usually, all boards come with power pins: 3V3, GND, and VIN. You can use these pins to power the
board (if you’re not providing power through the USB port), or to get power for other peripherals (if
you’re powering the board using the USB port).
General Purpose Input Output Pins (GPIOS)
Almost all GPIOs have a number assigned and that’s how you should refer to them—by their number.
With the ESP32 you can decide which pins are UART, I2C, or SPI – you just need to set that on the
code. This is possible due to the ESP32 chip’s multiplexing feature that allows to assign multiple
functions to the same pin.
If you don’t set them on the code, the pins will be configured by default as shown in the figure below
(the pin location can change depending on the manufacturer). Additionally, there are pins with
specific features that make them suitable or not for a particular project.
12
13
How to Program the ESP32?
The ESP32 can be programmed using different firmware and programming languages.
You can use:
•Arduino C/C++ using the Arduino core for the ESP32
•Espressif IDF (IoT Development Framework)
•Micropython
•JavaScript
•LUA
•…
Our preferred method to program the ESP32 is with C/C++ “Arduino programming
language”. We also have some guides and tutorials using MicroPython firmware.
Throughout this guide, we’ll cover programming the ESP32 using the Arduino core for the
ESP32 board. If you prefer using MicroPython, please refer to this guide: Getting Started
with MicroPython on ESP32.
14
THANKYOU
Andries Potgieter Blvd. Vanderbijlpark, 1900 , South Africa | T 098 008 8900 | E enquiries@ vut. ac. za www.vut.ac.za
15