A few years ago, the ESP8266 revolutionized the embedded IoT world. For less than $3, you could get a programmable, WiFi-enabled microcontroller capable of monitoring and controlling things from anywhere in the world.

After the overwhelming success of the ESP8266, Espressif (the semiconductor company that created the ESP8266) has released a perfect supercharged upgrade � the ESP32. It incorporates not only WiFi but also Bluetooth 4.0 (BLE/Bluetooth Smart), making it ideal for any Internet of Things (IoT) application.

Introducing the ESP32

The ESP32 is actually a series of microcontrollers created and developed by Espressif Systems, a Shanghai-based Chinese company. The following features are the primary reasons why people like the ESP32:

dualcore ico

Dual-core Processor

The ESP32 is equipped with a Tensilica Xtensa� Dual-Core 32-bit LX6 microprocessor that operates at an adjustable clock frequency of 80 to 240 MHz and performs at up to 600 DMIPS (Dhrystone Million Instructions Per Second)

power ico

Ultra-Low Power Consumption

With its multiple power modes and dynamic power scaling, ESP32 achieves ultra-low power consumption, making it ideal for use in mobile devices, wearable electronics and IoT applications.

wifi ico

Wi-Fi Capabilities

The ESP32 incorporates an 802.11b/g/n HT40 Wi-Fi transceiver, allowing it to connect to a Wi-Fi network to access the internet (Station mode) or to create its own Wi-Fi wireless network (Soft access point mode) to which other devices can connect.

bluetooth ico

Dual-mode Bluetooth Capabilities

The ESP32 supports Bluetooth 4.0 (BLE/Bluetooth Smart) as well as Bluetooth Classic (BT), making it suitable for a wide range of IoT applications.

peripherals ico

Rich set of Peripherals

The ESP32 includes a plethora of built-in peripherals such as capacitive touch, ADCs, DACs, UART, SPI, I2C, PWM, and much more.

ways ico

Many Development Platforms

There are several development platforms available for programming the ESP32. You can use the Arduino IDE, MicroPython, Espruino, Espressif SDK, or one of the platforms listed on WikiPedia.

temperature ico

Robust Design

The ESP32 can operate reliably in industrial environments with operating temperatures ranging from -40�C to +125�C.

lowcost ico

Low Cost

It is one of the cheap microcontrollers, with prices beginning at $6; this makes them accessible to a wide audience.

ESP32 Development Boards

To get started with the ESP32, you�ll need a good development board that includes all the extras. There are numerous varieties of development boards out there. While they all function similarly, some boards may be better suited to specific projects than others.

The following are just a few of the many different types of ESP32 boards you can try out.

esp32 devkit v1

ESP32 DevKit V1

Because of its immense popularity, this is the best board for beginners. It comes with everything you need to get started with ESP32. And this is what we will use for our experiments.

esp32 oled board

ESP32 OLED Kit

Compared to the previous board, this one includes an OLED display, making it a neat addition for Internet of Things applications. Additionally, it has a u.FL connector for an external antenna and a lipo battery connector for creating battery-operated projects.

esp32 cam

ESP32-CAM

Built-in OV2640 2MP camera and microSD card slot make this one of the most interesting boards available; it�s ideal for IoT projects that require a camera with advanced functions like image tracking and recognition.

esp32 sim800l ttgo t call

ESP32 SIM800L TTGO T-Call

Don�t have WiFi? No problem. The ESP32 SIM800L TTGO T-Call board allows you to connect to the Internet via a SIM card data plan and push information to the cloud, without the need for Wi-Fi.

esp32 m5stack

M5Stack

M5Stack is a stackable modular product development toolkit based on ESP32. The M5 ecosystem includes a main controller and additional modules that can be stacked (similar to Arduino shields) to expand the functionality of the projects.

ESP32 DevKit V1 Board Hardware Overview

When it comes to ESP32 development boards, the ESP32 DevKit v1 is by far the most widely used option. This is what we will use for our experiments. Don�t worry if you have a different board; the information on this page should still be useful.

