In this article, you will learn about the ESP32 Wi-Fi and Bluetooth module and how to set it up.
What is ESP32?
The ESP8266 Wi-Fi module has been one of the most popular and practical modules in recent years. There are various versions of this module on the market. The ESP32 module is an upgraded version of the ESP8266. In addition to the Wi-Fi module, this module also includes Bluetooth 4.0. With a dual-core CPU operating frequency ranging from 80 to 240 MHz, the ESP32 is an ideal choice for IoT projects, as it includes two Wi-Fi and Bluetooth modules along with various input and output pins.
ESP32 Module Pin Distribution
Although the number of pins on the ESP32 is fewer than that of commonly used processors, there are no issues when multiple functions are reused on the pins.
Warning: The voltage level of the ESP32 pins is 3.3 volts. If you want to connect the ESP32 to other devices that operate at 5 volts, you should use a level converter to change the voltage levels.
● Power Pins: The module has two power pins – 5V and 3.3V. You can use these two pins to power other devices and modules.
● GND Pins: The module has three grounding pins. ● Enable Pin (EN): This pin is used to enable and disable the module. The module is enabled when the pin is high and disabled when low. ● Input/Output Pins (GPIO): You can use 32 GPIO pins to communicate with LEDs, switches, and other input/output devices. These pins can be pulled up or down internally. Note: GPIO6 to GPIO11 pins (SCK/CLK, SDO/SD0, SDI/SD1, SHD/SD2, SWP/SD3, and SCS/CMD pins) are used for SPI communication with the internal flash of the module and are not recommended for use. ● ADC: You can use the 16 ADC pins on this module to convert analog voltages (outputs from some sensors) into digital voltages. Some of these converters are connected to internal amplifiers capable of measuring small voltages with high precision. ● DAC: The ESP32 module has two digital-to-analog converters with 8-bit precision. ● Touch Pads: The ESP32 module has 10 pins that are sensitive to changes in capacitance. You can connect these pins to certain pads (pads on the PCB) and use them as touch switches. ● SPI: The module has two SPI interfaces for connecting displays, SD/microSD storage card modules, external flash, etc. ● I2C: The SDA and SCL pins are used for I2C communication. ● Serial Communication (UART): The module has two UART serial interfaces. Using these pins, you can transmit information between two devices at speeds up to 5Mbps. UART0 also has CTS and RTS control. ● PWM: Almost all ESP32 input/output pins can be used for PWM (Pulse Width Modulation). These pins can control motors, LED lights, colors, etc.
ESP32 Module Modes
The ESP32 chip has 5 modes:
● Active Mode: In this mode, all parts of the Wi-Fi and Bluetooth transmitters and receivers are active. The current consumption is between 80 and 260mA. ● Modem Sleep Mode: The processor remains active, but Wi-Fi and Bluetooth are disabled. In this case, the current consumption is between 3 and 20mA. ● Light Sleep Mode: The main processor stops working, but the RTC unit and ULP processor unit remain active. The current consumption is about 0.8 mA. ● Deep Sleep Mode: Only the RTC unit is active. In this mode, Wi-Fi and Bluetooth communication data is stored in the RTC’s memory. The current consumption in this mode is between 10 and 150μA. ● Hibernate Mode: All units are disabled except for the RTC timer used for the clock and some I/O pins connected to the RTC. The RTC timer or connected pins can wake the chip from this state. In this case, the current consumption is about 2.5μA. For more information, please refer to the module datasheet.
ESP32 Chip and Module Datasheet
The datasheet for the ESP32 module and its chipset can be downloaded from the Espressif official website (you can also contact customer service for a copy~).
ESP32 VS. ESP8266
There are various types of ESP32 and ESP8266 modules available on the market. In this section, we compare the ESP8266 NodeMcu and the ESP32 DEV module: ESP8266 NodeMcu ESP32 DEV Module
Power 3.3V 3.3V CPU Tensilica L106 32-bit Xtensa dual-core 32-bit LX6 Bluetooth No Supports Bluetooth v4.2 BR/EDR and BLE specifications GPIO 17 32 Flash Size Up to 16MB Up to 16MB ADC 10-bit 12-bit DAC No 2 * 8bit UART 2
Generally, ESP32 modules are more expensive than ESP8266. Therefore, if you do not need Bluetooth, digital converters, many I/O pins, etc., you can save money by purchasing the ESP8266 module. Required Materials ● ESP32 Module ● Arduino IDE
Installing ESP32 on Arduino IDE
The installation process for ESP32 is almost identical to that of ESP8266. To install ESP32 on the Arduino IDE, follow these steps:
(Note: You need Arduino IDE 1.8.5 or higher to install ESP32 on it) Step 1: Download the required files from GitHub
Download the ESP32 Arduino Core from the GitHub account. You can also use the direct download link (contact customer service for it~).
Step 2: Move the files to the Arduino sketchbook locationBy default, the Arduino sketchbook is located in “My Documents”. To find the exact path of the sketchbook, check the preferences from the “File” menu.
Create a new folder named hardware next to the Arduino folder in the sketchbook location.
Inside the hardware folder, create a folder named espressif, and then create another folder named esp32 inside the espressif folder. Finally, the path you created should look like this:
Unzip the files you downloaded in the previous step and move them to this address.
Step 3: Run get.exe
To install ESP32 on the Arduino software, you need to have the Xtensa GNU toolchain installed on your system. Go to esp32> tools and run the get.exe file.
After running get.exe, the required files will be automatically downloaded and transferred to the tools folder. This step may take some time.
Once the installation is complete, new files must be added to the tools folder.
Uploading Code to ESP32 Using Arduino IDE
Uploading code to the ESP32 module is similar to other Arduino development boards. You can use the built-in Arduino examples (like Blink) to test it. Note: If you have not previously installed the CP2102 driver on your computer, download and install it from here. To upload code, select the board type from the “Tools” menu. Then select the serial port connected to the board and click upload.
Troubleshooting
If you encounter the following errors, don’t worry. This issue often occurs when programming the ESP32. Follow these steps to resolve the issue:
1. Ensure that the upload baud rate is set correctly. Typically, this baud rate should be 115200.
2. Press and hold the Boot button on the development board. 3. Click the “Upload” option. 4. When you see the message “Writing at 0x00001000 … (100%)”, release your finger from the “Boot” button.
5. After the upload is complete, you will see a prompt that says “Done”.
The ESP32 is a System on Chip (SoC) for IoT developed by Espressif. The ESP32 features onboard Wi-Fi and Bluetooth (traditional + BLE), rich peripheral interfaces, a dual-core CPU, and a main frequency of 240M, which can meet almost all needs in the IoT field.
Welfare Time! Currently, I have obtained a super useful board (ESP32-DevKitC-32D module development board) with rich development resources for everyone to try out for free! If you want to get into IoT development, you can apply for a trial!
Here is a detailed introduction to this trial board:
【Product Introduction】
The ESP32-DevKitC V4 is a small development board based on ESP32 produced by Espressif, with most of the pins of the onboard module exposed, allowing developers to easily connect various peripheral devices via jumpers according to their actual needs or use the development board on a breadboard.
To better meet the needs of different users, the ESP32-DevKitC V4 also supports the following different configurations:
Various ESP32 modules available
ESP32-WROOM-32D
ESP32-WROOM-32U
ESP32-SOLO-1 Module
ESP32-WROVER
ESP32-WROVER-B
ESP32-WROVER-I
ESP32-WROVER-I (IPEX)
ESP32-WROOM-32 Module
Available with pin headers or female headers
【Function Description】
The main components, interfaces, and control methods of the ESP32-DevKitC V4 development board are shown below.
ESP32-DevKitC V4 (onboard ESP32-WROOM-32)
Note: Pins D0, D1, D2, D3, CMD, and CLK are used for internal communication between the ESP32 chip and the SPI flash, concentrated on the sides of the development board near the USB port. Generally, it is best not to connect these pins, as it may affect the operation of the SPI flash/SPI RAM.
【Power Options】
The development board can be powered in one of the following three ways:
Micro USB power supply (default)
5V / GND pin power supply
3V3 / GND pin power supply
【Tips Regarding C15】
Earlier versions of the ESP32-DevKitC development board may have the following issues with C15:
The development board may enter download mode after power on;
If the user outputs a clock through GPIO0, C15 may affect the signal.
If users believe C15 may affect the use of the development board, they can completely remove C15. The specific location of C15 on the development board is shown in the yellow part of the image below.
C15 (yellow) location on the ESP32-DevKitC V4 development board
【Application Development】
Before powering on the ESP32-DevKitC V4, please ensure that the development board is in good condition.
Now, please go to the Quick Start section to view the detailed installation steps and try to upload the example project to your development board.
【Development Board Dimensions】
SP32-DevKitC development board dimensions – view from below
How to Apply for Free Trial?


