Browse our Blog. You will find multiple applications, solutions, code examples. Navigate using the tag cloud or search using specific criteris

WiFi / Bluetooth Module ESP32

How it works


In this post will be explained how the module ESP32 works according to ESP32 Series Datasheet. At the end of the post there is a practical example. 

Here you have a link to the Datasheet:    

ESP32 Series Datasheet


ESP32 is a single 2.4 GHz Wi-Fi and Bluetooth combo chip designed with the TSMC ultra-low-power 40 nm technology. It is designed to achieve the best power and RF performance, showing robustness, versatility and reliability in a wide variety of applications and power scenarios. Some applications are Generic Low-power IoT Sensor Hub, Generic Low-power IoT Data Loggers and Mesh Network.

It is designed for mobile, wearable electronics, and Internet-of-Things (IoT) applications. It features all the state-of-the-art characteristics of low-power chips, including fine-grained clock gating, multiple power modes, and dynamic power scaling. The output of the power amplifier is also adjustable, thus contributing to an optimal trade-off between communication range, data rate and power consumption. 

General Features


  • 802.11 b/g/n 

  • 802.11 n (2.4 GHz), up to 150 Mbps


  • Bluetooth 4.2 BR/EDR BLE dual mode controller

  • +12 dBm transmitting power

  • NZIF receiver with -97 dBm BLE sensitivity

CPU and Memory

  • Xtensa single-/dual-core 32-bit LX6 microprocessor(s), up to 600 MIPS (200 MIPS for ESP32-S0WD, 400 MIPS for ESP32-D2WD)

  • 448 KB ROM

  • 520 KB SRAM

  • 16 KB SRAM in RTC ( 8KB RTC FAST Memory accessed by the main CPU during RTC Boot from the Deep-sleep mode and 8 KB RTC SLOW Memory accessed by the co-processor during the Deep-sleep mode). 

Clocks and Timers

  • Internal 8 MHz oscillator with calibration

  • Internal RC oscillator with calibration

  • External 2 MHz ~ 60 MHz crystal oscillator (40 MHz only for Wi-Fi/BT functionality)

  • External 32 kHz crystal oscillator for RTC with calibration

  • Two timer groups, including 2 x 64-bit timers and 1 x main watchdog in each group 

  • One RTC timer

  • RTC watchdog

Advanced Peripherial Interfaces

  • 34 x programmable GPIOs

  • 12-bit SAR ADC up to 18 channels

  • 2 x 8-bit DAC

  • 10 x touch sensors

  • 4 x SPI

  • 2 x I2S

  • 2 x I2C

  • 3 x UART

  • 1 host (SD/eMMC/SDIO)

  • 1 slave (SDIO/SP)

  • Ethernet MAC interface with dedicated DMA and IEEE 1588 support

  • CAN 2.0

  • IR (TX(RX)

  • Motor PWM

  • Motor PWM

  • LED PWM up to 16 channels

  • Hall sensor


  • Secure boot

  • Flash encryption

  • 1024-bit OTP, up to 768-bit for customers

  • Cryptographic hardware acceleration:

    • AES

    • Hash (SHA-2)

    • RSA

    • EXX

    • Random Number Generator (RNG)

The image below shows the ESP32 pinout:

For more information see Datasheet. 


ESP32 board

To load the program into the ESP32 you have to install the board. Go to File >  Preferences and into Additional Boards Manager URLs add the next URL

*If you already have one URL put it next to the other separeted by coma, like in the image below. 

Now you are able to install the board. Go to Tools > Boards > Boards Manager and search by ESP32. Will appear the esp32 by Espressif Systems. Install it.  

Once it is installed go to Tools > Boards and choose DOIT ESP32 DEVKIT V1



You will find some examples to test in File > Examples > Examples for ESP32 Dev Module. Let's take a look at the WiFi Scan example. 

Here you have the code with some additions and comments:

Wifi_Scan code:

#include "WiFi.h"

void setup()
    // Set WiFi to station mode and disconnect from an AP if it was previously connected
    Serial2.println("Setup done");

void loop()
    int start = millis(); // Capture start time 
    Serial2.println("scan start");

    // WiFi.scanNetworks will return the number of networks found
    int n = WiFi.scanNetworks();
    int finish = millis();
    Serial2.print("scan done, time = ");
    Serial2.print(finish - start);
    Serial2.println(" ms");
    if (n == 0) {
        Serial2.println("no networks found");
    } else {
        Serial2.println(" networks found");
        for (int i = 0; i < n; ++i) {
            // Print SSID and RSSI for each network found
            Serial2.print(i + 1);
            Serial2.print(": ");
            Serial2.print(" (");
            Serial2.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");

    // Wait a bit before scanning again

Load a program


To load a program you have to press the button BOOT  while is uploading the program. Once it is uploaded press the button EN to run the program. 


After uploading the previous program of WiFiScan you will see something like this in the Serial Monitor: 


You will find some examples to test in File > Examples > Examples for ESP32 Dev Module. Let's take a look at the BLE write example.