Let�s take a deep dive into the hardware overview of the ESP32 DevKit v1 board.

ESP-WROOM-32 Module

This development board is equipped with the ESP-WROOM-32 module, which contains the Tensilica Xtensa� Dual-Core 32-bit LX6 microprocessor. This processor is similar to the one used in the ESP8266, but it has two CPU cores (which can be individually controlled), operates at an adjustable clock frequency of 80 to 240 MHz, and can perform at up to 600 DMIPS (Dhrystone Million Instructions Per Second).

ESP-WROOM-32 Chip
  • Xtensa� Dual-Core 32-bit LX6
  • Upto 240MHz Clock Freq.
  • 520kB internal SRAM
  • 4MB external flash
  • 802.11b/g/n Wi-Fi transceiver
  • Bluetooth 4.2/BLE
esp32 hardware specifications esp wroom 32 chip

There�s also 448 KB of ROM, 520 KB of SRAM, and 4 MB of Flash memory (for program and data storage), which is sufficient to handle the long strings that make up web pages or JSON/XML data.

The ESP32 incorporates an 802.11b/g/n HT40 Wi-Fi transceiver, allowing it to connect to a Wi-Fi network to access the internet (Station mode) or to create its own Wi-Fi wireless network (Soft access point mode) to which other devices can connect.

The ESP32 also supports WiFi Direct, which is a good option for peer-to-peer connections that do not require an access point. WiFi Direct is simpler to set up and has much faster data transfer speeds than Bluetooth.

The chip supports both Bluetooth 4.0 (BLE/Bluetooth Smart) and Bluetooth Classic (BT), which makes it even more versatile.

Power

Because the ESP32�s operating voltage range is 2.2V to 3.6V, the board includes an LDO voltage regulator to keep the voltage stable at 3.3V. It can reliably provide up to 600 mA, which should be sufficient even when the ESP32 is drawing its maximum current during RF transmissions.

Power Requirement
  • Operating Voltage: 2.2V to 3.6V
  • On-board 3.3V 600mA regulator
  • 5 �A during Sleep Mode
  • 250mA during RF transmissions
esp32 hardware specifications power supply

The output of the 3.3V regulator is broken out to the header pin labeled 3V3. This pin can be used to power external circuitry.

The ESP32 development board is typically powered by the on-board MicroB USB connector. Alternatively, if you have a regulated 5V power supply, you can use the VIN pin to power the ESP32 and its peripherals directly.

Peripherals and I/O

Although the ESP32 has 48 GPIO pins in total, only 25 of them are broken out to pin headers. These pins can be assigned a variety of peripheral duties, including:

  • 15 ADC channels � 15 channels of 12-bit SAR ADC with selectable ranges of 0-1V, 0-1.4V, 0-2V, or 0-4V
  • 2 UART interfaces � 2 UART interfaces with flow control and IrDA support
  • 25 PWM outputs � 25 PWM pins to control things like motor speed or LED brightness.
  • 2 DAC channels � Two 8-bit DACs to generate true analog voltages
  • SPI, I2C & I2S interface � Three SPI and one I2C interfaces for connecting various sensors and peripherals, as well as two I2S interfaces for adding sound to your project.
  • 9 Touch Pads � 9 GPIOs with capacitive touch sensing.
Multiplexed I/Os
  • 15 ADC channels
  • 2 UART interfaces
  • 25 PWM outputs
  • 2 DAC channels
  • SPI, I2C & I2S interface
  • 9 Touch Pads
esp32 hardware specifications multiplexed gpio pins

Thanks to the ESP32�s pin multiplexing feature, which allows multiple peripherals to share a single GPIO pin. For example, a single GPIO pin can act as an ADC input, DAC output, or touch pad.

Input Only GPIOs

Pins GPIO34, GPIO35, GPIO36(VP) and GPIO39(VN) cannot be configured as outputs. They can be used as digital or analog inputs, or for other purposes. They also lack internal pull-up and pull-down resistors, unlike the other GPIO pins.

On-board Switches & LED Indicators

There are two buttons on the ESP32 development board. The Reset button, labeled EN, is used to reset the ESP32 chip. The other button is the Boot button, which is used to download new software or programs.

Switches & Indicators
  • EN � Reset the ESP32 chip
  • Boot � Download new programs
  • Red LED � Power Indicator
  • Blue LED � User Programmable
esp32 hardware specifications reset boot buttons led indicators

The board also includes two LED indicators. The Red LED indicates that the board is turned on, whereas the Blue LED is user programmable and connected to the board�s D2 pin.

Serial Communication

The board includes Silicon Labs� CP2102 USB-to-UART Bridge Controller, which converts USB signals to serial and allows you to program the ESP32 chip.

Serial Communication
  • CP2102 USB-to-UART converter
  • 5 Mbps communication speed
  • IrDA support
esp32 hardware specifications usb to ttl converter

ESP32 Development Board Pinout

The ESP32 DevKit V1 development board has 30 pins in total. For convenience, pins with similar functionality are grouped together. The pinout is as follows:

esp32 pinout

Power Pins There are two power pins: the VIN pin and the 3V3 pin. The VIN pin can be used to directly power the ESP32 and its peripherals, if you have a regulated 5V power supply. The 3V3 pin is the output from the on-board voltage regulator; you can get up to 600 mA from it.

GND is the ground pin.

GPIO Pins The ESP32 development board has 25 GPIO pins that can be assigned different functions by programming the appropriate registers. There are several kinds of GPIOs: digital-only, analog-enabled, capacitive-touch-enabled, etc. Analog-enabled GPIOs and capacitive-touch-enabled GPIOs can be configured as digital GPIOs. All GPIOs can be configured as interrupts.

ADC Channels ESP32 integrates two 12-bit SAR ADCs and supports measurements on 15 channels (analog-enabled pins). Some of these pins can be used to build a programmable gain amplifier for measuring small analog signals. Additionally, the ESP32 is designed to measure voltages while in sleep mode.

DAC Channels The ESP32 includes two 8-bit DAC channels for converting digital signals to true analog voltages. It can be used as a �digital potentiometer� to control analog devices.

Touch Pads The board has 9 capacitive touch-sensing GPIOs. When a capacitive load (such as a human finger) is in close proximity to the GPIO, the ESP32 detects the change in capacitance.

SPI Pins ESP32 has three SPIs (SPI, HSPI, and VSPI) in slave and master modes. These SPIs also support the general-purpose SPI features listed below:

  • 4 timing modes of the SPI format transfer
  • Up to 80 MHz and the divided clocks of 80 MHz
  • Up to 64-Byte FIFO

Only VSPI and HSPI are usable SPI interfaces, and the third SPI bus is used by the integrated flash memory chip. VSPI pins are commonly used in standard libraries.

I2C Pins The ESP32 has a single I2C bus that allows you to connect up to 112 sensors and peripherals. The SDA and SCL pins are, by default, assigned to GPIO21 and GPIO22, respectively. However, you can bit-bang the I2C protocol on any GPIO pin with wire.begin(SDA, SCL) command.

UART Pins The ESP32 dev. board has two UART interfaces, UART0 and UART2, that support asynchronous communication (RS232 and RS485) and IrDA at up to 5 Mbps. UART provides hardware management of the CTS and RTS signals and software flow control (XON and XOFF) as well.

~ PWM Pins The board has 25 channels (nearly all GPIO pins) of PWM pins controlled by a PWM controller. The PWM output can be used for driving digital motors and LEDs. The PWM controller consists of the PWM timers and the PWM operator. Each timer provides timing in synchronous or independent form, and each PWM operator generates the waveform for one PWM channel.

EN Pin is used to enable the ESP32. When pulled HIGH, the chip is enabled; when pulled LOW, the chip operates at low power.

For more information, refer to our comprehensive ESP32 pinout guide. This guide also explains which ESP32 GPIO pins are safe to use and which pins should be used with caution.

ESP32 Development Platforms

There are several development platforms available for programming the ESP32.

You can go with Espruino (JavaScript SDK and firmware closely emulating Node.js), Mongoose OS (an operating system for IoT devices that is recommended by Espressif Systems and Google Cloud IoT), MicroPython (implementation of Python 3 for microcontrollers), an SDK provided by Espressif, or one of the platforms listed on WiKiPedia.

Fortunately, the amazing ESP32 community recently took the IDE selection a step further by creating an Arduino add-on. If you�re just getting started with the ESP32, we recommend starting with this environment, which we�ll cover in this tutorial. For more information, visit the ESP32 Arduino GitHub repository.

Installing the ESP32 Arduino Core

The first step in installing the ESP32 core Arduino is to have the latest version of the Arduino IDE (Arduino 1.8.5 or higher) installed on your computer. If you haven�t already, we recommend that you do so right away.

Latest Arduino IDE

Then, launch the Arduino IDE and navigate to File > Preferences.

arduino ide preferences

Fill in the �Additional Board Manager URLs� field with the following. This will include support for both ESP32 and ESP8266 boards.

https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json

Then, click the �OK� button.

arduino ide esp32 json url

Now navigate to Tools > Board > Boards Manager�

arduino ide boards manager

Filter your search by entering �esp32�. Look for ESP32 by Espressif Systems. Click on that entry, and then choose Install.

arduino ide esp32 package

After installing, restart your Arduino IDE and navigate to Tools > Board to ensure you have ESP32 boards available.

arduino ide boards manager esp32 option

Now select your board in the Tools > Board menu (in our case, it�s the DOIT ESP32 DEVKIT V1). If you are unsure which board you have, select ESP32 Dev Module.

arduino ide boards manager esp32 boards

Finally, connect the ESP32 board to your computer and select the Port (if the COM port does not appear in your Arduino IDE, you will need to install the CP210x USB to UART Bridge VCP Drivers):

arduino ide esp32 port selection

That�s it! You can now begin writing code for your ESP32 in the Arduino IDE.

You should make sure you always have the most recent version of the ESP32 Arduino core installed.

Simply navigate to Tools > Board > Boards Manager, search for ESP32, and verify the version you have installed. If a newer version is available, you should install it.

ESP32 Example Sketches

The ESP32 Arduino core includes several example sketches. To access the example sketches, navigate to File > Examples > ESP32.

You will see a selection of example sketches. You can choose any of them to load the sketch into your IDE and start experimenting with it.

arduino ide esp32 package examples

To ensure that everything is properly configured, we�ll upload the most basic sketch of all � Blink!

This test uses the on-board LED. As previously mentioned in this tutorial, the D2 pin of the board is connected to the on-board Blue LED and is user programmable.

int ledPin = 2;

void setup() {
    pinMode(ledPin, OUTPUT);
}

void loop() {
	digitalWrite(ledPin, HIGH);
	delay(500);
	digitalWrite(ledPin, LOW);
	delay(500);
}

When the code is uploaded, the LED will begin to blink. To get your ESP32 to run the sketch, you may need to press the EN button.

ESP32 Development Board Blink Sketch Working Arduino IDE

Troubleshooting � Booting up ESP32

Some ESP32 boards enter flashing mode automatically, and the code is uploaded successfully, while others do not, and you may receive the �A fatal error occurred: Failed to connect to ESP32� Timed out waiting for packet header�� error:

Failed to connect to ESP32 Error while Uploading Sketch in Arduino IDE

This is a common issue, and it indicates that your ESP32 is not in flashing or uploading mode. You can resolve this issue by following the steps outlined below.

  • Hold down the BOOT button on your ESP32 board.
  • Press the Upload button in the Arduino IDE to upload a new sketch.
  • Release the BOOT button when the Writing at 0x00001000� (100%) message appears in the Arduino IDE log after Connecting�.
  • You should now see the �Done uploading� message.

That�s it. Now, press the EN button to restart the ESP32 and run the newly uploaded sketch.

Remember! You�ll have to repeat that button sequence every time you want to upload a new sketch.


Login
ADS CODE